*~
-aclocal.m4
#*
-*.la
*.o
-*.lo
*.a
*.exe
*.lib
-stamp-h1
-configure
config.h
-config.h.in
*.cache
-libtool
-config.status
log
-config.log
-Makefile.in
Makefile
-.deps
-.libs
lib*.pc
Doxyfile
doxygen-doc
.project
.cproject
+CMakeLists.txt.user
-Current developers:
+Current lead developers:
David van der Spoel <spoel@gromacs.org>
Berk Hess <hess@gromacs.org>
Erik Lindahl <lindahl@gromacs.org>
-A full list of Gromacs contributors
-is available at http://www.gromacs.org
+A full list of Gromacs contributors is available at http://www.gromacs.org/About_Gromacs/People
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 2.8)
# Keep CMake suitably quiet on Cygwin
set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
# machine with no git.
#
# NOTE: when releasing the "-dev" suffix needs to be stripped off!
-set(PROJECT_VERSION "4.5.5-dev")
+set(PROJECT_VERSION "4.6-dev")
set(CUSTOM_VERSION_STRING ""
CACHE STRING "Custom version string (if empty, use hard-coded default)")
mark_as_advanced(CUSTOM_VERSION_STRING)
set(SOVERSION 6)
# It is a bit irritating, but this has to be set separately for now!
SET(CPACK_PACKAGE_VERSION_MAJOR "4")
-SET(CPACK_PACKAGE_VERSION_MINOR "5")
-SET(CPACK_PACKAGE_VERSION_PATCH "5")
+SET(CPACK_PACKAGE_VERSION_MINOR "6")
+#SET(CPACK_PACKAGE_VERSION_PATCH "0")
# Cmake modules/macros are in a subdirectory to keep this file cleaner
########################################################################
option(GMX_DOUBLE "Use double precision (much slower, use only if you really need it)" OFF)
option(GMX_MPI "Build a parallel (message-passing) version of GROMACS" OFF)
-option(GMX_THREADS "Build a parallel (thread-based) version of GROMACS (cannot be combined with MPI yet)" ON)
+option(GMX_THREAD_MPI "Build a thread-MPI-based multithreaded version of GROMACS (not compatible with MPI)" ON)
option(GMX_SOFTWARE_INVSQRT "Use GROMACS software 1/sqrt" ON)
mark_as_advanced(GMX_SOFTWARE_INVSQRT)
option(GMX_POWERPC_INVSQRT "Use PowerPC hardware 1/sqrt" OFF)
CACHE STRING "Accelerated kernels. Pick one of: auto, none, SSE, BlueGene, Power6, ia64, altivec, fortran")
set(GMX_FFT_LIBRARY "fftw3"
- CACHE STRING "FFT library choices: fftw3,fftw2,mkl,fftpack[built-in]")
+ CACHE STRING "FFT library choices: fftw3,mkl,fftpack[built-in]")
option(GMX_DISABLE_FFTW_MEASURE
"Do not optimize FFTW setups (not needed with SSE)" OFF)
mark_as_advanced(GMX_DISABLE_FFTW_MEASURE)
option(BUILD_SHARED_LIBS "Enable shared libraries (can be problematic with MPI, Windows)" ${SHARED_LIBS_DEFAULT})
option(GMX_MPI_IN_PLACE "Enable MPI_IN_PLACE for MPIs that have it defined" ON)
mark_as_advanced(GMX_MPI_IN_PLACE)
-option(GMX_DLOPEN "Compile with dlopen, needed to read VMD supported file formats" ON)
-mark_as_advanced(GMX_DLOPEN)
+option(GMX_LOAD_PLUGINS "Compile with plugin support, needed to read VMD supported file formats" ON)
+mark_as_advanced(GMX_LOAD_PLUGINS)
option(GMX_IA32_ASM "Add SSE assembly files for IA32" OFF)
option(GMX_X86_64_ASM "Add SSE assembly files for X86_64" OFF)
mark_as_advanced(GMX_X86_64_ASM)
+option(GMX_OPENMP "Enable OpenMP-based mutithreading. " ON)
+
option(USE_VERSION_H "Generate development version string/information" ON)
mark_as_advanced(USE_VERSION_H)
set (GMX_LIBS_SUFFIX "_gpu")
endif(GMX_OPENMM)
mark_as_advanced(FORCE GMX_BINARY_SUFFIX GMX_LIBS_SUFFIX)
- message(STATUS "Using default binary suffix: \"${GMX_BINARY_SUFFIX}\"")
- message(STATUS "Using default library suffix: \"${GMX_LIBS_SUFFIX}\"")
+ if (NOT SUFFIX_QUIETLY)
+ message(STATUS "Using default binary suffix: \"${GMX_BINARY_SUFFIX}\"")
+ message(STATUS "Using default library suffix: \"${GMX_LIBS_SUFFIX}\"")
+ endif (NOT SUFFIX_QUIETLY)
else(GMX_DEFAULT_SUFFIX)
mark_as_advanced(CLEAR GMX_BINARY_SUFFIX GMX_LIBS_SUFFIX)
- message(STATUS "Using manually set binary suffix: \"${GMX_BINARY_SUFFIX}\"")
- message(STATUS "Using manually set library suffix: \"${GMX_LIBS_SUFFIX}\"")
+ if (NOT SUFFIX_QUIETLY)
+ message(STATUS "Using manually set binary suffix: \"${GMX_BINARY_SUFFIX}\"")
+ message(STATUS "Using manually set library suffix: \"${GMX_LIBS_SUFFIX}\"")
+ endif (NOT SUFFIX_QUIETLY)
endif(GMX_DEFAULT_SUFFIX)
+set(SUFFIX_QUIETLY TRUE CACHE INTERNAL "")
set(PKG_CFLAGS "")
if(GMX_DOUBLE)
########################################################################
#Process MPI settings
########################################################################
-include(CheckCSourceCompiles) # for gmxTestMPI_IN_PLACE
-if(GMX_MPI)
- if(GMX_THREADS)
- #message(FATAL_ERROR "Thread-based parallelization conflicts with MPI.")
- set(GMX_THREADS OFF CACHE BOOL
- "Thread-based parallelization conflicts with MPI." FORCE)
- endif(GMX_THREADS)
- find_package(MPI)
- if(MPI_FOUND)
- set(GROMACS_C_FLAGS ${GROMACS_FLAGS} ${MPI_COMPILE_FLAGS})
- set(GROMACS_LINKER_FLAGS ${GROMACS_LINKER_FLAGS} ${MPI_LINK_FLAGS})
-
- include_directories(${MPI_INCLUDE_PATH})
- list(APPEND GMX_EXTRA_LIBRARIES ${MPI_LIBRARIES})
- if(GMX_FAHCORE)
- add_definitions( -DMPI ) #for FAHCORE
- endif(GMX_FAHCORE)
- include(gmxTestMPI_IN_PLACE)
- if (GMX_MPI_IN_PLACE)
- gmx_test_mpi_in_place(MPI_IN_PLACE_EXISTS)
- endif (GMX_MPI_IN_PLACE)
-
- # test for unsuitable versions of OpenMPI
- exec_program(${MPIEXEC}
- ARGS --version
- OUTPUT_VARIABLE MPI_TYPE
- RETURN_VALUE MPI_EXEC_RETURN)
- if(MPI_EXEC_RETURN EQUAL 0)
- if(MPI_TYPE MATCHES "Open MPI|OpenRTE")
- string(REGEX MATCH "[0-9]+\\.[0-9]*\\.?[0-9]*" MPI_VERSION ${MPI_TYPE})
- if(MPI_VERSION VERSION_LESS "1.4.1")
- MESSAGE(WARNING "
- There are known problems with OpenMPI version < 1.4.1.
- Please consider updating your OpenMPI.")
- endif(MPI_VERSION VERSION_LESS "1.4.1")
- unset(MPI_VERSION)
- else(MPI_TYPE MATCHES "Open MPI|OpenRTE")
- # This is not OpenMPI, so give the old generic warning message
- MESSAGE(WARNING "
- There are known problems with some MPI implementations:
- MVAPICH2 version <= 1.4.1
- Please consider updating your MPI if applicable.")
- endif(MPI_TYPE MATCHES "Open MPI|OpenRTE")
- unset(MPI_TYPE)
- endif(MPI_EXEC_RETURN EQUAL 0)
- else(MPI_FOUND)
- message(FATAL_ERROR "MPI support requested, but no MPI compiler found.")
- endif(MPI_FOUND)
- include(gmxTestCatamount)
- gmx_test_catamount(GMX_CRAY_XT3)
- if(GMX_CRAY_XT3)
- set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_CRAY_XT3")
- set(GMX_NO_SYSTEM 1)
- set(GMX_NO_NICE 1)
- endif(GMX_CRAY_XT3)
- set(GMX_LIB_MPI 1)
- set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_LIB_MPI")
-endif(GMX_MPI)
-
+include(gmxManageMPI)
#######################################################################
# Check for options incompatible with OpenMM build #
if(GMX_MPI)
message(FATAL_ERROR "The OpenMM build is not compatible with MPI!")
endif(GMX_MPI)
- if(GMX_THREADS)
- message(STATUS "Threads are not compatible with OpenMM build, disabled!")
- set(GMX_THREADS OFF CACHE BOOL
- "Threads are not compatible with OpenMM build, disabled!" FORCE)
- endif(GMX_THREADS)
+ if(GMX_THREAD_MPI)
+ message(STATUS "Thread-MPI not compatible with OpenMM, disabled!")
+ set(GMX_THREAD_MPI OFF CACHE BOOL
+ "Thread-MPI not compatible with OpenMM build, disabled!" FORCE)
+ endif(GMX_THREAD_MPI)
+ if(GMX_OPENMP)
+ message(STATUS "OpenMP multithreading not compatible with OpenMM, disabled")
+ set(GMX_OPENMP OFF CACHE BOOL
+ "OpenMP multithreading not compatible with OpenMM, disabled!" FORCE)
+ endif()
if(GMX_SOFTWARE_INVSQRT)
set(GMX_SOFTWARE_INVSQRT OFF CACHE STRING
"The OpenMM build does not need GROMACS software 1/sqrt!" FORCE)
endif()
# mark as advanced the unused variables
mark_as_advanced(FORCE GMX_ACCELERATION GMX_MPI GMX_FFT_LIBRARY
- GMX_QMMM_PROGRAM GMX_THREADS GMX_DOUBLE)
+ GMX_QMMM_PROGRAM GMX_THREAD_MPI GMX_DOUBLE)
else(GMX_OPENMM)
mark_as_advanced(CLEAR GMX_ACCELERATION GMX_MPI GMX_FFT_LIBRARY
- GMX_QMMM_PROGRAM GMX_THREADS GMX_DOUBLE)
+ GMX_QMMM_PROGRAM GMX_THREAD_MPI GMX_DOUBLE)
endif(GMX_OPENMM)
endif(X11_FOUND)
endif(GMX_X11)
-if(GMX_THREADS)
- set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_THREADS")
+if(GMX_THREAD_MPI)
+ set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_THREAD_MPI")
include(ThreadMPI)
set(THREAD_MPI_LIB thread_mpi)
set(GMX_MPI 1)
string(TOUPPER ${GMX_FFT_LIBRARY} ${GMX_FFT_LIBRARY})
- if(${GMX_FFT_LIBRARY} STREQUAL "FFTW2")
- message(FATAL_ERROR "FFTW2 can't be used with threads. Try fftw3 or mkl.")
- endif()
-endif(GMX_THREADS)
+endif(GMX_THREAD_MPI)
if(GMX_OPENMM)
set(CUDA_BUILD_EMULATION OFF)
find_package(OpenMM)
endif(GMX_OPENMM)
+if(GMX_OPENMP)
+ find_package(OpenMP REQUIRED)
+ set(GROMACS_C_FLAGS "${OpenMP_C_FLAGS} ${GROMACS_C_FLAGS}")
+ set(GROMACS_CXX_FLAGS "${OpenMP_CXX_FLAGS} ${GROMACS_CXX_FLAGS}")
+ add_definitions(-DGMX_OPENMP)
+endif()
+
if(APPLE)
find_library(ACCELERATE_FRAMEWORK Accelerate)
list(APPEND GMX_EXTRA_LIBRARIES ${ACCELERATE_FRAMEWORK})
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
if(USE_VERSION_H)
# We need at least git v1.5.1 be able to parse git's date output. If not
- # fund or the version is too small, we can't generate version information.
- find_package(Git 1.5.1)
- # this should at some point become VERSION_LESS
- if(NOT Git_FOUND OR Git_VERSION STRLESS "1.5.1")
- message("No compatible git version found, won't be able to generate proper development version information.")
- set(USE_VERSION_H OFF)
+ # found or the version is too small, we can't generate version information.
+ find_package(Git)
+
+ # Find out the git version
+ if(GIT_FOUND AND NOT GIT_VERSION)
+ execute_process(COMMAND ${GIT_EXECUTABLE} "--version"
+ OUTPUT_VARIABLE _exec_out
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ string(REGEX REPLACE "git version (.*)" "\\1" GIT_VERSION ${_exec_out})
+ set(GIT_VERSION ${GIT_VERSION} CACHE STRING "Git version")
+ mark_as_advanced(GIT_VERSION)
+ endif()
+
+ if(NOT GIT_FOUND OR GIT_VERSION VERSION_LESS "1.5.1")
+ message("No compatible git version found, won't be able to generate proper development version information.")
+ set(USE_VERSION_H OFF)
endif()
endif()
else()
set(USE_VERSION_H OFF)
endif()
-if (GMX_DLOPEN)
- list(APPEND GMX_EXTRA_LIBRARIES ${CMAKE_DL_LIBS})
- set(PKG_DL_LIBS "-l${CMAKE_DL_LIBS}")
-else(GMX_DLOPEN)
- set(PKG_DL_LIBS)
-endif (GMX_DLOPEN)
-
########################################################################
# Generate development version info for cache
########################################################################
check_function_exists(fseeko HAVE_FSEEKO)
include(gmxTestSignal)
-gmx_test_retsigtype(RETSIGTYPE)
gmx_test_sigusr1(HAVE_SIGUSR1)
include(gmxTestInline)
set(GMX_SOFTWARE_INVSQRT OFF CACHE BOOL "Do not use software reciprocal square root on BlueGene" FORCE)
set(GMX_POWERPC_INVSQRT ON CACHE BOOL "Use hardware reciprocal square root on BlueGene" FORCE)
set(GMX_X11 OFF CACHE BOOL "X11 not compatible with BlueGene, disabled!" FORCE)
- set(GMX_THREADS OFF CACHE BOOL "Threads not compatible with BlueGene, disabled!" FORCE)
+ set(GMX_THREAD_MPI OFF CACHE BOOL "Thread-MPI not compatible with BlueGene, disabled!" FORCE)
set(GMX_MPI ON CACHE BOOL "Use MPI on BlueGene" FORCE)
elseif(${GMX_ACCELERATION} STREQUAL "POWER6")
set(GMX_POWER6 1)
endif(${GMX_ACCELERATION} STREQUAL "NONE")
if(GMX_FORTRAN OR GMX_POWER6)
- if (GMX_THREADS)
- message(FATAL_ERROR "FORTRAN/POWER6 is incompatible with threads and only provides a speed-up on certain IBM compilers. Disable FORTRAN (or threads if you really want to use FORTRAN kernels).")
- endif(GMX_THREADS)
+ if (GMX_THREAD_MPI)
+ message(FATAL_ERROR "FORTRAN/POWER6 is incompatible with thread-MPI and only provides a speed-up on certain IBM compilers. Disable FORTRAN (or threads if you really want to use FORTRAN kernels).")
+ endif(GMX_THREAD_MPI)
enable_language(Fortran)
include(FortranCInterface)
discover_fortran_mangling(prefix isupper suffix extra_under_score found)
set(PKG_FFT "")
set(PKG_FFT_LIBS "")
if(${GMX_FFT_LIBRARY} STREQUAL "FFTW3")
-# MESSAGE(STATUS "Using external FFT library - fftw3")
if(GMX_DOUBLE)
- find_package(FFTW3 REQUIRED)
- include_directories(${FFTW3_INCLUDE_DIR})
- set(FFT_LIBRARIES ${FFTW3_LIBRARIES})
- set(PKG_FFT "fftw3")
+ find_package(FFTW 3 COMPONENTS fftw)
else(GMX_DOUBLE)
- find_package(FFTW3F REQUIRED)
- include_directories(${FFTW3F_INCLUDE_DIR})
- set(FFT_LIBRARIES ${FFTW3F_LIBRARIES})
- set(PKG_FFT "fftw3f")
+ find_package(FFTW 3 COMPONENTS fftwf)
endif(GMX_DOUBLE)
-
- if(NOT FFTW3_FOUND AND NOT FFTW3F_FOUND)
- MESSAGE(FATAL_ERROR "Cannot find fftw3 (with correct precision). Fix it, choose another FFT library, or use the Gromacs built-in fftpack (slower)!")
- endif(NOT FFTW3_FOUND AND NOT FFTW3F_FOUND)
+ if(NOT FFTW_FOUND)
+ MESSAGE(FATAL_ERROR "Cannot find FFTW3 (with correct precision - libfftw3f for single precision GROMACS or libfftw3 for double precision GROMACS). Fix it, choose another FFT library, or use the Gromacs built-in fftpack (slower)!")
+ endif(NOT FFTW_FOUND)
+ include_directories(${FFTW_INCLUDE_DIRS})
+ set(FFT_LIBRARIES ${FFTW_LIBRARIES})
+ set(PKG_FFT "${FFTW_PKG}")
set(GMX_FFT_FFTW3 1)
-elseif(${GMX_FFT_LIBRARY} STREQUAL "FFTW2")
-# MESSAGE(STATUS "Using external FFT library - fftw2")
- if(GMX_DOUBLE)
- find_package(FFTW2 REQUIRED)
- else(GMX_DOUBLE)
- find_package(FFTW2F REQUIRED)
- endif(GMX_DOUBLE)
-
- if(NOT FFTW2_FOUND)
- MESSAGE(FATAL_ERROR "Cannot find fftw2 (with correct precision). Fix it, choose another FFT library, or use the Gromacs built-in fftpack (slower)!")
- endif(NOT FFTW2_FOUND)
- include_directories(${FFTW2_INCLUDE_DIR})
- set(FFT_LIBRARIES ${FFTW2_LIBRARIES})
- set(PKG_FFT_LIBS ${FFTW2_LIBRARIES})
-
- if("${FFTW2_LIBRARIES}" MATCHES "dfftw")
- set(FFTW2_NAME_DFFTW 1)
- elseif("${FFTW2_LIBRARIES}" MATCHES "sfftw")
- set(FFTW2_NAME_SFFTW 1)
- else("${FFTW2_LIBRARIES}" MATCHES "dfftw")
- set(FFTW2_NAME_FFTW 1)
- endif("${FFTW2_LIBRARIES}" MATCHES "dfftw")
-
- set(GMX_FFT_FFTW2 1)
elseif(${GMX_FFT_LIBRARY} STREQUAL "MKL")
# MESSAGE(STATUS "Using external FFT library - Intel MKL")
find_package(MKL REQUIRED)
MESSAGE(STATUS "Using internal FFT library - fftpack")
set(GMX_FFT_FFTPACK 1)
else(${GMX_FFT_LIBRARY} STREQUAL "FFTW3")
- MESSAGE(FATAL_ERROR "Invalid FFT library setting: ${GMX_FFT_LIBRARY}. Choose one of: fftw3, fftw2, mkl, acml, fftpack")
+ MESSAGE(FATAL_ERROR "Invalid FFT library setting: ${GMX_FFT_LIBRARY}. Choose one of: fftw3, mkl, fftpack")
endif(${GMX_FFT_LIBRARY} STREQUAL "FFTW3")
# MKL has BLAS/LAPACK routines
mark_as_advanced(GMX_EXTERNAL_LAPACK)
mark_as_advanced(GMX_EXTERNAL_BLAS)
+set(GMX_USE_PLUGINS OFF CACHE INTERNAL "Whether GROMACS will really try to compile support for VMD plugins")
+set(GMX_VMD_PLUGIN_PATH)
+mark_as_advanced(GMX_VMD_PLUGIN_PATH)
+
+if(GMX_LOAD_PLUGINS)
+ if(CYGWIN OR NOT WIN32)
+ # Native Windows does not have, nor need dlopen
+ # Note that WIN32 is set with Cygwin, but Cygwin needs dlopen to use plug-ins
+ include(gmxTestdlopen)
+ gmx_test_dlopen(HAVE_DLOPEN)
+ endif()
+
+ find_package(VMD)
+
+ # Test for unsuitable versions of VMD
+
+ if(VMD_FOUND AND NOT GMX_VMD_PLUGIN_PATH)
+ message(STATUS "Checking for suitable VMD version")
+ exec_program(${VMD_EXECUTABLE}
+ ARGS --help
+ OUTPUT_VARIABLE VMD_HELP
+ RETURN_VALUE VMD_EXEC_RETURN)
+
+ if(VMD_EXEC_RETURN EQUAL 0)
+ # This is the accepted idiom for subexpression matching, unfortunately
+ string(REGEX REPLACE ".*VMD for .*, version ([0-9]+\\.[0-9]*\\.?[0-9]*).*" "\\1" VMD_VERSION ${VMD_HELP})
+ string(REGEX REPLACE ".*VMD for (.*), version .*" "\\1" VMD_ARCH ${VMD_HELP})
+
+ if(VMD_VERSION VERSION_LESS "1.8")
+ MESSAGE(WARNING "Found VMD version ${VMD_VERSION}, but GROMACS needs at least 1.8")
+ unset(VMD_EXECUTABLE)
+ set(VMD_FOUND FALSE)
+ else()
+ message(STATUS "VMD version ${VMD_VERSION} is suitable")
+ if(DEFINED ENV{VMDDIR})
+ # This permits GROMACS to avoid hard-coding a fall-back
+ # path that it can tell right now would be useless.
+ set(GMX_VMD_PLUGIN_PATH "$ENV{VMDDIR}/plugins/${VMD_ARCH}/molfile" CACHE PATH "Path to VMD plugins for molfile I/O")
+ else()
+ set(GMX_VMD_PLUGIN_PATH "/usr/local/lib/vmd/plugins/*/molfile" CACHE PATH "Path to VMD plugins for molfile I/O")
+ endif()
+ endif()
+
+ # clean up
+ unset(VMD_HELP)
+ unset(VMD_VERSION)
+ unset(VMD_ARCH)
+ endif()
+ endif()
+
+ # so, should we use plug-ins?
+ if((WIN32 AND NOT CYGWIN) OR (HAVE_DLOPEN AND BUILD_SHARED_LIBS))
+ if (NOT VMD_QUIETLY)
+ MESSAGE(STATUS "Found the ability to use plug-ins when building shared libaries, so will compile to use plug-ins (e.g. to read VMD-supported file formats).")
+ endif(NOT VMD_QUIETLY)
+ set(GMX_USE_PLUGINS ON)
+ list(APPEND GMX_EXTRA_LIBRARIES ${CMAKE_DL_LIBS}) # magic cross-platform pre-set variable for dlopen library
+ set(PKG_DL_LIBS "-l${CMAKE_DL_LIBS}")
+ else()
+ set(PKG_DL_LIBS)
+ endif()
+endif(GMX_LOAD_PLUGINS)
+set(VMD_QUIETLY TRUE CACHE INTERNAL "")
+
# Math and thread libraries must often come after all others when linking...
if(HAVE_LIBM)
list(APPEND GMX_EXTRA_LIBRARIES m)
--- /dev/null
+SET(CTEST_PROJECT_NAME "Gromacs")
+SET(CTEST_NIGHTLY_START_TIME "00:00:00 EST")
+
+IF(NOT DEFINED CTEST_DROP_METHOD)
+ SET(CTEST_DROP_METHOD "http")
+ENDIF(NOT DEFINED CTEST_DROP_METHOD)
+
+IF(CTEST_DROP_METHOD STREQUAL "http")
+ SET(CTEST_DROP_SITE "cdash.gromacs.org")
+ SET(CTEST_DROP_LOCATION "/submit.php?project=Gromacs")
+ SET(CTEST_DROP_SITE_CDASH TRUE)
+ENDIF(CTEST_DROP_METHOD STREQUAL "http")
+
+++ /dev/null
-# Doxyfile 1.5.8
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
-
-#---------------------------------------------------------------------------
-# Project related configuration options
-#---------------------------------------------------------------------------
-
-# This tag specifies the encoding used for all characters in the config file
-# that follow. The default is UTF-8 which is also the encoding used for all
-# text before the first occurrence of this tag. Doxygen uses libiconv (or the
-# iconv built into libc) for the transcoding. See
-# http://www.gnu.org/software/libiconv for the list of possible encodings.
-
-DOXYFILE_ENCODING = UTF-8
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
-PROJECT_NAME = @PACKAGE_NAME@
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
-PROJECT_NUMBER = @PACKAGE_VERSION@
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
-OUTPUT_DIRECTORY = doxygen-doc
-
-# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
-# 4096 sub-directories (in 2 levels) under the output directory of each output
-# format and will distribute the generated files over these directories.
-# Enabling this option can be useful when feeding doxygen a huge amount of
-# source files, where putting all generated files in the same directory would
-# otherwise cause performance problems for the file system.
-
-CREATE_SUBDIRS = NO
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
-# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek,
-# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages),
-# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish,
-# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene,
-# Spanish, Swedish, and Ukrainian.
-
-OUTPUT_LANGUAGE = English
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
-BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
-REPEAT_BRIEF = YES
-
-# This tag implements a quasi-intelligent brief description abbreviator
-# that is used to form the text in various listings. Each string
-# in this list, if found as the leading text of the brief description, will be
-# stripped from the text and the result after processing the whole list, is
-# used as the annotated text. Otherwise, the brief description is used as-is.
-# If left blank, the following values are used ("$name" is automatically
-# replaced with the name of the entity): "The $name class" "The $name widget"
-# "The $name file" "is" "provides" "specifies" "contains"
-# "represents" "a" "an" "the"
-
-ABBREVIATE_BRIEF =
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
-ALWAYS_DETAILED_SEC = YES
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
-# inherited members of a class in the documentation of that class as if those
-# members were ordinary class members. Constructors, destructors and assignment
-# operators of the base classes will not be shown.
-
-INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
-FULL_PATH_NAMES = YES
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user-defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. The tag can be used to show relative paths in the file list.
-# If left blank the directory from which doxygen is run is used as the
-# path to strip.
-
-STRIP_FROM_PATH = @top_srcdir@
-
-# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
-# the path mentioned in the documentation of a class, which tells
-# the reader which header file to include in order to use a class.
-# If left blank only the name of the header file containing the class
-# definition is used. Otherwise one should specify the include paths that
-# are normally passed to the compiler using the -I flag.
-
-STRIP_FROM_INC_PATH =
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
-SHORT_NAMES = NO
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like regular Qt-style comments
-# (thus requiring an explicit @brief command for a brief description.)
-
-JAVADOC_AUTOBRIEF = YES
-
-# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
-# interpret the first line (until the first dot) of a Qt-style
-# comment as the brief description. If set to NO, the comments
-# will behave just like regular Qt-style comments (thus requiring
-# an explicit \brief command for a brief description.)
-
-QT_AUTOBRIEF = NO
-
-# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
-# treat a multi-line C++ special comment block (i.e. a block of //! or ///
-# comments) as a brief description. This used to be the default behaviour.
-# The new default is to treat a multi-line C++ comment block as a detailed
-# description. Set this tag to YES if you prefer the old behaviour instead.
-
-MULTILINE_CPP_IS_BRIEF = NO
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# re-implements.
-
-INHERIT_DOCS = YES
-
-# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
-# a new page for each member. If set to NO, the documentation of a member will
-# be part of the file/class/namespace that contains it.
-
-SEPARATE_MEMBER_PAGES = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 8
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user-defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
-ALIASES =
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
-# sources only. Doxygen will then generate output that is more tailored for C.
-# For instance, some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
-OPTIMIZE_OUTPUT_FOR_C = YES
-
-# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
-# sources only. Doxygen will then generate output that is more tailored for
-# Java. For instance, namespaces will be presented as packages, qualified
-# scopes will look different, etc.
-
-OPTIMIZE_OUTPUT_JAVA = NO
-
-# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
-# sources only. Doxygen will then generate output that is more tailored for
-# Fortran.
-
-OPTIMIZE_FOR_FORTRAN = NO
-
-# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
-# sources. Doxygen will then generate output that is tailored for
-# VHDL.
-
-OPTIMIZE_OUTPUT_VHDL = NO
-
-# Doxygen selects the parser to use depending on the extension of the files it parses.
-# With this tag you can assign which parser to use for a given extension.
-# Doxygen has a built-in mapping, but you can override or extend it using this tag.
-# The format is ext=language, where ext is a file extension, and language is one of
-# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
-# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
-# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
-# use: inc=Fortran f=C
-
-EXTENSION_MAPPING =
-
-# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
-# to include (a tag file for) the STL sources as input, then you should
-# set this tag to YES in order to let doxygen match functions declarations and
-# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
-# func(std::string) {}). This also make the inheritance and collaboration
-# diagrams that involve STL classes more complete and accurate.
-
-BUILTIN_STL_SUPPORT = NO
-
-# If you use Microsoft's C++/CLI language, you should set this option to YES to
-# enable parsing support.
-
-CPP_CLI_SUPPORT = NO
-
-# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
-# Doxygen will parse them like normal C++ but will assume all classes use public
-# instead of private inheritance when no explicit protection keyword is present.
-
-SIP_SUPPORT = NO
-
-# For Microsoft's IDL there are propget and propput attributes to indicate getter
-# and setter methods for a property. Setting this option to YES (the default)
-# will make doxygen to replace the get and set methods by a property in the
-# documentation. This will only work if the methods are indeed getting or
-# setting a simple type. If this is not the case, or you want to show the
-# methods anyway, you should set this option to NO.
-
-IDL_PROPERTY_SUPPORT = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
-DISTRIBUTE_GROUP_DOC = NO
-
-# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
-# the same type (for instance a group of public functions) to be put as a
-# subgroup of that type (e.g. under the Public Functions section). Set it to
-# NO to prevent subgrouping. Alternatively, this can be done per class using
-# the \nosubgrouping command.
-
-SUBGROUPING = YES
-
-# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
-# is documented as struct, union, or enum with the name of the typedef. So
-# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
-# with name TypeT. When disabled the typedef will appear as a member of a file,
-# namespace, or class. And the struct will be named TypeS. This can typically
-# be useful for C code in case the coding convention dictates that all compound
-# types are typedef'ed and only the typedef is referenced, never the tag name.
-
-TYPEDEF_HIDES_STRUCT = NO
-
-# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
-# determine which symbols to keep in memory and which to flush to disk.
-# When the cache is full, less often used symbols will be written to disk.
-# For small to medium size projects (<1000 input files) the default value is
-# probably good enough. For larger projects a too small cache size can cause
-# doxygen to be busy swapping symbols to and from disk most of the time
-# causing a significant performance penality.
-# If the system has enough physical memory increasing the cache will improve the
-# performance by keeping more symbols in memory. Note that the value works on
-# a logarithmic scale so increasing the size by one will rougly double the
-# memory usage. The cache size is given by this formula:
-# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
-# corresponding to a cache size of 2^16 = 65536 symbols
-
-SYMBOL_CACHE_SIZE = 0
-
-#---------------------------------------------------------------------------
-# Build related configuration options
-#---------------------------------------------------------------------------
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
-EXTRACT_ALL = NO
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
-EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
-EXTRACT_STATIC = YES
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
-EXTRACT_LOCAL_CLASSES = YES
-
-# This flag is only useful for Objective-C code. When set to YES local
-# methods, which are defined in the implementation section but not in
-# the interface are included in the documentation.
-# If set to NO (the default) only methods in the interface are included.
-
-EXTRACT_LOCAL_METHODS = NO
-
-# If this flag is set to YES, the members of anonymous namespaces will be
-# extracted and appear in the documentation as a namespace called
-# 'anonymous_namespace{file}', where file will be replaced with the base
-# name of the file that contains the anonymous namespace. By default
-# anonymous namespace are hidden.
-
-EXTRACT_ANON_NSPACES = NO
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these classes will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
-HIDE_UNDOC_CLASSES = NO
-
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
-# friend (class|struct|union) declarations.
-# If set to NO (the default) these declarations will be included in the
-# documentation.
-
-HIDE_FRIEND_COMPOUNDS = NO
-
-# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
-# documentation blocks found inside the body of a function.
-# If set to NO (the default) these blocks will be appended to the
-# function's detailed documentation block.
-
-HIDE_IN_BODY_DOCS = NO
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
-INTERNAL_DOCS = YES
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower-case letters. If set to YES upper-case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# and Mac users are advised to set this option to NO.
-
-CASE_SENSE_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
-HIDE_SCOPE_NAMES = NO
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put a list of the files that are included by a file in the documentation
-# of that file.
-
-SHOW_INCLUDE_FILES = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
-INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
-SORT_MEMBER_DOCS = YES
-
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
-# brief documentation of file, namespace and class members alphabetically
-# by member name. If set to NO (the default) the members will appear in
-# declaration order.
-
-SORT_BRIEF_DOCS = NO
-
-# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
-# hierarchy of group names into alphabetical order. If set to NO (the default)
-# the group names will appear in their defined order.
-
-SORT_GROUP_NAMES = NO
-
-# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
-# sorted by fully-qualified names, including namespaces. If set to
-# NO (the default), the class list will be sorted only by class name,
-# not including the namespace part.
-# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
-# Note: This option applies only to the class list, not to the
-# alphabetical list.
-
-SORT_BY_SCOPE_NAME = NO
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
-GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
-GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
-GENERATE_BUGLIST = YES
-
-# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
-# disable (NO) the deprecated list. This list is created by putting
-# \deprecated commands in the documentation.
-
-GENERATE_DEPRECATEDLIST= YES
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
-ENABLED_SECTIONS =
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consists of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
-MAX_INITIALIZER_LINES = 30
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
-SHOW_USED_FILES = YES
-
-# If the sources in your project are distributed over multiple directories
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES = YES
-
-# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
-# This will remove the Files entry from the Quick Index and from the
-# Folder Tree View (if specified). The default is YES.
-
-SHOW_FILES = YES
-
-# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
-# Namespaces page. This will remove the Namespaces entry from the Quick Index
-# and from the Folder Tree View (if specified). The default is YES.
-
-SHOW_NAMESPACES = YES
-
-# The FILE_VERSION_FILTER tag can be used to specify a program or script that
-# doxygen should invoke to get the current version for each file (typically from
-# the version control system). Doxygen will invoke the program by executing (via
-# popen()) the command <command> <input-file>, where <command> is the value of
-# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
-# provided by doxygen. Whatever the program writes to standard output
-# is used as the file version. See the manual for examples.
-
-FILE_VERSION_FILTER =
-
-# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
-# doxygen. The layout file controls the global structure of the generated output files
-# in an output format independent way. The create the layout file that represents
-# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
-# file name after the option, if omitted DoxygenLayout.xml will be used as the name
-# of the layout file.
-
-LAYOUT_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to warning and progress messages
-#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
-QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
-WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
-WARN_IF_UNDOCUMENTED = NO
-
-# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
-# potential errors in the documentation, such as not documenting some
-# parameters in a documented function, or documenting parameters that
-# don't exist or using markup commands wrongly.
-
-WARN_IF_DOC_ERROR = YES
-
-# This WARN_NO_PARAMDOC option can be abled to get warnings for
-# functions that are documented, but have no documentation for their parameters
-# or return value. If set to NO (the default) doxygen will only warn about
-# wrong or incomplete parameter documentation, but not about the absence of
-# documentation.
-
-WARN_NO_PARAMDOC = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text. Optionally the format may contain
-# $version, which will be replaced by the version of the file (if it could
-# be obtained via FILE_VERSION_FILTER)
-
-WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
-WARN_LOGFILE = doxygen-doc/doxygen.log
-
-#---------------------------------------------------------------------------
-# configuration options related to the input files
-#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
-INPUT = @top_srcdir@/include \
- @top_srcdir@/src \
- @top_srcdir@/share/template
-
-# This tag can be used to specify the character encoding of the source files
-# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
-# also the default input encoding. Doxygen uses libiconv (or the iconv built
-# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
-# the list of possible encodings.
-
-INPUT_ENCODING = UTF-8
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
-# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-
-FILE_PATTERNS = *.c \
- *.h
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
-RECURSIVE = YES
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
-EXCLUDE = .git
-
-# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
-# directories that are symbolic links (a Unix filesystem feature) are excluded
-# from the input.
-
-EXCLUDE_SYMLINKS = NO
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories. Note that the wildcards are matched
-# against the file with absolute path, so to exclude all test directories
-# for example use the pattern */test/*
-
-EXCLUDE_PATTERNS =
-
-# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
-# (namespaces, classes, functions, etc.) that should be excluded from the
-# output. The symbol name can be a fully qualified name, a word, or if the
-# wildcard * is used, a substring. Examples: ANamespace, AClass,
-# AClass::ANamespace, ANamespace::*Test
-
-EXCLUDE_SYMBOLS = YY* yy* _gmx_sel_yy*
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
-EXAMPLE_PATH = @top_srcdir@
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
-EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
-EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
-IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command <filter> <input-file>, where <filter>
-# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output. If FILTER_PATTERNS is specified, this tag will be
-# ignored.
-
-INPUT_FILTER =
-
-# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
-# basis. Doxygen will compare the file name with each pattern and apply the
-# filter if there is a match. The filters are a list of the form:
-# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
-# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
-# is applied to all files.
-
-FILTER_PATTERNS =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse (i.e. when SOURCE_BROWSER is set to YES).
-
-FILTER_SOURCE_FILES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to source browsing
-#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-# Note: To get rid of all source code in the generated output, make sure also
-# VERBATIM_HEADERS is set to NO.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
-INLINE_SOURCES = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the REFERENCED_BY_RELATION tag is set to YES
-# then for each documented function all documented
-# functions referencing it will be listed.
-
-REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
-REFERENCES_RELATION = YES
-
-# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
-# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
-# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
-# link to the source code. Otherwise they will link to the documentation.
-
-REFERENCES_LINK_SOURCE = YES
-
-# If the USE_HTAGS tag is set to YES then the references to source code
-# will point to the HTML generated by the htags(1) tool instead of doxygen
-# built-in source browser. The htags tool is part of GNU's global source
-# tagging system (see http://www.gnu.org/software/global/global.html). You
-# will need version 4.8.6 or higher.
-
-USE_HTAGS = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-#---------------------------------------------------------------------------
-# configuration options related to the alphabetical class index
-#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
-ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
-COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
-#---------------------------------------------------------------------------
-# configuration options related to the HTML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
-GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
-HTML_OUTPUT = html
-
-# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
-# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
-# doxygen will generate files with .html extension.
-
-HTML_FILE_EXTENSION = .html
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
-HTML_HEADER =
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
-HTML_FOOTER =
-
-# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet. Note that doxygen will try to copy
-# the style sheet file to the HTML output directory, so don't put your own
-# stylesheet in the HTML output directory as well, or it will be erased!
-
-HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS = YES
-
-# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
-# documentation will contain sections that can be hidden and shown after the
-# page has loaded. For this to work a browser that supports
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
-
-HTML_DYNAMIC_SECTIONS = YES
-
-# If the GENERATE_DOCSET tag is set to YES, additional index files
-# will be generated that can be used as input for Apple's Xcode 3
-# integrated development environment, introduced with OSX 10.5 (Leopard).
-# To create a documentation set, doxygen will generate a Makefile in the
-# HTML output directory. Running make will produce the docset in that
-# directory and running "make install" will install the docset in
-# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
-# it at startup.
-# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
-
-GENERATE_DOCSET = NO
-
-# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
-# feed. A documentation feed provides an umbrella under which multiple
-# documentation sets from a single provider (such as a company or product suite)
-# can be grouped.
-
-DOCSET_FEEDNAME = "Doxygen generated docs"
-
-# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
-# should uniquely identify the documentation set bundle. This should be a
-# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
-# will append .docset to the name.
-
-DOCSET_BUNDLE_ID = org.gromacs
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
-# of the generated HTML documentation.
-
-GENERATE_HTMLHELP = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
-# be used to specify the file name of the resulting .chm file. You
-# can add a path in front of the file if the result should not be
-# written to the html output directory.
-
-CHM_FILE =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
-# be used to specify the location (absolute path including file name) of
-# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
-# the HTML help compiler on the generated index.hhp.
-
-HHC_LOCATION =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
-GENERATE_CHI = NO
-
-# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
-# is used to encode HtmlHelp index (hhk), content (hhc) and project file
-# content.
-
-CHM_INDEX_ENCODING =
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
-BINARY_TOC = NO
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the HTML help documentation and to the tree view.
-
-TOC_EXPAND = NO
-
-# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
-# are set, an additional index file will be generated that can be used as input for
-# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
-# HTML documentation.
-
-GENERATE_QHP = NO
-
-# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
-# be used to specify the file name of the resulting .qch file.
-# The path specified is relative to the HTML output folder.
-
-QCH_FILE =
-
-# The QHP_NAMESPACE tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#namespace
-
-QHP_NAMESPACE =
-
-# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
-# Qt Help Project output. For more information please see
-# http://doc.trolltech.com/qthelpproject.html#virtual-folders
-
-QHP_VIRTUAL_FOLDER = doc
-
-# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
-# For more information please see
-# http://doc.trolltech.com/qthelpproject.html#custom-filters
-
-QHP_CUST_FILTER_NAME =
-
-# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
-# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">Qt Help Project / Custom Filters</a>.
-
-QHP_CUST_FILTER_ATTRS =
-
-# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
-# filter section matches.
-# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">Qt Help Project / Filter Attributes</a>.
-
-QHP_SECT_FILTER_ATTRS =
-
-# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
-# be used to specify the location of Qt's qhelpgenerator.
-# If non-empty doxygen will try to run qhelpgenerator on the generated
-# .qhp file.
-
-QHG_LOCATION =
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
-DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
-ENUM_VALUES_PER_LINE = 15
-
-# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
-# structure should be generated to display hierarchical information.
-# If the tag value is set to FRAME, a side panel will be generated
-# containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
-# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
-# probably better off using the HTML help feature. Other possible values
-# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
-# and Class Hierarchy pages using a tree view instead of an ordered list;
-# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
-# disables this behavior completely. For backwards compatibility with previous
-# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
-# respectively.
-
-GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
-TREEVIEW_WIDTH = 250
-
-# Use this tag to change the font size of Latex formulas included
-# as images in the HTML documentation. The default is 10. Note that
-# when you change the font size after a successful doxygen run you need
-# to manually remove any form_*.png images from the HTML output directory
-# to force them to be regenerated.
-
-FORMULA_FONTSIZE = 10
-
-#---------------------------------------------------------------------------
-# configuration options related to the LaTeX output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
-GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
-LATEX_OUTPUT = latex
-
-# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
-# invoked. If left blank `latex' will be used as the default command name.
-
-LATEX_CMD_NAME = latex
-
-# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
-# generate index for LaTeX. If left blank `makeindex' will be used as the
-# default command name.
-
-MAKEINDEX_CMD_NAME = makeindex
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
-PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
-EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
-LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
-PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
-USE_PDFLATEX = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
-LATEX_BATCHMODE = NO
-
-# If LATEX_HIDE_INDICES is set to YES then doxygen will not
-# include the index chapters (such as File Index, Compound Index, etc.)
-# in the output.
-
-LATEX_HIDE_INDICES = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the RTF output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimized for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
-GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
-RTF_OUTPUT = rtf
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
-COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
-RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assignments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
-RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
-RTF_EXTENSIONS_FILE =
-
-#---------------------------------------------------------------------------
-# configuration options related to the man page output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
-GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
-MAN_OUTPUT = man
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
-MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
-MAN_LINKS = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the XML output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation.
-
-GENERATE_XML = NO
-
-# The XML_OUTPUT tag is used to specify where the XML pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `xml' will be used as the default path.
-
-XML_OUTPUT = xml
-
-# The XML_SCHEMA tag can be used to specify an XML schema,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_SCHEMA =
-
-# The XML_DTD tag can be used to specify an XML DTD,
-# which can be used by a validating XML parser to check the
-# syntax of the XML files.
-
-XML_DTD =
-
-# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
-# dump the program listings (including syntax highlighting
-# and cross-referencing information) to the XML output. Note that
-# enabling this will significantly increase the size of the XML output.
-
-XML_PROGRAMLISTING = YES
-
-#---------------------------------------------------------------------------
-# configuration options for the AutoGen Definitions output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
-GENERATE_AUTOGEN_DEF = NO
-
-#---------------------------------------------------------------------------
-# configuration options related to the Perl module output
-#---------------------------------------------------------------------------
-
-# If the GENERATE_PERLMOD tag is set to YES Doxygen will
-# generate a Perl module file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
-GENERATE_PERLMOD = NO
-
-# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
-# the necessary Makefile rules, Perl scripts and LaTeX code to be able
-# to generate PDF and DVI output from the Perl module output.
-
-PERLMOD_LATEX = NO
-
-# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
-# nicely formatted so it can be parsed by a human reader. This is useful
-# if you want to understand what is going on. On the other hand, if this
-# tag is set to NO the size of the Perl module output will be much smaller
-# and Perl will parse it just the same.
-
-PERLMOD_PRETTY = YES
-
-# The names of the make variables in the generated doxyrules.make file
-# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
-# This is useful so different doxyrules.make files included by the same
-# Makefile don't overwrite each other's variables.
-
-PERLMOD_MAKEVAR_PREFIX =
-
-#---------------------------------------------------------------------------
-# Configuration options related to the preprocessor
-#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
-ENABLE_PREPROCESSING = YES
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
-MACRO_EXPANSION = YES
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_DEFINED tags.
-
-EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
-SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
-INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
-INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed. To prevent a macro definition from being
-# undefined via #undef or recursively expanded use the := operator
-# instead of the = operator.
-
-PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
-EXPAND_AS_DEFINED = F77_FUNC \
- YY_DECL
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line, have an all uppercase name, and do not end with a semicolon. Such
-# function macros are typically used for boiler-plate code, and will confuse
-# the parser if not removed.
-
-SKIP_FUNCTION_MACROS = YES
-
-#---------------------------------------------------------------------------
-# Configuration::additions related to external references
-#---------------------------------------------------------------------------
-
-# The TAGFILES option can be used to specify one or more tagfiles.
-# Optionally an initial location of the external documentation
-# can be added for each tagfile. The format of a tag file without
-# this location is as follows:
-# TAGFILES = file1 file2 ...
-# Adding location for the tag files is done as follows:
-# TAGFILES = file1=loc1 "file2 = loc2" ...
-# where "loc1" and "loc2" can be relative or absolute paths or
-# URLs. If a location is present for each tag, the installdox tool
-# does not have to be run to correct the links.
-# Note that each tag file must have a unique name
-# (where the name does NOT include the path)
-# If a tag file is not located in the directory in which doxygen
-# is run, you must also specify the path to the tagfile here.
-
-TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
-GENERATE_TAGFILE =
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
-ALLEXTERNALS = NO
-
-# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
-# in the modules index. If set to NO, only the current project's groups will
-# be listed.
-
-EXTERNAL_GROUPS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
-PERL_PATH = /usr/bin/perl
-
-#---------------------------------------------------------------------------
-# Configuration options related to the dot tool
-#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
-# or super classes. Setting the tag to NO turns the diagrams off. Note that
-# this option is superseded by the HAVE_DOT option below. This is only a
-# fallback. It is recommended to install and use dot, since it yields more
-# powerful graphs.
-
-CLASS_DIAGRAMS = YES
-
-# You can define message sequence charts within doxygen comments using the \msc
-# command. Doxygen will then run the mscgen tool (see
-# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
-# documentation. The MSCGEN_PATH tag allows you to specify the directory where
-# the mscgen tool resides. If left empty the tool is assumed to be found in the
-# default search path.
-
-MSCGEN_PATH =
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
-HIDE_UNDOC_RELATIONS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# By default doxygen will write a font called FreeSans.ttf to the output
-# directory and reference it in all dot files that doxygen generates. This
-# font does not include all possible unicode characters however, so when you need
-# these (or just want a differently looking font) you can specify the font name
-# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
-# which can be done by putting it in a standard location or by setting the
-# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
-# containing the font.
-
-DOT_FONTNAME = FreeSans
-
-# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
-# The default size is 10pt.
-
-DOT_FONTSIZE = 10
-
-# By default doxygen will tell dot to use the output directory to look for the
-# FreeSans.ttf font (which doxygen will put there itself). If you specify a
-# different font using DOT_FONTNAME you can set the path where dot
-# can find it using this tag.
-
-DOT_FONTPATH =
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for groups, showing the direct groups dependencies
-
-GROUP_GRAPHS = YES
-
-# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
-# collaboration diagrams in a style similar to the OMG's Unified Modeling
-# Language.
-
-UML_LOOK = NO
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = NO
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
-INCLUDED_BY_GRAPH = YES
-
-# If the CALL_GRAPH and HAVE_DOT options are set to YES then
-# doxygen will generate a call dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable call graphs
-# for selected functions only using the \callgraph command.
-
-CALL_GRAPH = NO
-
-# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
-# doxygen will generate a caller dependency graph for every global function
-# or class method. Note that enabling this option will significantly increase
-# the time of a run. So in most cases it will be better to enable caller
-# graphs for selected functions only using the \callergraph command.
-
-CALLER_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
-GRAPHICAL_HIERARCHY = YES
-
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
-# then doxygen will show the dependencies a directory has on other directories
-# in a graphical way. The dependency relations are determined by the #include
-# relations between the files in the directories.
-
-DIRECTORY_GRAPH = YES
-
-# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
-# generated by dot. Possible values are png, jpg, or gif
-# If left blank png will be used.
-
-DOT_IMAGE_FORMAT = png
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found in the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
-DOTFILE_DIRS =
-
-# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
-# nodes that will be shown in the graph. If the number of nodes in a graph
-# becomes larger than this value, doxygen will truncate the graph, which is
-# visualized by representing a node as a red box. Note that doxygen if the
-# number of direct children of the root node in a graph is already larger than
-# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
-# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
-
-DOT_GRAPH_MAX_NODES = 50
-
-# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
-# graphs generated by dot. A depth value of 3 means that only nodes reachable
-# from the root by following a path via at most 3 edges will be shown. Nodes
-# that lay further from the root node will be omitted. Note that setting this
-# option to 1 or 2 may greatly reduce the computation time needed for large
-# code bases. Also note that the size of a graph can be further restricted by
-# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
-
-MAX_DOT_GRAPH_DEPTH = 0
-
-# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
-# background. This is disabled by default, because dot on Windows does not
-# seem to support this out of the box. Warning: Depending on the platform used,
-# enabling this option may lead to badly anti-aliased labels on the edges of
-# a graph (i.e. they become hard to read).
-
-DOT_TRANSPARENT = NO
-
-# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
-# files in one run (i.e. multiple -o and -T options on the command line). This
-# makes dot run faster, but since only newer versions of dot (>1.8.10)
-# support this, this feature is disabled by default.
-
-DOT_MULTI_TARGETS = NO
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
-GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermediate dot files that are used to generate
-# the various graphs.
-
-DOT_CLEANUP = YES
-
-#---------------------------------------------------------------------------
-# Options related to the search engine
-#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
-SEARCHENGINE = NO
+++ /dev/null
-
- Welcome to GROMACS!
-
-*Note*: Detailed, step-by-step installation instructions
-are available on the website
-http://www.gromacs.org/Downloads/Installation_Instructions.
-
-*Note*: If you want to use CMake for building look at INSTALL.cmake.
-
-
-
-You will probably have to download and install FFTW the first
-time you install GROMACS - our configuration script will check it!
-
-
-* SHORT INSTRUCTIONS FOR THE IMPATIENT:
-
-GROMACS uses a standard autoconf script and makefiles created
-by automake, like most GNU programs. This means your normal
-installation actions are limited to:
-
-./configure
-make
-make install
-
-That's it! Most compiler flags and required libraries are checked
-automatically by configure, and it will tell you if something is
-missing. The default installation location is /usr/local/gromacs
-(change it with --prefix).
-
-
-
-* INSTALLING FFTW:
-
-The FFTW library has been removed from the distribution since it
-is not part of our package, but it is very easy to install separately
-if it is not already present. Download the source code from
-http://www.fftw.org , or get it from http://www.gromacs.org .
-
-Read the FFTW installation instructions for details. In short, to
-install the single precision library under /usr/local type
-
-./configure --enable-float
-
-and then type
-
-make
-make install
-
-Note that in contrast to GROMACS, FFTW defaults to double. Even
-if you don't think you'll need it's a good idea to install the
-double precision libraries too, once and for all. Clean your
-build by issuing
-
-make distclean
-
-and then type
-
-./configure --enable-type-prefix
-make
-make install
-
-Your double precision FFTW files will have a "d" prefix.
-
-(It is possible to compile a crippled GROMACS without FFTW, but we
-strongly discourage it - check the configure options for details)
-
-
-
-* FFTW OR OTHER LIBRARIES IN NON-STANDARD LOCATIONS:
-
-If you install FFTW in your homedirectory or some other place where
-it isn't found automatically (not all systems search /usr/local)
-by the compiler you should set the environment variables before
-executing configure. Assume we configured and installed FFTW with
---prefix=/home/erik/fftw. If your shell is tcsh, you set
-
-setenv CPPFLAGS -I/home/erik/fftw/include
-setenv LDFLAGS -L/home/erik/fftw/lib
-
-or, if you are using a bash shell:
-
-export CPPFLAGS=-I/home/erik/fftw/include
-export LDFLAGS=-L/home/erik/fftw/lib
-
-...and then you run the Gromacs configure script. Similarly, if you
-don't like the compilers configure selects, just set them with
-the variables CC and/or F77 (MPICC for an MPI compiler).
-
-Don't use LDFLAGS to add extra libraries! Put them in LIBS instead, e.g.
-
-setenv LIBS "-lstuff" to add libstuff at the linking stage.
-
-
-Once installed, you can link the Gromacs executables to e.g.
-/usr/local/bin if you want all users to have them in their path.
-
-
-
-* SPECIAL OPTIONS; FORTRAN, ASSEMBLY AND PARALLEL GROMACS WITH MPI:
-
-Typing ./configure --help will give you some options like compiling
-for parallel runs using MPI. Not all architecture use the fast
-fortran loops per default, so if you know you have a fast fortan
-compiler you should check that option. It won't have much effect
-for modern x86 boxes though, since these use assembly innerloops.
-
-To compile the assembly loops you need a reasonably recent version
-of binutils. The configuration script checks it - pick up a later
-version at www.gromacs.org if yours is too old. Don't disable
-the assembly loops unless you absolutely have to...
-
-
-For instance, if you want to compile only the mdrun executable
-with parallel MPI support:
-
-make clean
-./configure --enable-mpi
-make mdrun
-make install-mdrun
-
-If you want to keep your non-mpi mdrun instead of overwriting
-it, you can append a suffix with --program-suffix="_mpi":
-If you only want to create the MPI version of the entire package
-you can just issue the normal make commands. The mdrun-only
-installation can also be useful to have e.g. a general version
-of gromacs for analysis in the main binary directory, and then
-subdirectories with only an optimized mdrun for each cpu.
-
-You can find more installation information on the GROMACS homepage
-if you have any problems, and don't hesitate to contact us if you
-find any bugs in the configuration. The architecture names have
-been expanded and are almost identical to the GNU ones, but where
-it is possible we have added an extra level with more detailed
-processor specifications to enable higher optimization. If you
-have a very heterogeneous environment it might be a good idea
-to compile a full non-optimized version in the main directory,
-and then just optimized versions of mdrun in the processor
-subdirectories!
-
-
-
-* VPATH BUILDS:
-
-If you want to do development on several architectures, you should
-use a version of make that support VPATH (we suggest GNU make)
-and create a new directory to contain the object files for this
-architecture (e.g. i686-pc-linux-gnu/obj). Then run configure from this
-new directory (../../configure) - you might have to make distclean first.
-This way you keep all your object files (speeds up compiles) and
-change architecture by switching to a different object directory.
-
-
-
-* ARE YOU STILL HAVING PROBLEMS?
-
-Post it to the GROMACS mailing lists. We read these on a regular basis,
-and in many cases another user might already be familiar with the
-task you're trying to perform!
-
-
-
- Good luck compiling and running!
-
- THE GROMACS CREW
-
- gromacs@gromacs.org
-
-
-
----------------------------------------------------------------------
-
-These are the generic install instructions from autoconf:
-
- The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation. It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions. Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, a file
-`config.cache' that saves the results of its tests to speed up
-reconfiguring, and a file `config.log' containing compiler output
-(useful mainly for debugging `configure').
-
- If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release. If at some point `config.cache'
-contains results you don't want to keep, you may remove or edit it.
-
- The file `configure.in' is used to create `configure' by a program
-called `autoconf'. You only need `configure.in' if you want to change
-it or regenerate `configure' using a newer version of `autoconf'.
-
-The simplest way to compile this package is:
-
- 1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system. If you're
- using `csh' on an old version of System V, you might need to type
- `sh ./configure' instead to prevent `csh' from trying to execute
- `configure' itself.
-
- Running `configure' takes awhile. While running, it prints some
- messages telling which features it is checking for.
-
- 2. Type `make' to compile the package.
-
- 3. Optionally, type `make check' to run any self-tests that come with
- the package.
-
- 4. Type `make install' to install the programs and any data files and
- documentation.
-
- 5. You can remove the program binaries and object files from the
- source code directory by typing `make clean'. To also remove the
- files that `configure' created (so you can compile the package for
- a different kind of computer), type `make distclean'. There is
- also a `make maintainer-clean' target, but that is intended mainly
- for the package's developers. If you use it, you may have to get
- all sorts of other programs in order to regenerate files that came
- with the distribution.
-
-Compilers and Options
-=====================
-
- Some systems require unusual options for compilation or linking that
-the `configure' script does not know about. You can give `configure'
-initial values for variables by setting them in the environment. Using
-a Bourne-compatible shell, you can do that on the command line like
-this:
- CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
-
-Or on systems that have the `env' program, you can do it like this:
- env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
-
-Compiling For Multiple Architectures
-====================================
-
- You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory. To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'. `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
-
- If you have to use a `make' that does not supports the `VPATH'
-variable, you have to compile the package for one architecture at a time
-in the source code directory. After you have installed the package for
-one architecture, use `make distclean' before reconfiguring for another
-architecture.
-
-Installation Names
-==================
-
- By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc. You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
-
- You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files. If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
-
- In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
-kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
-
- If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-Optional Features
-=================
-
- Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System). The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
- For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-Specifying the System Type
-==========================
-
- There may be some features `configure' can not figure out
-automatically, but needs to determine by the type of host the package
-will run on. Usually `configure' can figure that out, but if it prints
-a message saying it can not guess the host type, give it the
-`--host=TYPE' option. TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name with three fields:
- CPU-COMPANY-SYSTEM
-
-See the file `config.sub' for the possible values of each field. If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the host type.
-
- If you are building compiler tools for cross-compiling, you can also
-use the `--target=TYPE' option to select the type of system they will
-produce code for and the `--build=TYPE' option to select the type of
-system on which you are compiling the package.
-
-Sharing Defaults
-================
-
- If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists. Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Operation Controls
-==================
-
- `configure' recognizes the following options to control how it
-operates.
-
-`--cache-file=FILE'
- Use and save the results of the tests in FILE instead of
- `./config.cache'. Set FILE to `/dev/null' to disable caching, for
- debugging `configure'.
-
-`--help'
- Print a summary of the options to `configure', and exit.
-
-`--quiet'
-`--silent'
-`-q'
- Do not print messages saying which checks are being made. To
- suppress all normal output, redirect it to `/dev/null' (any error
- messages will still be shown).
-
-`--srcdir=DIR'
- Look for the package's source code in directory DIR. Usually
- `configure' can determine that directory automatically.
-
-`--version'
- Print the version of Autoconf used to generate the `configure'
- script, and exit.
-
-`configure' also accepts some other, not widely useful, options.
-
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-# Note: Makefile is automatically generated from Makefile.in by the configure
-# script, and Makefile.in is automatically from Makefile.am by automake.
-
-# N.B.: To be able to use dependency tracking on all hosts (not only w. gmake/gcc)
-# and to use the suffix in library names we need the development versions of
-# automake. Presently, this means automake version 1.4f. In Groningen, you
-# can find that under ~lindahl/gnu/bin , or download a copy from www.gromacs.org
-
-ACLOCAL_AMFLAGS = -I config
-
-AUTOMAKE_OPTIONS = foreign
-
-SUBDIRS = include src admin scripts share man
-
-#
-# Most files in the config subdir is included automatically when
-# we issue "make dist", but not depcomp
-
-EXTRA_DIST = config/depcomp \
- CMakeLists.txt cmake \
- include/thread_mpi/atomic/CMakeLists.txt \
- include/thread_mpi/CMakeLists.txt \
- include/CMakeLists.txt \
- man/CMakeLists.txt \
- tests/CMakeLists.txt \
- share/CMakeLists.txt \
- src/kernel/gmx_gpu_utils \
- src/kernel/CMakeLists.txt \
- src/kernel/openmm_wrapper.cpp \
- src/kernel/openmm_wrapper.h \
- src/ngmx/CMakeLists.txt \
- src/mdlib/CMakeLists.txt \
- src/config.h.cmakein \
- src/gmxlib/version.c.cmakein \
- src/gmxlib/thread_mpi/CMakeLists.txt \
- src/gmxlib/CMakeLists.txt \
- src/CMakeLists.txt \
- src/tools/CMakeLists.txt \
- COPYING-GPU \
- INSTALL-GPU \
- INSTALL.cmake \
- INSTALL.automake
-
-
-install-exec-hook:
-if NO_LA_FILES
- cd $(DESTDIR)$(libdir) && rm -f libmd@LIBSUFFIX@.la libgmx@LIBSUFFIX@.la libgmxpreprocess@LIBSUFFIX@.la libgmxana@LIBSUFFIX@.la
-endif
- @echo ""
- @echo "GROMACS is installed under $(prefix)."
- @echo "Make sure to update your PATH and MANPATH to find the"
- @echo "programs and unix manual pages, and possibly LD_LIBRARY_PATH"
- @echo "or /etc/ld.so.conf if you are using dynamic libraries."
- @echo ""
- @echo "Please run \"make tests\" now to verify your installation."
- @echo ""
- @echo "If you want links to the executables in /usr/local/bin,"
- @echo "you can issue \"make links\" now."
-
-# Shortcuts to construct and install the mdrun executable
-
-mdrun:
- (cd $(top_builddir)/src/gmxlib && $(MAKE) ; exit 0)
- (cd $(top_builddir)/src/mdlib && $(MAKE) ; exit 0)
- (cd $(top_builddir)/src/kernel && $(MAKE) mdrun ; exit 0)
-
-install-mdrun:
- (cd $(top_builddir)/src/gmxlib && $(MAKE) install ; exit 0)
- (cd $(top_builddir)/src/mdlib && $(MAKE) install ; exit 0)
- (cd $(top_builddir)/src/kernel && $(MAKE) install-libLTLIBRARIES ; exit 0)
- (cd $(top_builddir)/src/kernel && $(MAKE) install-mdrun ; exit 0)
-if NO_LA_FILES
- cd $(DESTDIR)$(libdir) && rm -f libmd@LIBSUFFIX@.la libgmx@LIBSUFFIX@.la libgmxpreprocess@LIBSUFFIX@.la libgmxana@LIBSUFFIX@.la
-endif
-
-fahcore:
- (cd $(top_builddir)/src/gmxlib && $(MAKE) ; exit 0)
- (cd $(top_builddir)/src/mdlib && $(MAKE) ; exit 0)
- (cd $(top_builddir)/src/kernel && $(MAKE) fahcore ; exit 0)
-
-links:
- cd $(bindir) && programs=`ls` && cd /usr/local/bin && \
- for i in $$programs; do \
- (test ! -f $$i && $(LN_S) $(bindir)/$$i . ; exit 0); \
- done
-tests:
- (if test -d "gmxtest"; then cd "gmxtest"; ./gmxtest.pl all; cd ..; \
- else echo "No gmxtest directory found. Please download and unpack it here.";\
- fi)
-
-RPMARCH=`rpm --showrc | awk '/^build arch/ {print $$4}'`
-
-#
-# Use --buildroot ???
-rpm:
- mkdir -p rpmdir/BUILD \
- rpmdir/SPECS \
- rpmdir/SOURCES \
- rpmdir/SRPMS \
- rpmdir/RPMS/$(RPMARCH)
- cp -f $(PACKAGE)-$(VERSION).tar.gz rpmdir/SOURCES
- rpmbuild --clean -ba $(top_srcdir)/admin/$(PACKAGE).spec --define "_topdir $$PWD/rpmdir"
- @echo "============================================================"
- @echo "Finished - the packages are in rpmdir/RPMS and rpmdir/SRPMS!"
-
-
-mpi-rpm:
- mkdir -p rpmdir/BUILD \
- rpmdir/SPECS \
- rpmdir/SOURCES \
- rpmdir/SRPMS \
- rpmdir/RPMS/$(RPMARCH)
- cp -f $(PACKAGE)-$(VERSION).tar.gz rpmdir/SOURCES/$(PACKAGE)-$(VERSION).tar.gz
- rpmbuild --clean -bb $(top_srcdir)/admin/$(PACKAGE)-mpi.spec --define "_topdir $$PWD/rpmdir"
- @echo "============================================"
- @echo "Finished - the packages are in rpmdir/RPMS!"
-
-CLEANFILES = *~ \\\#*
-
-DISTCLEANFILES = libtool config.cache config.log
-
Welcome to the official version of GROMACS!
If you are familiar with unix, it should be fairly trivial to compile and
-install GROMACS. Installation instructions are available in the INSTALL.*
-files (there is one for automake users, INSTALL.automake and one for cmake
-users, INSTALL.cmake). A more extended step-by-step guide can be found
-on our website http://www.gromacs.org .
+install GROMACS. Installation instructions for CMake are available in the
+INSTALL.* files (the use of autotools is no longer available). A more
+extended step-by-step guide can be found on our website http://www.gromacs.org.
Of course we will do our utmost to help you with any problems, but PLEASE
READ THE INSTALLATION INSTRUCTIONS BEFORE CONTACTING US!
There are also several other online resources available from the homepage,
-and special information for developers. We recommend all users to subscribe
-at least to the gmx-announce list - there is almost no traffic at all, but
-you get notice of new versions or severe bugs, and it gives us a possibility
-to keep track of the number of users since no signature is required anymore.
+and special information for developers.
If you are a developer, or change the source for any other reason, check
-out http://www.gromacs.org/developer for details on using automake & autoconf!
+out http://www.gromacs.org/Developer_Zone.
* * * * *
Good luck with your simulations!
The GROMACS Crew
-
-
-
-
-
-
-
-
+++ /dev/null
-#
-# AC_FUNC_FSEEKO is horribly broken in autoconf 2.61 and can
-# cause silent corruption with largefiles. It is fixed in 2.62, but to
-# prevent stupid mistakes we use our own version taken from the 2.63 tree.
-#
-
-# ACX_FUNC_FSEEKO_FIXED
-# --------------
-AN_FUNCTION([ftello], [ACX_FUNC_FSEEKO_FIXED])
-AN_FUNCTION([fseeko], [ACX_FUNC_FSEEKO_FIXED])
-AC_DEFUN([ACX_FUNC_FSEEKO_FIXED],
-[_AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
- [ac_cv_sys_largefile_source],
- [Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2).],
- [[#include <sys/types.h> /* for off_t */
- #include <stdio.h>]],
- [[int (*fp) (FILE *, off_t, int) = fseeko;
- return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);]])
-
-# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
-# in glibc 2.1.3, but that breaks too many other things.
-# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
-
-if test $ac_cv_sys_largefile_source != unknown; then
- AC_DEFINE(HAVE_FSEEKO, 1,
- [Define to 1 if fseeko (and presumably ftello) exists and is declared.])
-fi
-])# ACX_FUNC_FSEEKO_FIXED
-
-
-# ACX_CHECK_FFTW2()
-# ----------------
-# This macro checks for fftw-2.x header files and libraries,
-# including the possible prefixing with s or d to determine precision.
-# Arg 1 is the fftw header/library name to check for, without
-# prefix or anything else (e.g. rfftw_mpi for real MPI transforms)
-# Arg 2 is the size of the real variable used.
-AC_DEFUN([ACX_CHECK_FFTW2],
-[
-if test -z "$ac_fftw_firstname"; then
-
-sizeof_real=$2
-if test $sizeof_real = 8; then
- prec="double"
- fftwcheckprefix=d
-else
- prec="single"
- fftwcheckprefix=s
-fi
-
-xfftwname=${fftwcheckprefix}$1
-
-ok="no"
-# check header doesn't work, since we must use mpicc to get includes,
-# we cant trust cpp.
-AC_MSG_CHECKING([for $xfftwname.h])
-AC_TRY_COMPILE([#include <$xfftwname.h>],,
-[
-fftwname=$xfftwname
-AC_MSG_RESULT(yes)
-],
-AC_MSG_RESULT(no))
-
-# fftwname was set if we found a header
-
-if test -n "$fftwname"; then
-# we cannot run the code since an MPI program might not be allowed
-# on a login node of a supercomputer
-AC_TRY_COMPILE([#include <$fftwname.h>],
-[int _array_ [1 - 2 * !((sizeof(fftw_real)) == $sizeof_real)]; ],
-[
-ok=yes
-usedprefix=$fftwcheckprefix
-],[ok=no])
-fi
-
-if test "$ok" != "yes"; then
- AC_MSG_CHECKING([for $1.h])
- AC_TRY_COMPILE([#include <$1.h>],,AC_MSG_RESULT(yes),
-[
-AC_MSG_RESULT(no)
-AC_MSG_ERROR([Cannot find any $prec precision $xfftwname.h or $1.h]
-[Do you have $prec precision FFTW-2.x installed? If you are using packages,]
-[note that you also need fftw-devel to compile GROMACS. You can find the ]
-[software at www.fftw.org, and detailed instructions at www.gromacs.org.]
-[If you compiled FFTW-2.x yourself: ]
-[Note that the default FFTW-2.x setup is double precision. Change the FFTW]
-[configuration to single with --enable-float. If you want MPI support,]
-[use --enable-mpi. It is a good idea to install both single & double.]
-[If your sysadm doesn't want to install it you can do it to a location]
-[in your home directory and provide the correct paths in the CPPFLAGS]
-[and LDFLAGS environment variables before running configure.]
-[That is also necessary to do if your compiler doesn't search]
-[/usr/local/include and /usr/local/lib by default.]
-[You can find information at www.gromacs.org, or in the INSTALL file.])
-])
-AC_TRY_COMPILE([#include <$1.h>],
-[int _array_ [1 - 2 * !((sizeof(fftw_real)) == $sizeof_real)];],
-[
-usedprefix=""
-fftwname=$1
-],
-[
-AC_MSG_ERROR([Cannot find any $prec precision $xfftwname.h or $1.h]
-[Do you have $prec precision FFTW-2.x installed? If you are using packages,]
-[note that you also need fftw-devel to compile GROMACS. You can find the ]
-[software at www.fftw.org, and detailed instructions at www.gromacs.org.]
-[If you compiled FFTW-2.x yourself: ]
-[Note that the default FFTW-2.x setup is double precision. Change the FFTW]
-[configuration to single with --enable-float. If you want MPI support,]
-[use --enable-mpi. It is a good idea to install both single & double.]
-[If your sysadm doesn't want to install it you can do it to a location]
-[in your home directory and provide the correct paths in the CPPFLAGS]
-[and LDFLAGS environment variables before running configure.]
-[That is also necessary to do if your compiler doesn't search]
-[/usr/local/include and /usr/local/lib by default.]
-[You can find information at www.gromacs.org, or in the INSTALL file.])])
-fi
-
-AC_CHECK_LIB($fftwname,main,,
-AC_MSG_ERROR([Can't find a library to match the $fftwname header]))
-ac_fftw_savedprefix=$usedprefix
-ac_fftw_firstname=$fftwname
-
-else
-
-fftwname=${ac_fftw_savedprefix}$1
-AC_MSG_CHECKING([for $fftwname.h])
-AC_TRY_COMPILE(
-[#include <$fftwname.h>],,
-[AC_MSG_RESULT(yes)
-LIBS="-l$fftwname $LIBS"
-AC_TRY_LINK_FUNC([main],,,
-AC_MSG_ERROR([Can't find a library to match the $fftwname header]))],
-[
-AC_MSG_RESULT(no)
-AC_MSG_ERROR([Cant find $fftwname.h header. Make sure all your
-fftw prefixes match - we already use $ac_fftw_firstname.h])
-])
-
-fi
-
-])
-
-
-
-
-
-
-dnl Check for floating-point format and double precision word order.
-dnl We dont require IEEE, but there are optimizations we can only do with it.
-dnl Just as for integers, the bytes in a word can be small of big endian.
-dnl There is already a standard autoconf macro (AC_C_BIGENDIAN) that you
-dnl should use to check this for integers - I have never heard of a machine
-dnl where it is not the same for integer and fp variables, but we still check
-dnl it separately for fp variables here to be sure.
-dnl
-dnl However, in double precision there are also two ways to arrange the words
-dnl forming a double (8-byte=2-word) variable.
-dnl Normally this order is the same as the endian, but there are
-dnl exceptions (e.g. ARM)
-dnl We detect it by compiling a small test program and grepping into it.
-dnl
-AC_DEFUN([ACX_FLOAT_FORMAT],
-[AC_CACHE_CHECK(floating-point format, acx_float_format,
-[cat >conftest.$ac_ext <<EOF
-[/* Check that a double is 8 bytes - die if it isnt */
-extern char xyz [sizeof(double) == 8 ? 1 : -1];
-double abc [] = {
- /* "GROMACSX" in ascii */
- (double) 3.80279098314984902657e+35 ,
- /* "GROMACSX" in ebcdic */
- (double) -1.37384666579378297437e+38 ,
- /* "D__float" (vax) */
- (double) 3.53802595280598432000e+18 ,
- /* "IBMHEXFP" s390/ascii */
- (double) 1.77977764695171661377e+10 ,
- /* "IBMHEXFP" s390/ebcdic */
- (double) -5.22995989424860458374e+10 };
-]
-EOF
-if AC_TRY_EVAL(ac_compile); then
-# dont match first and last letter because of rounding errors.
-# next: big-endian - string is GROMACSX
- if grep 'ROMACS' conftest.o >/dev/null 2>&1; then
- acx_float_format='IEEE754 (big-endian byte and word order)'
-# next: big-endian byte order, but little-endian word order - ACSXGROM
- elif grep 'CSXGRO' conftest.o >/dev/null 2>&1; then
- acx_float_format='IEEE754 (big-endian byte, little-endian word order)'
-# next: little-endian - XSCAMORG
- elif grep 'SCAMOR' conftest.o >/dev/null 2>&1; then
- acx_float_format='IEEE754 (little-endian byte and word order)'
-# next: little-endian byte order, but big-endian word order - MORGXSCA
- elif grep 'ORGXSC' conftest.o >/dev/null 2>&1; then
- acx_float_format='IEEE754 (litte-endian byte, little-endian word order)'
- elif grep '__floa' conftest.o >/dev/null 2>&1; then
- acx_float_format='VAX D-float'
- elif grep 'BMHEXF' conftest.o >/dev/null 2>&1; then
- acx_float_format='IBM 370 hex'
- else
- AC_MSG_WARN([Unknown floating-point format])
- fi
-else
- AC_MSG_ERROR(compile failed)
-fi
-rm -rf conftest*])
-case $acx_float_format in
- 'IEEE754 (big-endian byte and word order)' )
- format=IEEE754
- byteorder=big
- wordorder=big
- ;;
- 'IEEE754 (little-endian byte and word order)' )
- format=IEEE754
- byteorder=little
- wordorder=little
- ;;
- 'IEEE754 (big-endian byte, little-endian word order)' )
- format=IEEE754
- byteorder=big
- wordorder=little
- ;;
- 'IEEE754 (litte-endian byte, big-endian word order)' )
- format=IEEE754
- byteorder=little
- wordorder=big
- ;;
- 'VAX D-float' )
- AC_DEFINE(FLOAT_FORMAT_VAX,,[VAX floating-point format if set])
- ;;
- 'IBM 370 hex' )
- AC_DEFINE(FLOAT_FORMAT_IBM_HEX,,[IBM HEX floating-point format if set (s390?)])
- ;;
- * )
- format=Unknown
- ;;
-esac
-if test "$format" = "IEEE754"; then
- AC_DEFINE(FLOAT_FORMAT_IEEE754,,[IEEE754 floating-point format. Memory layout is defined by
-macros IEEE754_BIG_ENDIAN_BYTE_ORDER and IEEE754_BIG_ENDIAN_WORD_ORDER.])
-fi
-if test "$byteorder" = "big"; then
- AC_DEFINE(IEEE754_BIG_ENDIAN_BYTE_ORDER,,[Bytes in IEEE fp word are in big-endian order if set,
- little-endian if not. Only relevant when FLOAT_FORMAT_IEEE754 is defined.])
-fi
-if test "$wordorder" = "big"; then
- AC_DEFINE(IEEE754_BIG_ENDIAN_WORD_ORDER,,[The two words in a double precision variable are in b
-ig-endian order if set, little-endian if not. Do NOT assume this is the same as the byte order!
-Only relevant when FLOAT_FORMAT_IEEE754 is defined.])
-fi
-])
-
-
-dnl macro modified from the fftw distribution (www.fftw.org)
-AC_DEFUN([ACX_CHECK_CC_FLAGS],
-[
-AC_REQUIRE([AC_PROG_CC])
-AC_CACHE_CHECK(whether $CC accepts $1, ac_$2,
-[echo 'void f(){}' > conftest.c
-res=`$CC $1 -c conftest.c 2>&1`
-#
-# The stupid intel compiler echos the filename on stderr...
-#
-if test -z "$res" -o "$res" = "conftest.c:"; then
- ac_$2=yes
-else
- ac_$2=no
-fi
-rm -rf conftest*
-])
-if test "$ac_$2" = yes; then
- :
- $3
-else
- :
- $4
-fi
-])
-
-dnl macro modified from the fftw distribution (www.fftw.org)
-AC_DEFUN([ACX_CHECK_F77_FLAGS],
-[
-AC_REQUIRE([AC_PROG_F77])
-AC_CACHE_CHECK(whether $F77 accepts $1, ac_$2,
-[cat > conftest.f << EOF
- subroutine f
- return
- end
-EOF
-if test -z "`$F77 $1 -c conftest.f `"; then
- ac_$2=yes
-else
- ac_$2=no
-fi
-rm -rf conftest*
-])
-if test "$ac_$2" = yes; then
- :
- $3
-else
- :
- $4
-fi
-])
-
-
-# ACX_DETECT_GMXCPU
-# ---------------------------
-# Macro to extend the exact CPU for some hosts
-AC_DEFUN([ACX_DETECT_GMXCPU],
-[
-AC_REQUIRE([AC_CANONICAL_HOST])
-
-#
-# Determine the exact cpu type on some common systems where it is
-# not visible from the host triplet.
-# (on e.g. intel and dec/tru64 the host type is enough)
-
-gmxcpu="";
-
-case "${host_cpu}-${host_os}" in
-
-*-aix*)
- # some versions of config.status says these systems are PowerPC even
- # when they have Power3 CPUs (they used to be recognized as rs6000),
- # so we need to work around that.
- #
- # we need to fool the combination of m4, sh and awk - thus the seemingly unnecessary n
- if test -f /usr/sbin/lsdev && test -f /usr/sbin/lsattr; then
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ n=1; print $n }'`
- if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER5 >/dev/null 2>&1; then
- gmxcpu=power5
- elif /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER4 >/dev/null 2>&1; then
- gmxcpu=power4
- elif /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER3 >/dev/null 2>&1; then
- gmxcpu=power3
- elif /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER2 >/dev/null 2>&1; then
- gmxcpu=power2
- fi
- fi
- if test -z "${gmxcpu}" && test -f /usr/sbin/lscfg; then
- if /usr/sbin/lscfg -vp | grep PowerPC | grep 604 >/dev/null 2>&1; then
- gmxcpu=ppc604
- elif /usr/sbin/lscfg -vp | grep PowerPC | grep 603 >/dev/null 2>&1; then
- gmxcpu=ppc603
- elif /usr/sbin/lscfg -vp | grep PowerPC | grep rs64a >/dev/null 2>&1; then
- gmxcpu=rs64a
- elif /usr/sbin/lscfg -vp | grep PowerPC | grep rs64b >/dev/null 2>&1; then
- gmxcpu=rs64b
- elif /usr/sbin/lscfg -vp | grep PowerPC | grep rs64c >/dev/null 2>&1; then
- gmxcpu=rs64c
- elif /usr/sbin/lscfg -vp | grep POWER2 >/dev/null 2>&1; then
- gmxcpu=power2
- elif /usr/sbin/lscfg -vp | grep POWER3 >/dev/null 2>&1; then
- gmxcpu=power3
- elif /usr/sbin/lscfg -vp | grep POWER4 >/dev/null 2>&1; then
- gmxcpu=power4
- fi
- fi
- ;;
-
-mips*-irix*)
- if /sbin/hinv | grep CPU | grep R12000 >/dev/null 2>&1; then
- gmxcpu=r12000
- elif /sbin/hinv | grep CPU | grep R10000 >/dev/null 2>&1; then
- gmxcpu=r10000
- elif /sbin/hinv | grep CPU | grep R8000 >/dev/null 2>&1; then
- gmxcpu=r8000
- elif /sbin/hinv | grep CPU | grep R5000 >/dev/null 2>&1; then
- gmxcpu=r5000
- else
- gmxcpu=""
- fi
- ;;
-
-sparc*-solaris*)
- if /usr/sbin/prtconf | grep UltraSPARC-III >/dev/null 2>&1; then
- gmxcpu=ultrasparc3
- elif /usr/sbin/prtconf | grep UltraSPARC-IIi >/dev/null 2>&1; then
- gmxcpu=ultrasparc2i
- elif /usr/sbin/prtconf | grep UltraSPARC-II >/dev/null 2>&1; then
- gmxcpu=ultrasparc2
- elif /usr/sbin/prtconf | grep UltraSPARC >/dev/null 2>&1; then
- gmxcpu=ultrasparc
- else
- gmxcpu=""
- fi
- ;;
-*)
- gmxcpu=""
- ;;
-
-esac
-])
-
-
-
-###############################################################
-# Macro modified from the fftw distribution (www.fftw.org)
-# to determine optimization flags.
-# Note that we have modified config.guess and config.sub
-# to provide extended information on the detailed type of CPU.
-# In general we assume you have recent versions of the compilers
-# that support the highest optimization we know of. If not, you
-# can always override these flags, but it's better to upgrade :-)
-###############################################################
-AC_DEFUN([ACX_COMPILER_MAXOPT],
-[
-AC_REQUIRE([AC_PROG_CC])
-AC_REQUIRE([AC_PROG_F77])
-AC_REQUIRE([AC_CANONICAL_HOST])
-
-# Try to determine "good" native compiler flags if none specified on command
-# line. To avoid repeating the entire procedure for fortran flags, we first
-# determine our suggested choices for both C and fortran, and then possibly
-# override them with user choices.
-
-cc_vendor="unknown"
-
-case "${host_cpu}-${host_os}" in
-
- *-solaris2*)
- case "${gmxcpu}" in
- ultrasparc3*)
- xCFLAGS="-fast -xO5 -xtarget=ultra3 -fsimple=2 -fnonstd -dalign"
- xFFLAGS=$xCFLAGS
- ;;
- ultrasparc2i*)
- xCFLAGS="-fast -xO5 -xtarget=ultra2i -fsimple=2 -fnonstd -dalign"
- xFFLAGS=$xCFLAGS
- ;;
- ultrasparc2*)
- xCFLAGS="-fast -xO5 -xtarget=ultra2 -fsimple=2 -fnonstd -dalign"
- xFFLAGS=$xCFLAGS
- ;;
- ultrasparc*)
- xCFLAGS="-fast -xO5 -xtarget=ultra -fsimple=2 -fnonstd -dalign"
- xFFLAGS=$xCFLAGS
- ;;
- *)
- xCFLAGS="-native -fast -xO5 -fsimple=2 -fnonstd -dalign"
- xFFLAGS=$xCFLAGS
- ;;
- esac
- ;;
-
- *-hpux*)
- xCFLAGS="-Ae +O3 +Oall"
- xFFLAGS=$xCFLAGS
- # If you haven't noticed, we don't like hp very much...
- # but perhaps that will change if they make something nice out of ia64.
- ;;
-
- ia64*-*)
- # The GNU compilers are checked outside this case statement.
- # Check for Intel Compilers. The SGI one was killed before
- # it went final, so I cant imagine anyone is using it...
-
- # Apparently, -O2 is better than -O3 for villin at least,
- # but I have not yet had time to test all the other benchmarks
- # on both optimization levels. Might need further tweaking.
-
- # The Intel compilers are _really_ chatty when it comes to
- # warnings, and also echo a lot of incomprehensible internal
- # stuff (not gromacs-related) when we are using ia64 assembly.
- # For this reason we disable warnings...
-
- if $CC -V 2>&1 | grep 'Intel' > /dev/null 2>&1; then
- xCFLAGS="-O3 -w"
- xASFLAGS=$xCFLAGS
- ac_cv_prog_gcc="no"
- fi
- if $F77 -V 2>&1 | grep 'Intel' > /dev/null 2>&1; then
- xFFLAGS="-O3 -w90 -w95 -w"
- ac_cv_prog_g77="no"
- fi
- # PORTME 2. Check for intel compilers when we get our hands on one!
- ;;
- *-aix*)
- # dont use inter-procedure analysis for the innerloops - they take
- # forever to compile with it, and it doesnt help at all.
-
- # use 8 segments (max 2Gb) instead of 1 (max 256Meg) by default.
- xLDFLAGS="$xLDFLAGS -bmaxdata:0x80000000"
- case "${gmxcpu}" in
- power6*)
- xCFLAGS="-O3 -qarch=pwr6 -qtune=pwr6 -qmaxmem=-1 -qstrict -qaltivec -qenablevmx -qvecnvol"
- xFFLAGS="-O3 -qarch=pwr6 -qtune=pwr6 -qmaxmem=-1 -qhot -qstrict -qaltivec -qenablevmx -qvecnvol"
- ;;
- power5*)
- xCFLAGS="-O3 -qarch=pwr5 -qtune=pwr5 -qmaxmem=16384"
- xFFLAGS="-O3 -Q -qarch=pwr5 -qtune=pwr5 -qmaxmem=16384 -qhot -qnoipa"
- ;;
- power4*)
- xCFLAGS="-O3 -qarch=pwr4 -qtune=pwr4 -qmaxmem=16384"
- xFFLAGS="-O3 -Q -qarch=pwr4 -qtune=pwr4 -qmaxmem=16384 -qhot -qnoipa"
- ;;
- power3*)
- xCFLAGS="-O3 -qarch=pwr3 -qtune=pwr3 -qmaxmem=16384"
- xFFLAGS="-O3 -Q -qarch=pwr3 -qtune=pwr3 -qmaxmem=16384 -qhot -qnoipa"
- ;;
- power2*)
- xCFLAGS="-O3 -qarch=pwr2 -qtune=pwr2 -qmaxmem=16384"
- xFFLAGS="-O3 -Q -qarch=pwr2 -qtune=pwr2 -qmaxmem=16384 -qhot -qnoipa"
- ;;
- power)
- xCFLAGS="-O3 -qarch=pwr -qtune=pwr -qmaxmem=16384"
- xFFLAGS="-O3 -Q -qarch=pwr -qtune=pwr -qmaxmem=16384 -qhot -qnoipa"
- ;;
- ppc604)
- xCFLAGS="-O3 -qarch=604 -qtune=604 -qmaxmem=16384"
- xFFLAGS="-O3 -Q -qarch=604 -qtune=604 -qmaxmem=16384 -qhot"
- ;;
- ppc603)
- xCFLAGS="-O3 -qarch=603 -qtune=603 -qmaxmem=16384"
- xFFLAGS="-O3 -Q -qarch=603 -qtune=603 -qmaxmem=16384 -qhot"
- ;;
- rs64a)
- xCFLAGS="-O3 -qarch=rs64a -qtune=rs64a -qmaxmem=16384"
- xFFLAGS="-O3 -Q -qarch=rs64a -qtune=rs64a -qmaxmem=16384 -qhot"
- ;;
- rs64b)
- xCFLAGS="-O3 -qarch=rs64b -qtune=rs64b -qmaxmem=16384"
- xFFLAGS="-O3 -Q -qarch=rs64b -qtune=rs64b -qmaxmem=16384 -qhot"
- ;;
- rs64c)
- xCFLAGS="-O3 -qarch=rs64c -qtune=rs64c -qmaxmem=16384"
- xFFLAGS="-O3 -Q -qarch=rs64c -qtune=rs64c -qmaxmem=16384 -qhot"
- ;;
- *)
- xCFLAGS="-O3 -qmaxmem=16384"
- xFFLAGS="-O3 -Q -qmaxmem=16384 -qhot"
- ;;
- esac
- ;;
-
- powerpc*-darwin* | powerpc*-linux* )
- # Check for IBM compilers on OS X
- if $CC 2>&1 | grep 'IBM' > /dev/null 2>&1; then
- xCFLAGS="-O4 -Q=500 -qaltivec -qnoipa"
- fi
- if $F77 -V 2>&1 | grep 'IBM' > /dev/null 2>&1; then
- xFFLAGS="-O4 -Q=500 -qnoipa"
- fi
- ;;
-
- mips*-irix*)
- xCFLAGS="-O3 -OPT:IEEE_arithmetic=3 -OPT:rsqrt=ON -SWP:loop_overhead -INLINE:=ON -LNO:opt=1 -LNO:ou_further=3 -OPT:Olimit=0:roundoff=3:alias=typed -woff 1174 -D__INLINE_INTRINSICS"
- xFFLAGS="-O3 -OPT:IEEE_arithmetic=3 -OPT:rsqrt=ON -SWP:loop_overhead -INLINE:=ON -LNO:opt=1 -LNO:ou_further=3 -OPT:Olimit=0:roundoff=3:alias=typed -OPT:cray_ivdep=TRUE"
-
- if $CC -version | grep "Version 7.1" > /dev/null 2>&1; then
- xCFLAGS="$xCFLAGS -GCM:aggressive_speculation -GCM:array_speculation"
- xFFLAGS="$xFFLAGS -GCM:aggressive_speculation -GCM:array_speculation"
- fi
-
- if $CC -version | grep "Version 7.3" > /dev/null 2>&1; then
- xCFLAGS="$xCFLAGS -SWP:heur=fdms,nhms,fdnms"
- xFFLAGS="$xFFLAGS -SWP:heur=fdms,nhms,fdnms"
- fi
- xLDFLAGS="-woff 84"
-
- # I have removed -n32 from the flags since it causes too many problems.
- # New SGIs should use the right objects automatically, and it's not
- # worth the hassle for 5-10 year old machines...
-
- case "${gmxcpu}" in
- r12000*)
- xCFLAGS="$IRIXOBJFLAG -r12000 -mips4 $xCFLAGS"
- xFFLAGS="$IRIXOBJFLAG -r12000 -mips4 $xFFLAGS"
- xLDFLAGS="$IRIXOBJFLAG -r12000 -mips4 $xLDFLAGS"
- ;;
- r10000*)
- xCFLAGS="$IRIXOBJFLAG -r10000 -mips4 $xCFLAGS"
- xFFLAGS="$IRIXOBJFLAG -r10000 -mips4 $xFFLAGS"
- xLDFLAGS="$IRIXOBJFLAG -r10000 -mips4 $xLDFLAGS"
- ;;
- r8000*)
- xCFLAGS="$IRIXOBJFLAG -r8000 -mips4 $xCFLAGS"
- xFFLAGS="$IRIXOBJFLAG -r8000 -mips4 $xFFLAGS"
- xLDFLAGS="$IRIXOBJFLAG -r8000 -mips4 $xLDFLAGS"
- ;;
- r5000*)
- xCFLAGS="$IRIXOBJFLAG -r5000 -mips4 $xCFLAGS"
- xFFLAGS="$IRIXOBJFLAG -r5000 -mips4 $xFFLAGS"
- xLDFLAGS="$IRIXOBJFLAG -r5000 -mips4 $xLDFLAGS"
- ;;
- *)
- xCFLAGS="$IRIXOBJFLAG $xCFLAGS"
- xFFLAGS="$IRIXOBJFLAG $xFFLAGS"
- xLDFLAGS="$IRIXOBJFLAG $xLDFLAGS"
- ;;
- esac
- ;;
-
- alpha*-osf*)
- # NB: -arch implies -tune according to the cc manual.
- # We dont use -ifo since it conflicts with dependency
- # generation on old versions of the compiler.
- case "${host_cpu}" in
- alphaev*)
- # extract the processor from cpu type (e.g. alphaev56 -> ev56)
- evtype=`echo ${host_cpu} | sed 's/alpha//'`
- xCFLAGS="-std1 -fast -O4 -no_ifo -arch $evtype -unroll 2 -fp_reorder"
- xFFLAGS="$xCFLAGS -assume noaccuracy_sensitive"
- xASFLAGS="-O4 -no_ifo -arch $evtype"
- xLDFLAGS="-O4"
- ;;
- *)
- xCFLAGS="-std1 -fast -O4 -no_ifo -arch host -unroll 2 -fp_reorder"
- xFFLAGS="$xCFLAGS -assume noaccuracy_sensitive"
- xASFLAGS="-O4 -no_ifo -arch host"
- xLDFLAGS="-O4"
- ;;
- esac
- ;;
-
- alpha*-linux*)
- case "${host_cpu}" in
- alphaev*)
- # extract the processor from cpu type (e.g. alphaev56 -> ev56)
- evtype=`echo ${host_cpu} | sed 's/alpha//'`
- tmpCFLAGS="-std1 -fast -O4 -no_ifo -arch $evtype -unroll 2 -fp_reorder"
- tmpFFLAGS="$tmpCFLAGS -assume noaccuracy_sensitive"
- tmpASFLAGS="-O4 -no_ifo -arch $evtype"
- tmpLDFLAGS="-O4"
- ;;
- *)
- tmpCFLAGS="-std1 -fast -O4 -no_ifo -arch host -unroll 2 -fp_reorder"
- tmpFFLAGS="$tmpCFLAGS -assume noaccuracy_sensitive"
- tmpASFLAGS="-O4 -no_ifo -arch host"
- tmpLDFLAGS="-O4"
- ;;
- esac
- # Compaq sometimes uses -version and sometimes -V
- # Not 100% sure if ccc always has -V and F77 -version, so
- # we check both alternatives to be sure.
- if (($CC -V 2>&1 | grep ompaq > /dev/null) ||
- ($CC -version 2>&1 | grep ompaq > /dev/null)); then
- xCFLAGS="$tmpCFLAGS"
- xASFLAGS="$tmpASFLAGS"
- cc_vendor="Compaq"
- fi
- if test "$enable_fortran" = "yes"; then
- if (($F77 -V 2>&1 | grep ompaq > /dev/null) ||
- ($F77 -version 2>&1 | grep ompaq > /dev/null)); then
- xFFLAGS="$tmpFFLAGS"
- fi
- fi
- ;;
-
- *-*)
- # most of these systems (e.g. linux, FreeBSD) use gcc which is treated
- # further down, but check for some specific compilers.
- # Portland group compilers:
- if $CC -V 2> /dev/null | grep ortland > /dev/null 2>&1; then
- case "${host_cpu}" in
- i586)
- pgiopt="-tp p5"
- ;;
- i686)
- pgiopt="-tp p6"
- ;;
- esac
- xCFLAGS="$pgiopt -fast -pc 32"
- xASFLAGS="$xCFLAGS"
- fi
- if test "$enable_fortran" = "yes"; then
- if $F77 -version 2> /dev/null | grep Portland > /dev/null 2>&1; then
- xFFLAGS="$xCFLAGS"
- fi
- fi
-
- # Intel compilers
- # The Intel compilers are _really_ chatty when it comes to
- # warnings, and also echo a lot of incomprehensible internal
- # stuff (not gromacs-related) when we are using assembly.
- # For this reason we disable warnings...
-
- if $CC -V 2>&1 | grep 'Intel' > /dev/null 2>&1; then
- ac_cv_prog_gcc="no"
- case "${host_cpu}" in
- x86_64)
- xCFLAGS="-O3 -tpp7 -axW -ip -w"
- ;;
- i686)
- xCFLAGS="-O3 -tpp6 -axK -ip -w"
- ;;
- ia64)
- xCFLAGS="-O3 -ip -w"
- ;;
- esac
- xASFLAGS="$xCFLAGS"
- # search in /usr/local/include too, just as gcc does. (handy for fftw)
- CPPFLAGS="$CPPFLAGS -I/usr/local/include"
- fi
- if test "$enable_fortran" = "yes"; then
- if $F77 -V 2>&1 | grep 'Intel' > /dev/null 2>&1; then
- ac_cv_prog_g77="no"
- xFFLAGS="$xCFLAGS -w90 -w95"
- fi
- fi
-
- ;;
-esac
-# Phew, end of all those operating systems and processors!
-
-# use default flags for gcc/g77 on all systems
-if test $ac_cv_prog_gcc = yes; then
- ACX_CHECK_CC_FLAGS(-O3,o3,xCFLAGS="$xCFLAGS -O3")
- xCFLAGS="$xCFLAGS -fomit-frame-pointer -finline-functions -Wall -Wno-unused"
- # For alpha axp assembly we need the preprocessor to tell elf from ecoff.
- # The compaq ccc compiler only knows .s files, and always runs them
- # through cpp. We support this by telling gcc to preprocess .s files.
- case "${host_cpu}" in
- alphaev*)
- xASFLAGS="$xCFLAGS -x assembler-with-cpp"
- ;;
- *)
- ;;
- esac
-fi
-
-if test $enable_fortran = yes; then
- if test $ac_cv_prog_g77 = yes; then
- xFFLAGS="-O3 -ffast-math -fomit-frame-pointer -finline-functions -funroll-all-loops -Wall -Wno-unused"
- # -malign-double for f77 on x86 systems - haven't checked that this works yet.
- #ACX_CHECK_F77_FLAGS(-malign-double,align_double,xFFLAGS="$xFFLAGS -malign-double")
- fi
-fi
-
-CPU_FLAGS=""
-
-if test "$GCC" = "yes"; then
- # try to guess correct CPU flags, at least for powerpc linux
- case "${host_cpu}" in
- # i586/i686 cpu flags don't improve speed, thus no need to use them.
- # don't check f77 separately - we assume f77 and gcc are similar
- powerpc*)
- # don't use the separate apple cpp on OS X
-# ACX_CHECK_CC_FLAGS(-no-cpp-precomp,no_cpp_precomp,xCFLAGS="$xCFLAGS -no-cpp-precomp")
- if test "$enable_ppc_altivec" = "yes"; then
- # Apple (darwin) uses a hacked version of gcc with special flags
- case "${host_os}" in
- darwin*)
- ACX_CHECK_CC_FLAGS(-faltivec,faltivec,xCFLAGS="$xCFLAGS -faltivec")
- ;;
- *)
- # Need to update CPPFLAGS too, since we later call
- # AC_CHECK_HEADER for altivec.h, and then autoconf complains
- # if it cannot process it with the preprocessor.
- ACX_CHECK_CC_FLAGS(-maltivec,maltivec,xCFLAGS="$xCFLAGS -maltivec" CPPFLAGS="$CPPFLAGS -maltivec")
- ACX_CHECK_CC_FLAGS(-mabi=altivec,mabialtivec,xCFLAGS="$xCFLAGS -mabi=altivec" CPPFLAGS="$CPPFLAGS -mabi=altivec")
- ;;
- esac
- fi
- # -funroll-all-loops exposes a bug in altivec-enabled gcc-2.95.3
- # on powerpc, so we only enable it on other platforms or gcc3.
- # The gcc 2.95 instruction scheduler also destroys our handcoded altivec,
- # so disable instruction scheduling on 2.95
- if $CC --version 2>&1 | grep '2.95' > /dev/null 2>&1; then
- echo "*****************************************************************************"
- echo "* IMPORTANT INFO: You are using gcc-2.95.x on PowerPC. This compiler works, *"
- echo "* but you will get better performance with gcc-3.3 or later. If you are *"
- echo "* running OS X, download the latest devtools from http://developer.apple.com*"
- echo "*****************************************************************************"
- ACX_CHECK_CC_FLAGS(-fno-schedule-insns,fno_schedule_insns,xCFLAGS="$xCFLAGS -fno-schedule-insns")
- fi
- ACX_CHECK_CC_FLAGS(-mcpu=7450,m_cpu_7450,CPU_FLAGS="-mcpu=7450")
- ACX_CHECK_CC_FLAGS(-mtune=970,m_tune_970,CPU_FLAGS="$CPU_FLAGS -mtune=970")
- if test -z "$CPU_FLAGS"; then
- ACX_CHECK_CC_FLAGS(-mcpu=powerpc,m_cpu_powerpc,CPU_FLAGS="-mcpu=powerpc")
- fi
- ;;
- x86_64 | i?86)
- ACX_CHECK_CC_FLAGS(-msse2,msse2,xCFLAGS="$xCFLAGS -msse2")
- ;;
- esac
- ACX_CHECK_CC_FLAGS(-funroll-all-loops,funroll_all_loops,xCFLAGS="$xCFLAGS -funroll-all-loops")
- ACX_CHECK_CC_FLAGS(-std=gnu99,stdgnu99,xCFLAGS="$xCFLAGS -std=gnu99")
- # C99 requires strict IEEE 754 floating point compliance. Since gcc>=4.5.0
- # this is on when asking for c99, potentially impacting floating point
- # performance, so we turn it off here.
- ACX_CHECK_CC_FLAGS(-fexcess-precision=fast, fexcess_precision_fast,
- xCFLAGS="$xCFLAGS -fexcess-precision=fast")
-fi
-
-if test "$enable_debug" = "yes"; then
- xCFLAGS="$xCFLAGS -g"
-fi
-
-if test -n "$CPU_FLAGS"; then
- xCFLAGS="$xCFLAGS $CPU_FLAGS"
- xFFLAGS="$xFFLAGS $CPU_FLAGS"
- xASFLAGS="$xASFLAGS $CPU_FLAGS"
-fi
-
-# Now check if the user provided anything special for C or fortran...
-# Not nice to have checked everything then, but otherwise we would have
-# to use entirely separate checks for C and fortran flags, doubling the code.
-if test "$ac_test_CFLAGS" != "set"; then
- CFLAGS="$xCFLAGS"
- # Use the extra link optimization flags on e.g. irix only when
- # we are using our own C compiler flags
- LDFLAGS="$LDFLAGS $xLDFLAGS"
-
- if test -z "$CFLAGS"; then
- echo "********************************************************************"
- echo "* Note: We have not optimized the C compiler flags on your target *"
- echo "* yet, but the default CFLAGS=-O3 should be OK in most cases. *"
- echo "* You can override this by setting the CFLAGS environment variable.*"
- echo "*******************************************************************"
- CFLAGS="-O3"
- fi
- ACX_CHECK_CC_FLAGS(${CFLAGS}, guessed_cflags, , [
- echo "*******************************************************************"
- echo "* Sorry, these optimization settings don't seem to work for *"
- echo "* your C compiler. Use make CFLAGS=..., or edit the top Makefile. *"
- echo "*******************************************************************"
- CFLAGS=""
- ])
-else
- echo "******************************************"
- echo "* Using CFLAGS from environment variable *"
- echo "******************************************"
-fi
-
-if test "$enable_fortran" = "yes"; then
- if test "$ac_test_FFLAGS" != "set"; then
- FFLAGS="$xFFLAGS"
- if test -z "$FFLAGS"; then
- echo "********************************************************************"
- echo "* Note: We have not optimized the Fortran compiler flags on your *"
- echo "* target, but the default FFLAGS=-O3 should be OK in most cases. *"
- echo "* You can override this by setting the CFLAGS environment variable.*"
- echo "********************************************************************"
- FFLAGS="-O3"
- fi
- ACX_CHECK_F77_FLAGS(${FFLAGS}, guessed_fflags, , [
- echo "*******************************************************************"
- echo "* Sorry, these optimization settings don't seem to work for *"
- echo "* your f77 compiler. Use make FFLAGS=.., or edit the top Makefile.*"
- echo "*******************************************************************"
- FFLAGS=""
- ])
- else
- echo "******************************************"
- echo "* Using FFLAGS from environment variable *"
- echo "******************************************"
- fi
-fi
-# Be silent for assembly flags, they are usually not important anyway
-if test "${ASFLAGS+set}" != set; then
- if test "${xASFLAGS+set}" != set; then
- xASFLAGS="$CFLAGS"
- fi
- ASFLAGS="$xASFLAGS"
-fi
-
-])
-
-
-dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
-dnl
-dnl This macro figures out how to build C programs using POSIX
-dnl threads. It sets the PTHREAD_LIBS output variable to the threads
-dnl library and linker flags, and the PTHREAD_CFLAGS output variable
-dnl to any special C compiler flags that are needed. (The user can also
-dnl force certain compiler flags/libs to be tested by setting these
-dnl environment variables.)
-dnl
-dnl Also sets PTHREAD_CC to any special C compiler that is needed for
-dnl multi-threaded programs (defaults to the value of CC otherwise).
-dnl (This is necessary on AIX to use the special cc_r compiler alias.)
-dnl
-dnl If you are only building threads programs, you may wish to
-dnl use these variables in your default LIBS, CFLAGS, and CC:
-dnl
-dnl LIBS="$PTHREAD_LIBS $LIBS"
-dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-dnl CC="$PTHREAD_CC"
-dnl
-dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
-dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE
-dnl to that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
-dnl
-dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
-dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands
-dnl to run it if it is not found. If ACTION-IF-FOUND is not specified,
-dnl the default action will define HAVE_PTHREAD.
-dnl
-dnl Please let the authors know if this macro fails on any platform,
-dnl or if you have any other suggestions or comments. This macro was
-dnl based on work by SGJ on autoconf scripts for FFTW (www.fftw.org)
-dnl (with help from M. Frigo), as well as ac_pthread and hb_pthread
-dnl macros posted by AFC to the autoconf macro repository. We are also
-dnl grateful for the helpful feedback of numerous users.
-dnl
-dnl @author Steven G. Johnson <stevenj@alum.mit.edu> and Alejandro Forero Cuervo <bachue@bachue.com>
-
-AC_DEFUN([ACX_PTHREAD], [
-AC_REQUIRE([AC_CANONICAL_HOST])
-AC_LANG_SAVE
-AC_LANG_C
-acx_pthread_ok=no
-
-# We used to check for pthread.h first, but this fails if pthread.h
-# requires special compiler flags (e.g. on True64 or Sequent).
-# It gets checked for in the link test anyway.
-
-# First of all, check if the user has set any of the PTHREAD_LIBS,
-# etcetera environment variables, and if threads linking works using
-# them:
-if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
- AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
- AC_MSG_RESULT($acx_pthread_ok)
- if test x"$acx_pthread_ok" = xno; then
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
- fi
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-fi
-
-# We must check for the threads library under a number of different
-# names; the ordering is very important because some systems
-# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
-# libraries is broken (non-POSIX).
-
-# Create a list of thread flags to try. Items starting with a "-" are
-# C compiler flags, and other items are library names, except for "none"
-# which indicates that we try without any flags at all.
-
-acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
-
-# The ordering *is* (sometimes) important. Some notes on the
-# individual items follow:
-
-# pthreads: AIX (must check this before -lpthread)
-# none: in case threads are in libc; should be tried before -Kthread and
-# other compiler flags to prevent continual compiler warnings
-# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
-# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
-# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
-# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
-# -pthreads: Solaris/gcc
-# -mthreads: Mingw32/gcc, Lynx/gcc
-# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
-# doesn't hurt to check since this sometimes defines pthreads too;
-# also defines -D_REENTRANT)
-# pthread: Linux, etcetera
-# --thread-safe: KAI C++
-
-case "${host_cpu}-${host_os}" in
- *solaris*)
-
- # On Solaris (at least, for some versions), libc contains stubbed
- # (non-functional) versions of the pthreads routines, so link-based
- # tests will erroneously succeed. (We need to link with -pthread or
- # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
- # a function called by this macro, so we could check for that, but
- # who knows whether they'll stub that too in a future libc.) So,
- # we'll just look for -pthreads and -lpthread first:
-
- acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
- ;;
-esac
-
-if test x"$acx_pthread_ok" = xno; then
-for flag in $acx_pthread_flags; do
-
- case $flag in
- none)
- AC_MSG_CHECKING([whether pthreads work without any flags])
- ;;
-
- -*)
- AC_MSG_CHECKING([whether pthreads work with $flag])
- PTHREAD_CFLAGS="$flag"
- ;;
-
- *)
- AC_MSG_CHECKING([for the pthreads library -l$flag])
- PTHREAD_LIBS="-l$flag"
- ;;
- esac
-
- save_LIBS="$LIBS"
- save_CFLAGS="$CFLAGS"
- LIBS="$PTHREAD_LIBS $LIBS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
- # Check for various functions. We must include pthread.h,
- # since some functions may be macros. (On the Sequent, we
- # need a special flag -Kthread to make this header compile.)
- # We check for pthread_join because it is in -lpthread on IRIX
- # while pthread_create is in libc. We check for pthread_attr_init
- # due to DEC craziness with -lpthreads. We check for
- # pthread_cleanup_push because it is one of the few pthread
- # functions on Solaris that doesn't have a non-functional libc stub.
- # We try pthread_create on general principles.
- AC_TRY_LINK([#include <pthread.h>],
- [pthread_t th; pthread_join(th, 0);
- pthread_attr_init(0); pthread_cleanup_push(0, 0);
- pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
- [acx_pthread_ok=yes])
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-
- AC_MSG_RESULT($acx_pthread_ok)
- if test "x$acx_pthread_ok" = xyes; then
- break;
- fi
-
- PTHREAD_LIBS=""
- PTHREAD_CFLAGS=""
-done
-fi
-
-# Various other checks:
-if test "x$acx_pthread_ok" = xyes; then
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
-
- # Detect AIX lossage: threads are created detached by default
- # and the JOINABLE attribute has a nonstandard name (UNDETACHED).
- AC_MSG_CHECKING([for joinable pthread attribute])
- AC_TRY_LINK([#include <pthread.h>],
- [int attr=PTHREAD_CREATE_JOINABLE;],
- ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
- if test x"$ok" = xunknown; then
- AC_TRY_LINK([#include <pthread.h>],
- [int attr=PTHREAD_CREATE_UNDETACHED;],
- ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
- fi
- if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
- AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
- [Define to the necessary symbol if this constant
- uses a non-standard name on your system.])
- fi
- AC_MSG_RESULT(${ok})
- if test x"$ok" = xunknown; then
- AC_MSG_WARN([we do not know how to create joinable pthreads])
- fi
-
- AC_MSG_CHECKING([if more special flags are required for pthreads])
- flag=no
- case "${host_cpu}-${host_os}" in
- *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
- *solaris* | alpha*-osf*) flag="-D_REENTRANT";;
- esac
- AC_MSG_RESULT(${flag})
- if test "x$flag" != xno; then
- PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
- fi
-
- LIBS="$save_LIBS"
- CFLAGS="$save_CFLAGS"
-
- # More AIX lossage: must compile with cc_r
- AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
-else
- PTHREAD_CC="$CC"
-fi
-
-AC_SUBST(PTHREAD_LIBS)
-AC_SUBST(PTHREAD_CFLAGS)
-AC_SUBST(PTHREAD_CC)
-
-# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
-if test x"$acx_pthread_ok" = xyes; then
- ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
- :
-else
- acx_pthread_ok=no
- $2
-fi
-AC_LANG_RESTORE
-])dnl ACX_PTHREAD
-
-
-
-
-
-# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
-# -----------------------------------------------------------
-# If this macro is not defined by Autoconf, define it here.
-m4_ifdef([AC_PROVIDE_IFELSE],
- [],
- [m4_define([AC_PROVIDE_IFELSE],
- [m4_ifdef([AC_PROVIDE_$1],
- [$2], [$3])])])
-
-
-# AC_PROG_LIBTOOL
-# ---------------
-AC_DEFUN([AC_PROG_LIBTOOL],
-[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
-dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
-dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
- AC_PROVIDE_IFELSE([AC_PROG_CXX],
- [AC_LIBTOOL_CXX],
- [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
- ])])
-dnl And a similar setup for Fortran 77 support
- AC_PROVIDE_IFELSE([AC_PROG_F77],
- [AC_LIBTOOL_F77],
- [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
-])])
-
-dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
-dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
-dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
- AC_PROVIDE_IFELSE([AC_PROG_GCJ],
- [AC_LIBTOOL_GCJ],
- [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
- [AC_LIBTOOL_GCJ],
- [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
- [AC_LIBTOOL_GCJ],
- [ifdef([AC_PROG_GCJ],
- [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
- ifdef([A][M_PROG_GCJ],
- [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
- ifdef([LT_AC_PROG_GCJ],
- [define([LT_AC_PROG_GCJ],
- defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
-])])# AC_PROG_LIBTOOL
-
-
-# _AC_PROG_LIBTOOL
-# ----------------
-AC_DEFUN([_AC_PROG_LIBTOOL],
-[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
-AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
-AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
-AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
-
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
-
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-AC_SUBST(LIBTOOL)dnl
-
-# Prevent multiple expansion
-define([AC_PROG_LIBTOOL], [])
-])# _AC_PROG_LIBTOOL
-
-
-# AC_LIBTOOL_SETUP
-# ----------------
-AC_DEFUN([AC_LIBTOOL_SETUP],
-[AC_PREREQ(2.50)dnl
-AC_REQUIRE([AC_ENABLE_SHARED])dnl
-AC_REQUIRE([AC_ENABLE_STATIC])dnl
-AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_LD])dnl
-AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
-AC_REQUIRE([AC_PROG_NM])dnl
-
-AC_REQUIRE([AC_PROG_LN_S])dnl
-AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
-# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
-AC_REQUIRE([AC_OBJEXT])dnl
-AC_REQUIRE([AC_EXEEXT])dnl
-dnl
-
-AC_LIBTOOL_SYS_MAX_CMD_LEN
-AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
-AC_LIBTOOL_OBJDIR
-
-AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
-_LT_AC_PROG_ECHO_BACKSLASH
-
-case $host_os in
-aix3*)
- # AIX sometimes has problems with the GCC collect2 program. For some
- # reason, if we set the COLLECT_NAMES environment variable, the problems
- # vanish in a puff of smoke.
- if test "X${COLLECT_NAMES+set}" != Xset; then
- COLLECT_NAMES=
- export COLLECT_NAMES
- fi
- ;;
-esac
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='sed -e 1s/^X//'
-[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
-
-# Same as above, but do not quote variable references.
-[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
-# Constants:
-rm="rm -f"
-
-# Global variables:
-default_ofile=libtool
-can_build_shared=yes
-
-# All known linkers require a `.a' archive for static linking (except MSVC,
-# which needs '.lib').
-libext=a
-ltmain="$ac_aux_dir/ltmain.sh"
-ofile="$default_ofile"
-with_gnu_ld="$lt_cv_prog_gnu_ld"
-
-AC_CHECK_TOOL(AR, ar, false)
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-AC_CHECK_TOOL(STRIP, strip, :)
-
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
-
-# Set sane defaults for various variables
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
-test -z "$AS" && AS=as
-test -z "$CC" && CC=cc
-test -z "$LTCC" && LTCC=$CC
-test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-test -z "$LD" && LD=ld
-test -z "$LN_S" && LN_S="ln -s"
-test -z "$MAGIC_CMD" && MAGIC_CMD=file
-test -z "$NM" && NM=nm
-test -z "$SED" && SED=sed
-test -z "$OBJDUMP" && OBJDUMP=objdump
-test -z "$RANLIB" && RANLIB=:
-test -z "$STRIP" && STRIP=:
-test -z "$ac_objext" && ac_objext=o
-
-# Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs'
-old_postinstall_cmds='chmod 644 $oldlib'
-old_postuninstall_cmds=
-
-if test -n "$RANLIB"; then
- case $host_os in
- openbsd*)
- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
- ;;
- *)
- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
- ;;
- esac
- old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
-fi
-
-_LT_CC_BASENAME([$compiler])
-
-# Only perform the check for file, if the check method requires it
-case $deplibs_check_method in
-file_magic*)
- if test "$file_magic_cmd" = '$MAGIC_CMD'; then
- AC_PATH_MAGIC
- fi
- ;;
-esac
-
-AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
-AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
-enable_win32_dll=yes, enable_win32_dll=no)
-
-AC_ARG_ENABLE([libtool-lock],
- [AC_HELP_STRING([--disable-libtool-lock],
- [avoid locking (might break parallel builds)])])
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
-
-AC_ARG_WITH([pic],
- [AC_HELP_STRING([--with-pic],
- [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
- [pic_mode="$withval"],
- [pic_mode=default])
-test -z "$pic_mode" && pic_mode=default
-
-# Use C for the default configuration in the libtool script
-tagname=
-AC_LIBTOOL_LANG_C_CONFIG
-_LT_AC_TAGCONFIG
-])# AC_LIBTOOL_SETUP
-
-
-# _LT_AC_SYS_COMPILER
-# -------------------
-AC_DEFUN([_LT_AC_SYS_COMPILER],
-[AC_REQUIRE([AC_PROG_CC])dnl
-
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
-
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
-
-# Allow CC to be a program name with arguments.
-compiler=$CC
-])# _LT_AC_SYS_COMPILER
-
-
-# _LT_CC_BASENAME(CC)
-# -------------------
-# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
-AC_DEFUN([_LT_CC_BASENAME],
-[for cc_temp in $1""; do
- case $cc_temp in
- compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
- distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
- \-*) ;;
- *) break;;
- esac
-done
-cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
-])
-
-
-# _LT_COMPILER_BOILERPLATE
-# ------------------------
-# Check for compiler boilerplate output or warnings with
-# the simple compiler test code.
-AC_DEFUN([_LT_COMPILER_BOILERPLATE],
-[ac_outfile=conftest.$ac_objext
-printf "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$rm conftest*
-])# _LT_COMPILER_BOILERPLATE
-
-
-# _LT_LINKER_BOILERPLATE
-# ----------------------
-# Check for linker boilerplate output or warnings with
-# the simple link test code.
-AC_DEFUN([_LT_LINKER_BOILERPLATE],
-[ac_outfile=conftest.$ac_objext
-printf "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$rm conftest*
-])# _LT_LINKER_BOILERPLATE
-
-
-# _LT_AC_SYS_LIBPATH_AIX
-# ----------------------
-# Links a minimal program and checks the executable
-# for the system default hardcoded library path. In most cases,
-# this is /usr/lib:/lib, but when the MPI compilers are used
-# the location of the communication and MPI libs are included too.
-# If we don't find anything, use the default library path according
-# to the aix ld manual.
-AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
-[AC_LINK_IFELSE(AC_LANG_PROGRAM,[
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
-}'`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
-}'`; fi],[])
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
-])# _LT_AC_SYS_LIBPATH_AIX
-
-
-# _LT_AC_SHELL_INIT(ARG)
-# ----------------------
-AC_DEFUN([_LT_AC_SHELL_INIT],
-[ifdef([AC_DIVERSION_NOTICE],
- [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
- [AC_DIVERT_PUSH(NOTICE)])
-$1
-AC_DIVERT_POP
-])# _LT_AC_SHELL_INIT
-
-
-# _LT_AC_PROG_ECHO_BACKSLASH
-# --------------------------
-# Add some code to the start of the generated configure script which
-# will find an echo command which doesn't interpret backslashes.
-AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
-[_LT_AC_SHELL_INIT([
-# Check that we are running under the correct shell.
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-case X$ECHO in
-X*--fallback-echo)
- # Remove one level of quotation (which was required for Make).
- ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
- ;;
-esac
-
-echo=${ECHO-echo}
-if test "X[$]1" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
-elif test "X[$]1" = X--fallback-echo; then
- # Avoid inline document here, it may be left over
- :
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
- # Yippee, $echo works!
- :
-else
- # Restart under the correct shell.
- exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
-fi
-
-if test "X[$]1" = X--fallback-echo; then
- # used as fallback echo
- shift
- cat <<EOF
-[$]*
-EOF
- exit 0
-fi
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$ECHO"; then
-if test "X${echo_test_string+set}" != Xset; then
-# find a string as large as possible, as long as the shell can cope with it
- for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
- # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
- if (echo_test_string=`eval $cmd`) 2>/dev/null &&
- echo_test_string=`eval $cmd` &&
- (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
- then
- break
- fi
- done
-fi
-
-if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
- echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- :
-else
- # The Solaris, AIX, and Digital Unix default echo programs unquote
- # backslashes. This makes it impossible to quote backslashes using
- # echo "$something" | sed 's/\\/\\\\/g'
- #
- # So, first we look for a working echo in the user's PATH.
-
- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
- for dir in $PATH /usr/ucb; do
- IFS="$lt_save_ifs"
- if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
- test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
- echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- echo="$dir/echo"
- break
- fi
- done
- IFS="$lt_save_ifs"
-
- if test "X$echo" = Xecho; then
- # We didn't find a better echo, so look for alternatives.
- if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
- echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- # This shell has a builtin print -r that does the trick.
- echo='print -r'
- elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
- test "X$CONFIG_SHELL" != X/bin/ksh; then
- # If we have ksh, try running configure again with it.
- ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
- export ORIGINAL_CONFIG_SHELL
- CONFIG_SHELL=/bin/ksh
- export CONFIG_SHELL
- exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
- else
- # Try using printf.
- echo='printf %s\n'
- if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
- echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- # Cool, printf works
- :
- elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
- test "X$echo_testing_string" = 'X\t' &&
- echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
- export CONFIG_SHELL
- SHELL="$CONFIG_SHELL"
- export SHELL
- echo="$CONFIG_SHELL [$]0 --fallback-echo"
- elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
- test "X$echo_testing_string" = 'X\t' &&
- echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
- test "X$echo_testing_string" = "X$echo_test_string"; then
- echo="$CONFIG_SHELL [$]0 --fallback-echo"
- else
- # maybe with a smaller string...
- prev=:
-
- for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
- if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
- then
- break
- fi
- prev="$cmd"
- done
-
- if test "$prev" != 'sed 50q "[$]0"'; then
- echo_test_string=`eval $prev`
- export echo_test_string
- exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
- else
- # Oops. We lost completely, so just stick with echo.
- echo=echo
- fi
- fi
- fi
- fi
-fi
-fi
-
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-ECHO=$echo
-if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
- ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
-fi
-
-AC_SUBST(ECHO)
-])])# _LT_AC_PROG_ECHO_BACKSLASH
-
-
-# _LT_AC_LOCK
-# -----------
-AC_DEFUN([_LT_AC_LOCK],
-[AC_ARG_ENABLE([libtool-lock],
- [AC_HELP_STRING([--disable-libtool-lock],
- [avoid locking (might break parallel builds)])])
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
-
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case $host in
-ia64-*-hpux*)
- # Find out which ABI we are using.
- echo 'int i;' > conftest.$ac_ext
- if AC_TRY_EVAL(ac_compile); then
- case `/usr/bin/file conftest.$ac_objext` in
- *ELF-32*)
- HPUX_IA64_MODE="32"
- ;;
- *ELF-64*)
- HPUX_IA64_MODE="64"
- ;;
- esac
- fi
- rm -rf conftest*
- ;;
-*-*-irix6*)
- # Find out which ABI we are using.
- echo '[#]line __oline__ "configure"' > conftest.$ac_ext
- if AC_TRY_EVAL(ac_compile); then
- if test "$lt_cv_prog_gnu_ld" = yes; then
- case `/usr/bin/file conftest.$ac_objext` in
- *32-bit*)
- LD="${LD-ld} -melf32bsmip"
- ;;
- *N32*)
- LD="${LD-ld} -melf32bmipn32"
- ;;
- *64-bit*)
- LD="${LD-ld} -melf64bmip"
- ;;
- esac
- else
- case `/usr/bin/file conftest.$ac_objext` in
- *32-bit*)
- LD="${LD-ld} -32"
- ;;
- *N32*)
- LD="${LD-ld} -n32"
- ;;
- *64-bit*)
- LD="${LD-ld} -64"
- ;;
- esac
- fi
- fi
- rm -rf conftest*
- ;;
-
-x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*|s390*-*linux*|sparc*-*linux*)
- # Find out which ABI we are using.
- echo 'int i;' > conftest.$ac_ext
- if AC_TRY_EVAL(ac_compile); then
- case `/usr/bin/file conftest.o` in
- *32-bit*)
- case $host in
- x86_64-*linux*)
- LD="${LD-ld} -m elf_i386"
- ;;
- ppc64-*linux*|powerpc64-*linux*)
- LD="${LD-ld} -m elf32ppclinux"
- ;;
- s390x-*linux*)
- LD="${LD-ld} -m elf_s390"
- ;;
- sparc64-*linux*)
- LD="${LD-ld} -m elf32_sparc"
- ;;
- esac
- ;;
- *64-bit*)
- case $host in
- x86_64-*linux*)
- LD="${LD-ld} -m elf_x86_64"
- ;;
- ppc*-*linux*|powerpc*-*linux*)
- LD="${LD-ld} -m elf64ppc"
- ;;
- s390*-*linux*)
- LD="${LD-ld} -m elf64_s390"
- ;;
- sparc*-*linux*)
- LD="${LD-ld} -m elf64_sparc"
- ;;
- esac
- ;;
- esac
- fi
- rm -rf conftest*
- ;;
-
-*-*-sco3.2v5*)
- # On SCO OpenServer 5, we need -belf to get full-featured binaries.
- SAVE_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -belf"
- AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
- [AC_LANG_PUSH(C)
- AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
- AC_LANG_POP])
- if test x"$lt_cv_cc_needs_belf" != x"yes"; then
- # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
- CFLAGS="$SAVE_CFLAGS"
- fi
- ;;
-sparc*-*solaris*)
- # Find out which ABI we are using.
- echo 'int i;' > conftest.$ac_ext
- if AC_TRY_EVAL(ac_compile); then
- case `/usr/bin/file conftest.o` in
- *64-bit*)
- case $lt_cv_prog_gnu_ld in
- yes*) LD="${LD-ld} -m elf64_sparc" ;;
- *) LD="${LD-ld} -64" ;;
- esac
- ;;
- esac
- fi
- rm -rf conftest*
- ;;
-
-AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
-[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
- AC_CHECK_TOOL(DLLTOOL, dlltool, false)
- AC_CHECK_TOOL(AS, as, false)
- AC_CHECK_TOOL(OBJDUMP, objdump, false)
- ;;
- ])
-esac
-
-need_locks="$enable_libtool_lock"
-
-])# _LT_AC_LOCK
-
-
-# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
-# ----------------------------------------------------------------
-# Check whether the given compiler option works
-AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
-[AC_REQUIRE([LT_AC_PROG_SED])
-AC_CACHE_CHECK([$1], [$2],
- [$2=no
- ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
- printf "$lt_simple_compile_test_code" > conftest.$ac_ext
- lt_compiler_flag="$3"
- # Insert the option either (1) after the last *FLAGS variable, or
- # (2) before a word containing "conftest.", or (3) at the end.
- # Note that $ac_compile itself does not contain backslashes and begins
- # with a dollar sign (not a hyphen), so the echo should work correctly.
- # The option is referenced via a variable to avoid confusing sed.
- lt_compile=`echo "$ac_compile" | $SED \
- -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
- -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
- -e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
- (eval "$lt_compile" 2>conftest.err)
- ac_status=$?
- cat conftest.err >&AS_MESSAGE_LOG_FD
- echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
- if (exit $ac_status) && test -s "$ac_outfile"; then
- # The compiler can only warn and ignore the option if not recognized
- # So say no if there are warnings other than the usual output.
- $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
- $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
- if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
- $2=yes
- fi
- fi
- $rm conftest*
-])
-
-if test x"[$]$2" = xyes; then
- ifelse([$5], , :, [$5])
-else
- ifelse([$6], , :, [$6])
-fi
-])# AC_LIBTOOL_COMPILER_OPTION
-
-
-# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-# [ACTION-SUCCESS], [ACTION-FAILURE])
-# ------------------------------------------------------------
-# Check whether the given compiler option works
-AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
-[AC_CACHE_CHECK([$1], [$2],
- [$2=no
- save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $3"
- printf "$lt_simple_link_test_code" > conftest.$ac_ext
- if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
- # The linker can only warn and ignore the option if not recognized
- # So say no if there are warnings
- if test -s conftest.err; then
- # Append any errors to the config.log.
- cat conftest.err 1>&AS_MESSAGE_LOG_FD
- $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
- $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
- if diff conftest.exp conftest.er2 >/dev/null; then
- $2=yes
- fi
- else
- $2=yes
- fi
- fi
- $rm conftest*
- LDFLAGS="$save_LDFLAGS"
-])
-
-if test x"[$]$2" = xyes; then
- ifelse([$4], , :, [$4])
-else
- ifelse([$5], , :, [$5])
-fi
-])# AC_LIBTOOL_LINKER_OPTION
-
-
-# AC_LIBTOOL_SYS_MAX_CMD_LEN
-# --------------------------
-AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
-[# find the maximum length of command line arguments
-AC_MSG_CHECKING([the maximum length of command line arguments])
-AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
- i=0
- teststring="ABCD"
-
- case $build_os in
- msdosdjgpp*)
- # On DJGPP, this test can blow up pretty badly due to problems in libc
- # (any single argument exceeding 2000 bytes causes a buffer overrun
- # during glob expansion). Even if it were fixed, the result of this
- # check would be larger than it should be.
- lt_cv_sys_max_cmd_len=12288; # 12K is about right
- ;;
-
- gnu*)
- # Under GNU Hurd, this test is not required because there is
- # no limit to the length of command line arguments.
- # Libtool will interpret -1 as no limit whatsoever
- lt_cv_sys_max_cmd_len=-1;
- ;;
-
- cygwin* | mingw*)
- # On Win9x/ME, this test blows up -- it succeeds, but takes
- # about 5 minutes as the teststring grows exponentially.
- # Worse, since 9x/ME are not pre-emptively multitasking,
- # you end up with a "frozen" computer, even though with patience
- # the test eventually succeeds (with a max line length of 256k).
- # Instead, let's just punt: use the minimum linelength reported by
- # all of the supported platforms: 8192 (on NT/2K/XP).
- lt_cv_sys_max_cmd_len=8192;
- ;;
-
- amigaos*)
- # On AmigaOS with pdksh, this test takes hours, literally.
- # So we just punt and use a minimum line length of 8192.
- lt_cv_sys_max_cmd_len=8192;
- ;;
-
- netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
- # This has been around since 386BSD, at least. Likely further.
- if test -x /sbin/sysctl; then
- lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
- elif test -x /usr/sbin/sysctl; then
- lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
- else
- lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
- fi
- # And add a safety zone
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
- ;;
-
- interix*)
- # We know the value 262144 and hardcode it with a safety zone (like BSD)
- lt_cv_sys_max_cmd_len=196608
- ;;
-
- osf*)
- # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
- # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
- # nice to cause kernel panics so lets avoid the loop below.
- # First set a reasonable default.
- lt_cv_sys_max_cmd_len=16384
- #
- if test -x /sbin/sysconfig; then
- case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
- *1*) lt_cv_sys_max_cmd_len=-1 ;;
- esac
- fi
- ;;
- sco3.2v5*)
- lt_cv_sys_max_cmd_len=102400
- ;;
- sysv5* | sco5v6* | sysv4.2uw2*)
- kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
- if test -n "$kargmax"; then
- lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
- else
- lt_cv_sys_max_cmd_len=32768
- fi
- ;;
- *)
- # If test is not a shell built-in, we'll probably end up computing a
- # maximum length that is only half of the actual maximum length, but
- # we can't tell.
- SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
- while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
- = "XX$teststring") >/dev/null 2>&1 &&
- new_result=`expr "X$teststring" : ".*" 2>&1` &&
- lt_cv_sys_max_cmd_len=$new_result &&
- test $i != 17 # 1/2 MB should be enough
- do
- i=`expr $i + 1`
- teststring=$teststring$teststring
- done
- teststring=
- # Add a significant safety factor because C++ compilers can tack on massive
- # amounts of additional arguments before passing them to the linker.
- # It appears as though 1/2 is a usable value.
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
- ;;
- esac
-])
-if test -n $lt_cv_sys_max_cmd_len ; then
- AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
-else
- AC_MSG_RESULT(none)
-fi
-])# AC_LIBTOOL_SYS_MAX_CMD_LEN
-
-
-# _LT_AC_CHECK_DLFCN
-# ------------------
-AC_DEFUN([_LT_AC_CHECK_DLFCN],
-[AC_CHECK_HEADERS(dlfcn.h)dnl
-])# _LT_AC_CHECK_DLFCN
-
-
-# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
-# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
-# ---------------------------------------------------------------------
-AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
-[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
-if test "$cross_compiling" = yes; then :
- [$4]
-else
- lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
- lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<EOF
-[#line __oline__ "configure"
-#include "confdefs.h"
-
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <stdio.h>
-
-#ifdef RTLD_GLOBAL
-# define LT_DLGLOBAL RTLD_GLOBAL
-#else
-# ifdef DL_GLOBAL
-# define LT_DLGLOBAL DL_GLOBAL
-# else
-# define LT_DLGLOBAL 0
-# endif
-#endif
-
-/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
- find out it does not work in some platform. */
-#ifndef LT_DLLAZY_OR_NOW
-# ifdef RTLD_LAZY
-# define LT_DLLAZY_OR_NOW RTLD_LAZY
-# else
-# ifdef DL_LAZY
-# define LT_DLLAZY_OR_NOW DL_LAZY
-# else
-# ifdef RTLD_NOW
-# define LT_DLLAZY_OR_NOW RTLD_NOW
-# else
-# ifdef DL_NOW
-# define LT_DLLAZY_OR_NOW DL_NOW
-# else
-# define LT_DLLAZY_OR_NOW 0
-# endif
-# endif
-# endif
-# endif
-#endif
-
-#ifdef __cplusplus
-extern "C" void exit (int);
-#endif
-
-void fnord() { int i=42;}
-int main ()
-{
- void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
- int status = $lt_dlunknown;
-
- if (self)
- {
- if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
- else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
- /* dlclose (self); */
- }
- else
- puts (dlerror ());
-
- exit (status);
-}]
-EOF
- if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
- (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
- lt_status=$?
- case x$lt_status in
- x$lt_dlno_uscore) $1 ;;
- x$lt_dlneed_uscore) $2 ;;
- x$lt_dlunknown|x*) $3 ;;
- esac
- else :
- # compilation failed
- $3
- fi
-fi
-rm -fr conftest*
-])# _LT_AC_TRY_DLOPEN_SELF
-
-
-# AC_LIBTOOL_DLOPEN_SELF
-# ----------------------
-AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
-[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
-if test "x$enable_dlopen" != xyes; then
- enable_dlopen=unknown
- enable_dlopen_self=unknown
- enable_dlopen_self_static=unknown
-else
- lt_cv_dlopen=no
- lt_cv_dlopen_libs=
-
- case $host_os in
- beos*)
- lt_cv_dlopen="load_add_on"
- lt_cv_dlopen_libs=
- lt_cv_dlopen_self=yes
- ;;
-
- mingw* | pw32*)
- lt_cv_dlopen="LoadLibrary"
- lt_cv_dlopen_libs=
- ;;
-
- cygwin*)
- lt_cv_dlopen="dlopen"
- lt_cv_dlopen_libs=
- ;;
-
- darwin*)
- # if libdl is installed we need to link against it
- AC_CHECK_LIB([dl], [dlopen],
- [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
- lt_cv_dlopen="dyld"
- lt_cv_dlopen_libs=
- lt_cv_dlopen_self=yes
- ])
- ;;
-
- *)
- AC_CHECK_FUNC([shl_load],
- [lt_cv_dlopen="shl_load"],
- [AC_CHECK_LIB([dld], [shl_load],
- [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
- [AC_CHECK_FUNC([dlopen],
- [lt_cv_dlopen="dlopen"],
- [AC_CHECK_LIB([dl], [dlopen],
- [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
- [AC_CHECK_LIB([svld], [dlopen],
- [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
- [AC_CHECK_LIB([dld], [dld_link],
- [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
- ])
- ])
- ])
- ])
- ])
- ;;
- esac
-
- if test "x$lt_cv_dlopen" != xno; then
- enable_dlopen=yes
- else
- enable_dlopen=no
- fi
-
- case $lt_cv_dlopen in
- dlopen)
- save_CPPFLAGS="$CPPFLAGS"
- test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
-
- save_LDFLAGS="$LDFLAGS"
- wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
-
- save_LIBS="$LIBS"
- LIBS="$lt_cv_dlopen_libs $LIBS"
-
- AC_CACHE_CHECK([whether a program can dlopen itself],
- lt_cv_dlopen_self, [dnl
- _LT_AC_TRY_DLOPEN_SELF(
- lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
- lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
- ])
-
- if test "x$lt_cv_dlopen_self" = xyes; then
- wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
- AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
- lt_cv_dlopen_self_static, [dnl
- _LT_AC_TRY_DLOPEN_SELF(
- lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
- lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
- ])
- fi
-
- CPPFLAGS="$save_CPPFLAGS"
- LDFLAGS="$save_LDFLAGS"
- LIBS="$save_LIBS"
- DLOPEN_LIBS="$lt_cv_dlopen_libs"
- ;;
- esac
-
- case $lt_cv_dlopen_self in
- yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
- *) enable_dlopen_self=unknown ;;
- esac
-
- case $lt_cv_dlopen_self_static in
- yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
- *) enable_dlopen_self_static=unknown ;;
- esac
-fi
-])# AC_LIBTOOL_DLOPEN_SELF
-
-
-# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
-# ---------------------------------
-# Check to see if options -c and -o are simultaneously supported by compiler
-AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
-[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
-AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
- [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
- [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
- $rm -r conftest 2>/dev/null
- mkdir conftest
- cd conftest
- mkdir out
- printf "$lt_simple_compile_test_code" > conftest.$ac_ext
-
- lt_compiler_flag="-o out/conftest2.$ac_objext"
- # Insert the option either (1) after the last *FLAGS variable, or
- # (2) before a word containing "conftest.", or (3) at the end.
- # Note that $ac_compile itself does not contain backslashes and begins
- # with a dollar sign (not a hyphen), so the echo should work correctly.
- lt_compile=`echo "$ac_compile" | $SED \
- -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
- -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
- -e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
- (eval "$lt_compile" 2>out/conftest.err)
- ac_status=$?
- cat out/conftest.err >&AS_MESSAGE_LOG_FD
- echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
- if (exit $ac_status) && test -s out/conftest2.$ac_objext
- then
- # The compiler can only warn and ignore the option if not recognized
- # So say no if there are warnings
- $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
- $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
- if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
- _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
- fi
- fi
- chmod u+w . 2>&AS_MESSAGE_LOG_FD
- $rm conftest*
- # SGI C++ compiler will create directory out/ii_files/ for
- # template instantiation
- test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
- $rm out/* && rmdir out
- cd ..
- rmdir conftest
- $rm conftest*
-])
-])# AC_LIBTOOL_PROG_CC_C_O
-
-
-# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
-# -----------------------------------------
-# Check to see if we can do hard links to lock some files if needed
-AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
-[AC_REQUIRE([_LT_AC_LOCK])dnl
-
-hard_links="nottested"
-if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
- # do not overwrite the value of need_locks provided by the user
- AC_MSG_CHECKING([if we can lock with hard links])
- hard_links=yes
- $rm conftest*
- ln conftest.a conftest.b 2>/dev/null && hard_links=no
- touch conftest.a
- ln conftest.a conftest.b 2>&5 || hard_links=no
- ln conftest.a conftest.b 2>/dev/null && hard_links=no
- AC_MSG_RESULT([$hard_links])
- if test "$hard_links" = no; then
- AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
- need_locks=warn
- fi
-else
- need_locks=no
-fi
-])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
-
-
-# AC_LIBTOOL_OBJDIR
-# -----------------
-AC_DEFUN([AC_LIBTOOL_OBJDIR],
-[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
-[rm -f .libs 2>/dev/null
-mkdir .libs 2>/dev/null
-if test -d .libs; then
- lt_cv_objdir=.libs
-else
- # MS-DOS does not allow filenames that begin with a dot.
- lt_cv_objdir=_libs
-fi
-rmdir .libs 2>/dev/null])
-objdir=$lt_cv_objdir
-])# AC_LIBTOOL_OBJDIR
-
-
-# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
-# ----------------------------------------------
-# Check hardcoding attributes.
-AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
-[AC_MSG_CHECKING([how to hardcode library paths into programs])
-_LT_AC_TAGVAR(hardcode_action, $1)=
-if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
- test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
- test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
-
- # We can hardcode non-existant directories.
- if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
- # If the only mechanism to avoid hardcoding is shlibpath_var, we
- # have to relink, otherwise we might link with an installed library
- # when we should be linking with a yet-to-be-installed one
- ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
- test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
- # Linking always hardcodes the temporary library directory.
- _LT_AC_TAGVAR(hardcode_action, $1)=relink
- else
- # We can link without hardcoding, and we can hardcode nonexisting dirs.
- _LT_AC_TAGVAR(hardcode_action, $1)=immediate
- fi
-else
- # We cannot hardcode anything, or else we can only hardcode existing
- # directories.
- _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
-fi
-AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
-
-if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
- # Fast installation is not supported
- enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
- test "$enable_shared" = no; then
- # Fast installation is not necessary
- enable_fast_install=needless
-fi
-])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
-
-
-# AC_LIBTOOL_SYS_LIB_STRIP
-# ------------------------
-AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
-[striplib=
-old_striplib=
-AC_MSG_CHECKING([whether stripping libraries is possible])
-if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
- test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
- test -z "$striplib" && striplib="$STRIP --strip-unneeded"
- AC_MSG_RESULT([yes])
-else
-# FIXME - insert some real tests, host_os isn't really good enough
- case $host_os in
- darwin*)
- if test -n "$STRIP" ; then
- striplib="$STRIP -x"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
-fi
- ;;
- *)
- AC_MSG_RESULT([no])
- ;;
- esac
-fi
-])# AC_LIBTOOL_SYS_LIB_STRIP
-
-
-# AC_LIBTOOL_SYS_DYNAMIC_LINKER
-# -----------------------------
-# PORTME Fill in your ld.so characteristics
-AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
-[AC_MSG_CHECKING([dynamic linker characteristics])
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-shrext_cmds=".so"
-postinstall_cmds=
-postuninstall_cmds=
-finish_cmds=
-finish_eval=
-shlibpath_var=
-shlibpath_overrides_runpath=unknown
-version_type=none
-dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib"
-if test "$GCC" = yes; then
- sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
- if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
- # if the path contains ";" then we assume it to be the separator
- # otherwise default to the standard path separator (i.e. ":") - it is
- # assumed that no part of a normal pathname contains ";" but that should
- # okay in the real world where ";" in dirpaths is itself problematic.
- sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
- else
- sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
- fi
-else
- sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-fi
-need_lib_prefix=unknown
-hardcode_into_libs=no
-
-# when you set need_version to no, make sure it does not cause -set_version
-# flags to be left without arguments
-need_version=unknown
-
-case $host_os in
-aix3*)
- version_type=linux
- library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
- shlibpath_var=LIBPATH
-
- # AIX 3 has no versioning support, so we append a major version to the name.
- soname_spec='${libname}${release}${shared_ext}$major'
- ;;
-
-aix4* | aix5*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- hardcode_into_libs=yes
- if test "$host_cpu" = ia64; then
- # AIX 5 supports IA64
- library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
- shlibpath_var=LD_LIBRARY_PATH
- else
- # With GCC up to 2.95.x, collect2 would create an import file
- # for dependence libraries. The import file would start with
- # the line `#! .'. This would cause the generated library to
- # depend on `.', always an invalid library. This was fixed in
- # development snapshots of GCC prior to 3.0.
- case $host_os in
- aix4 | aix4.[[01]] | aix4.[[01]].*)
- if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
- echo ' yes '
- echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
- :
- else
- can_build_shared=no
- fi
- ;;
- esac
- # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
- # soname into executable. Probably we can add versioning support to
- # collect2, so additional links can be useful in future.
- if test "$aix_use_runtimelinking" = yes; then
- # If using run time linking (on AIX 4.2 or later) use lib<name>.so
- # instead of lib<name>.a to let people know that these are not
- # typical AIX shared libraries.
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
- else
- # We preserve .a as extension for shared libraries through AIX4.2
- # and later when we are not doing run time linking.
- library_names_spec='${libname}${release}.a $libname.a'
- soname_spec='${libname}${release}${shared_ext}$major'
- fi
- shlibpath_var=LIBPATH
- fi
- ;;
-
-amigaos*)
- library_names_spec='$libname.ixlibrary $libname.a'
- # Create ${libname}_ixlibrary.a entries in /sys/libs.
- finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
- ;;
-
-beos*)
- library_names_spec='${libname}${shared_ext}'
- dynamic_linker="$host_os ld.so"
- shlibpath_var=LIBRARY_PATH
- ;;
-
-bsdi[[45]]*)
- version_type=linux
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
- sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
- # the default ld.so.conf also contains /usr/contrib/lib and
- # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
- # libtool to hard-code these into programs
- ;;
-
-cygwin* | mingw* | pw32*)
- version_type=windows
- shrext_cmds=".dll"
- need_version=no
- need_lib_prefix=no
-
- case $GCC,$host_os in
- yes,cygwin* | yes,mingw* | yes,pw32*)
- library_names_spec='$libname.dll.a'
- # DLL is installed to $(libdir)/../bin by postinstall_cmds
- postinstall_cmds='base_file=`basename \${file}`~
- dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
- dldir=$destdir/`dirname \$dlpath`~
- test -d \$dldir || mkdir -p \$dldir~
- $install_prog $dir/$dlname \$dldir/$dlname~
- chmod a+x \$dldir/$dlname'
- postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
- dlpath=$dir/\$dldll~
- $rm \$dlpath'
- shlibpath_overrides_runpath=yes
-
- case $host_os in
- cygwin*)
- # Cygwin DLLs use 'cyg' prefix rather than 'lib'
- soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
- sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
- ;;
- mingw*)
- # MinGW DLLs use traditional 'lib' prefix
- soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
- sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
- if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
- # It is most probably a Windows format PATH printed by
- # mingw gcc, but we are running on Cygwin. Gcc prints its search
- # path with ; separators, and with drive letters. We can handle the
- # drive letters (cygwin fileutils understands them), so leave them,
- # especially as we might pass files found there to a mingw objdump,
- # which wouldn't understand a cygwinified path. Ahh.
- sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
- else
- sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
- fi
- ;;
- pw32*)
- # pw32 DLLs use 'pw' prefix rather than 'lib'
- library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
- ;;
- esac
- ;;
-
- *)
- library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
- ;;
- esac
- dynamic_linker='Win32 ld.exe'
- # FIXME: first we should search . and the directory the executable is in
- shlibpath_var=PATH
- ;;
-
-darwin* | rhapsody*)
- dynamic_linker="$host_os dyld"
- version_type=darwin
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext ${libname}${release}${versuffix}$shared_ext'
- soname_spec='${libname}${release}${major}$shared_ext'
- shlibpath_overrides_runpath=yes
- shlibpath_var=DYLD_LIBRARY_PATH
- shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
- # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
- if test "$GCC" = yes; then
- sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
- else
- sys_lib_search_path_spec='/lib /usr/lib /usr/local/lib'
- fi
- sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
- ;;
-
-dgux*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-freebsd1*)
- dynamic_linker=no
- ;;
-
-kfreebsd*-gnu)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- dynamic_linker='GNU ld.so'
- ;;
-
-freebsd* | dragonfly*)
- # DragonFly does not have aout. When/if they implement a new
- # versioning mechanism, adjust this.
- if test -x /usr/bin/objformat; then
- objformat=`/usr/bin/objformat`
- else
- case $host_os in
- freebsd[[123]]*) objformat=aout ;;
- *) objformat=elf ;;
- esac
- fi
- version_type=freebsd-$objformat
- case $version_type in
- freebsd-elf*)
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
- need_version=no
- need_lib_prefix=no
- ;;
- freebsd-*)
- library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
- need_version=yes
- ;;
- esac
- shlibpath_var=LD_LIBRARY_PATH
- case $host_os in
- freebsd2*)
- shlibpath_overrides_runpath=yes
- ;;
- freebsd3.[[01]]* | freebsdelf3.[[01]]*)
- shlibpath_overrides_runpath=yes
- hardcode_into_libs=yes
- ;;
- freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
- freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- ;;
- freebsd*) # from 4.6 on
- shlibpath_overrides_runpath=yes
- hardcode_into_libs=yes
- ;;
- esac
- ;;
-
-gnu*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- hardcode_into_libs=yes
- ;;
-
-hpux9* | hpux10* | hpux11*)
- # Give a soname corresponding to the major version so that dld.sl refuses to
- # link against other versions.
- version_type=sunos
- need_lib_prefix=no
- need_version=no
- case $host_cpu in
- ia64*)
- shrext_cmds='.so'
- hardcode_into_libs=yes
- dynamic_linker="$host_os dld.so"
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- if test "X$HPUX_IA64_MODE" = X32; then
- sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
- else
- sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
- fi
- sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
- ;;
- hppa*64*)
- shrext_cmds='.sl'
- hardcode_into_libs=yes
- dynamic_linker="$host_os dld.sl"
- shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
- shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
- sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
- ;;
- *)
- shrext_cmds='.sl'
- dynamic_linker="$host_os dld.sl"
- shlibpath_var=SHLIB_PATH
- shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- ;;
- esac
- # HP-UX runs *really* slowly unless shared libraries are mode 555.
- postinstall_cmds='chmod 555 $lib'
- ;;
-
-interix3*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- ;;
-
-irix5* | irix6* | nonstopux*)
- case $host_os in
- nonstopux*) version_type=nonstopux ;;
- *)
- if test "$lt_cv_prog_gnu_ld" = yes; then
- version_type=linux
- else
- version_type=irix
- fi ;;
- esac
- need_lib_prefix=no
- need_version=no
- soname_spec='${libname}${release}${shared_ext}$major'
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
- case $host_os in
- irix5* | nonstopux*)
- libsuff= shlibsuff=
- ;;
- *)
- case $LD in # libtool.m4 will add one of these switches to LD
- *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
- libsuff= shlibsuff= libmagic=32-bit;;
- *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
- libsuff=32 shlibsuff=N32 libmagic=N32;;
- *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
- libsuff=64 shlibsuff=64 libmagic=64-bit;;
- *) libsuff= shlibsuff= libmagic=never-match;;
- esac
- ;;
- esac
- shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
- shlibpath_overrides_runpath=no
- sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
- sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
- hardcode_into_libs=yes
- ;;
-
-# No shared lib support for Linux oldld, aout, or coff.
-linux*oldld* | linux*aout* | linux*coff*)
- dynamic_linker=no
- ;;
-
-# This must be Linux ELF.
-linux*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=no
- # This implies no fast_install, which is unacceptable.
- # Some rework will be needed to allow for fast_install
- # before this can be enabled.
- hardcode_into_libs=yes
-
- # Append ld.so.conf contents to the search path
- if test -f /etc/ld.so.conf; then
- lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
- sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
- fi
-
- # We used to test for /lib/ld.so.1 and disable shared libraries on
- # powerpc, because MkLinux only supported shared libraries with the
- # GNU dynamic linker. Since this was broken with cross compilers,
- # most powerpc-linux boxes support dynamic linking these days and
- # people can always --disable-shared, the test was removed, and we
- # assume the GNU/Linux dynamic linker is in use.
- dynamic_linker='GNU/Linux ld.so'
- ;;
-
-knetbsd*-gnu)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- dynamic_linker='GNU ld.so'
- ;;
-
-netbsd*)
- version_type=sunos
- need_lib_prefix=no
- need_version=no
- if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
- finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
- dynamic_linker='NetBSD (a.out) ld.so'
- else
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- dynamic_linker='NetBSD ld.elf_so'
- fi
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=yes
- hardcode_into_libs=yes
- ;;
-
-newsos6)
- version_type=linux
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=yes
- ;;
-
-nto-qnx*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=yes
- ;;
-
-openbsd*)
- version_type=sunos
- sys_lib_dlsearch_path_spec="/usr/lib"
- need_lib_prefix=no
- # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
- case $host_os in
- openbsd3.3 | openbsd3.3.*) need_version=yes ;;
- *) need_version=no ;;
- esac
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
- finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
- case $host_os in
- openbsd2.[[89]] | openbsd2.[[89]].*)
- shlibpath_overrides_runpath=no
- ;;
- *)
- shlibpath_overrides_runpath=yes
- ;;
- esac
- else
- shlibpath_overrides_runpath=yes
- fi
- ;;
-
-os2*)
- libname_spec='$name'
- shrext_cmds=".dll"
- need_lib_prefix=no
- library_names_spec='$libname${shared_ext} $libname.a'
- dynamic_linker='OS/2 ld.exe'
- shlibpath_var=LIBPATH
- ;;
-
-osf3* | osf4* | osf5*)
- version_type=osf
- need_lib_prefix=no
- need_version=no
- soname_spec='${libname}${release}${shared_ext}$major'
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
- shlibpath_var=LD_LIBRARY_PATH
- sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
- sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
- ;;
-
-solaris*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=yes
- hardcode_into_libs=yes
- # ldd complains unless libraries are executable
- postinstall_cmds='chmod +x $lib'
- ;;
-
-sunos4*)
- version_type=sunos
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
- finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=yes
- if test "$with_gnu_ld" = yes; then
- need_lib_prefix=no
- fi
- need_version=yes
- ;;
-
-sysv4 | sysv4.3*)
- version_type=linux
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- case $host_vendor in
- sni)
- shlibpath_overrides_runpath=no
- need_lib_prefix=no
- export_dynamic_flag_spec='${wl}-Blargedynsym'
- runpath_var=LD_RUN_PATH
- ;;
- siemens)
- need_lib_prefix=no
- ;;
- motorola)
- need_lib_prefix=no
- need_version=no
- shlibpath_overrides_runpath=no
- sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
- ;;
- esac
- ;;
-
-sysv4*MP*)
- if test -d /usr/nec ;then
- version_type=linux
- library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
- soname_spec='$libname${shared_ext}.$major'
- shlibpath_var=LD_LIBRARY_PATH
- fi
- ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
- version_type=freebsd-elf
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- hardcode_into_libs=yes
- if test "$with_gnu_ld" = yes; then
- sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
- shlibpath_overrides_runpath=no
- else
- sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
- shlibpath_overrides_runpath=yes
- case $host_os in
- sco3.2v5*)
- sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
- ;;
- esac
- fi
- sys_lib_dlsearch_path_spec='/usr/lib'
- ;;
-
-uts4*)
- version_type=linux
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- ;;
-
-*)
- dynamic_linker=no
- ;;
-esac
-AC_MSG_RESULT([$dynamic_linker])
-test "$dynamic_linker" = no && can_build_shared=no
-
-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
- variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
-fi
-])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
-
-
-# _LT_AC_TAGCONFIG
-# ----------------
-AC_DEFUN([_LT_AC_TAGCONFIG],
-[AC_ARG_WITH([tags],
- [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
- [include additional configurations @<:@automatic@:>@])],
- [tagnames="$withval"])
-
-if test -f "$ltmain" && test -n "$tagnames"; then
- if test ! -f "${ofile}"; then
- AC_MSG_WARN([output file `$ofile' does not exist])
- fi
-
- if test -z "$LTCC"; then
- eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
- if test -z "$LTCC"; then
- AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
- else
- AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
- fi
- fi
- if test -z "$LTCFLAGS"; then
- eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
- fi
-
- # Extract list of available tagged configurations in $ofile.
- # Note that this assumes the entire list is on one line.
- available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
-
- lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
- for tagname in $tagnames; do
- IFS="$lt_save_ifs"
- # Check whether tagname contains only valid characters
- case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
- "") ;;
- *) AC_MSG_ERROR([invalid tag name: $tagname])
- ;;
- esac
-
- if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
- then
- AC_MSG_ERROR([tag name \"$tagname\" already exists])
- fi
-
- # Update the list of available tags.
- if test -n "$tagname"; then
- echo appending configuration tag \"$tagname\" to $ofile
-
- case $tagname in
- CXX)
- if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
- ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
- (test "X$CXX" != "Xg++"))) ; then
- AC_LIBTOOL_LANG_CXX_CONFIG
- else
- tagname=""
- fi
- ;;
-
- F77)
- if test -n "$F77" && test "X$F77" != "Xno"; then
- AC_LIBTOOL_LANG_F77_CONFIG
- else
- tagname=""
- fi
- ;;
-
- GCJ)
- if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
- AC_LIBTOOL_LANG_GCJ_CONFIG
- else
- tagname=""
- fi
- ;;
-
- RC)
- AC_LIBTOOL_LANG_RC_CONFIG
- ;;
-
- *)
- AC_MSG_ERROR([Unsupported tag name: $tagname])
- ;;
- esac
-
- # Append the new tag name to the list of available tags.
- if test -n "$tagname" ; then
- available_tags="$available_tags $tagname"
- fi
- fi
- done
- IFS="$lt_save_ifs"
-
- # Now substitute the updated list of available tags.
- if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
- mv "${ofile}T" "$ofile"
- chmod +x "$ofile"
- else
- rm -f "${ofile}T"
- AC_MSG_ERROR([unable to update list of available tagged configurations.])
- fi
-fi
-])# _LT_AC_TAGCONFIG
-
-
-# AC_LIBTOOL_DLOPEN
-# -----------------
-# enable checks for dlopen support
-AC_DEFUN([AC_LIBTOOL_DLOPEN],
- [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
-])# AC_LIBTOOL_DLOPEN
-
-
-# AC_LIBTOOL_WIN32_DLL
-# --------------------
-# declare package support for building win32 DLLs
-AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
-[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
-])# AC_LIBTOOL_WIN32_DLL
-
-
-# AC_ENABLE_SHARED([DEFAULT])
-# ---------------------------
-# implement the --enable-shared flag
-# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
-AC_DEFUN([AC_ENABLE_SHARED],
-[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE([shared],
- [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
- [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
- [p=${PACKAGE-default}
- case $enableval in
- yes) enable_shared=yes ;;
- no) enable_shared=no ;;
- *)
- enable_shared=no
- # Look at the argument we got. We use all the common list separators.
- lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
- for pkg in $enableval; do
- IFS="$lt_save_ifs"
- if test "X$pkg" = "X$p"; then
- enable_shared=yes
- fi
- done
- IFS="$lt_save_ifs"
- ;;
- esac],
- [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
-])# AC_ENABLE_SHARED
-
-
-# AC_DISABLE_SHARED
-# -----------------
-# set the default shared flag to --disable-shared
-AC_DEFUN([AC_DISABLE_SHARED],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_SHARED(no)
-])# AC_DISABLE_SHARED
-
-
-# AC_ENABLE_STATIC([DEFAULT])
-# ---------------------------
-# implement the --enable-static flag
-# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
-AC_DEFUN([AC_ENABLE_STATIC],
-[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE([static],
- [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
- [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
- [p=${PACKAGE-default}
- case $enableval in
- yes) enable_static=yes ;;
- no) enable_static=no ;;
- *)
- enable_static=no
- # Look at the argument we got. We use all the common list separators.
- lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
- for pkg in $enableval; do
- IFS="$lt_save_ifs"
- if test "X$pkg" = "X$p"; then
- enable_static=yes
- fi
- done
- IFS="$lt_save_ifs"
- ;;
- esac],
- [enable_static=]AC_ENABLE_STATIC_DEFAULT)
-])# AC_ENABLE_STATIC
-
-
-# AC_DISABLE_STATIC
-# -----------------
-# set the default static flag to --disable-static
-AC_DEFUN([AC_DISABLE_STATIC],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_STATIC(no)
-])# AC_DISABLE_STATIC
-
-
-# AC_ENABLE_FAST_INSTALL([DEFAULT])
-# ---------------------------------
-# implement the --enable-fast-install flag
-# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
-AC_DEFUN([AC_ENABLE_FAST_INSTALL],
-[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE([fast-install],
- [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
- [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
- [p=${PACKAGE-default}
- case $enableval in
- yes) enable_fast_install=yes ;;
- no) enable_fast_install=no ;;
- *)
- enable_fast_install=no
- # Look at the argument we got. We use all the common list separators.
- lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
- for pkg in $enableval; do
- IFS="$lt_save_ifs"
- if test "X$pkg" = "X$p"; then
- enable_fast_install=yes
- fi
- done
- IFS="$lt_save_ifs"
- ;;
- esac],
- [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
-])# AC_ENABLE_FAST_INSTALL
-
-
-# AC_DISABLE_FAST_INSTALL
-# -----------------------
-# set the default to --disable-fast-install
-AC_DEFUN([AC_DISABLE_FAST_INSTALL],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_FAST_INSTALL(no)
-])# AC_DISABLE_FAST_INSTALL
-
-
-# AC_LIBTOOL_PICMODE([MODE])
-# --------------------------
-# implement the --with-pic flag
-# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
-AC_DEFUN([AC_LIBTOOL_PICMODE],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-pic_mode=ifelse($#,1,$1,default)
-])# AC_LIBTOOL_PICMODE
-
-
-# AC_PROG_EGREP
-# -------------
-# This is predefined starting with Autoconf 2.54, so this conditional
-# definition can be removed once we require Autoconf 2.54 or later.
-m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
-[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
- [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
- then ac_cv_prog_egrep='grep -E'
- else ac_cv_prog_egrep='egrep'
- fi])
- EGREP=$ac_cv_prog_egrep
- AC_SUBST([EGREP])
-])])
-
-
-# AC_PATH_TOOL_PREFIX
-# -------------------
-# find a file program which can recognise shared library
-AC_DEFUN([AC_PATH_TOOL_PREFIX],
-[AC_REQUIRE([AC_PROG_EGREP])dnl
-AC_MSG_CHECKING([for $1])
-AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
-[case $MAGIC_CMD in
-[[\\/*] | ?:[\\/]*])
- lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
- ;;
-*)
- lt_save_MAGIC_CMD="$MAGIC_CMD"
- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-dnl $ac_dummy forces splitting on constant user-supplied paths.
-dnl POSIX.2 word splitting is done only on the output of word expansions,
-dnl not every word. This closes a longstanding sh security hole.
- ac_dummy="ifelse([$2], , $PATH, [$2])"
- for ac_dir in $ac_dummy; do
- IFS="$lt_save_ifs"
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$1; then
- lt_cv_path_MAGIC_CMD="$ac_dir/$1"
- if test -n "$file_magic_test_file"; then
- case $deplibs_check_method in
- "file_magic "*)
- file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
- MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
- if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
- $EGREP "$file_magic_regex" > /dev/null; then
- :
- else
- cat <<EOF 1>&2
-
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such. This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem. Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool@gnu.org
-
-EOF
- fi ;;
- esac
- fi
- break
- fi
- done
- IFS="$lt_save_ifs"
- MAGIC_CMD="$lt_save_MAGIC_CMD"
- ;;
-esac])
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
- AC_MSG_RESULT($MAGIC_CMD)
-else
- AC_MSG_RESULT(no)
-fi
-])# AC_PATH_TOOL_PREFIX
-
-
-# AC_PATH_MAGIC
-# -------------
-# find a file program which can recognise a shared library
-AC_DEFUN([AC_PATH_MAGIC],
-[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
-if test -z "$lt_cv_path_MAGIC_CMD"; then
- if test -n "$ac_tool_prefix"; then
- AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
- else
- MAGIC_CMD=:
- fi
-fi
-])# AC_PATH_MAGIC
-
-
-# AC_PROG_LD
-# ----------
-# find the pathname to the GNU or non-GNU linker
-AC_DEFUN([AC_PROG_LD],
-[AC_ARG_WITH([gnu-ld],
- [AC_HELP_STRING([--with-gnu-ld],
- [assume the C compiler uses GNU ld @<:@default=no@:>@])],
- [test "$withval" = no || with_gnu_ld=yes],
- [with_gnu_ld=no])
-AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-ac_prog=ld
-if test "$GCC" = yes; then
- # Check if gcc -print-prog-name=ld gives a path.
- AC_MSG_CHECKING([for ld used by $CC])
- case $host in
- *-*-mingw*)
- # gcc leaves a trailing carriage return which upsets mingw
- ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
- *)
- ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
- esac
- case $ac_prog in
- # Accept absolute paths.
- [[\\/]]* | ?:[[\\/]]*)
- re_direlt='/[[^/]][[^/]]*/\.\./'
- # Canonicalize the pathname of ld
- ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
- while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
- done
- test -z "$LD" && LD="$ac_prog"
- ;;
- "")
- # If it fails, then pretend we aren't using GCC.
- ac_prog=ld
- ;;
- *)
- # If it is relative, then search for the first ld in PATH.
- with_gnu_ld=unknown
- ;;
- esac
-elif test "$with_gnu_ld" = yes; then
- AC_MSG_CHECKING([for GNU ld])
-else
- AC_MSG_CHECKING([for non-GNU ld])
-fi
-AC_CACHE_VAL(lt_cv_path_LD,
-[if test -z "$LD"; then
- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
- for ac_dir in $PATH; do
- IFS="$lt_save_ifs"
- test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
- lt_cv_path_LD="$ac_dir/$ac_prog"
- # Check to see if the program is GNU ld. I'd rather use --version,
- # but apparently some variants of GNU ld only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
- *GNU* | *'with BFD'*)
- test "$with_gnu_ld" != no && break
- ;;
- *)
- test "$with_gnu_ld" != yes && break
- ;;
- esac
- fi
- done
- IFS="$lt_save_ifs"
-else
- lt_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
- AC_MSG_RESULT($LD)
-else
- AC_MSG_RESULT(no)
-fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-AC_PROG_LD_GNU
-])# AC_PROG_LD
-
-
-# AC_PROG_LD_GNU
-# --------------
-AC_DEFUN([AC_PROG_LD_GNU],
-[AC_REQUIRE([AC_PROG_EGREP])dnl
-AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
-[# I'd rather use --version here, but apparently some GNU lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
- lt_cv_prog_gnu_ld=yes
- ;;
-*)
- lt_cv_prog_gnu_ld=no
- ;;
-esac])
-with_gnu_ld=$lt_cv_prog_gnu_ld
-])# AC_PROG_LD_GNU
-
-
-# AC_PROG_LD_RELOAD_FLAG
-# ----------------------
-# find reload flag for linker
-# -- PORTME Some linkers may need a different reload flag.
-AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
-[AC_CACHE_CHECK([for $LD option to reload object files],
- lt_cv_ld_reload_flag,
- [lt_cv_ld_reload_flag='-r'])
-reload_flag=$lt_cv_ld_reload_flag
-case $reload_flag in
-"" | " "*) ;;
-*) reload_flag=" $reload_flag" ;;
-esac
-reload_cmds='$LD$reload_flag -o $output$reload_objs'
-case $host_os in
- darwin*)
- if test "$GCC" = yes; then
- reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
- else
- reload_cmds='$LD$reload_flag -o $output$reload_objs'
- fi
- ;;
-esac
-])# AC_PROG_LD_RELOAD_FLAG
-
-
-# AC_DEPLIBS_CHECK_METHOD
-# -----------------------
-# how to check for library dependencies
-# -- PORTME fill in with the dynamic library characteristics
-AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
-[AC_CACHE_CHECK([how to recognise dependent libraries],
-lt_cv_deplibs_check_method,
-[lt_cv_file_magic_cmd='$MAGIC_CMD'
-lt_cv_file_magic_test_file=
-lt_cv_deplibs_check_method='unknown'
-# Need to set the preceding variable on all platforms that support
-# interlibrary dependencies.
-# 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
-# 'pass_all' -- all dependencies passed with no checks.
-# 'test_compile' -- check by making test program.
-# 'file_magic [[regex]]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given extended regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
-
-case $host_os in
-aix4* | aix5*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-beos*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-bsdi[[45]]*)
- lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
- lt_cv_file_magic_cmd='/usr/bin/file -L'
- lt_cv_file_magic_test_file=/shlib/libc.so
- ;;
-
-cygwin*)
- # func_win32_libid is a shell function defined in ltmain.sh
- lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
- lt_cv_file_magic_cmd='func_win32_libid'
- ;;
-
-mingw* | pw32*)
- # Base MSYS/MinGW do not provide the 'file' command needed by
- # func_win32_libid shell function, so use a weaker test based on 'objdump'.
- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
- lt_cv_file_magic_cmd='$OBJDUMP -f'
- ;;
-
-darwin* | rhapsody*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-freebsd* | kfreebsd*-gnu | dragonfly*)
- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
- case $host_cpu in
- i*86 )
- # Not sure whether the presence of OpenBSD here was a mistake.
- # Let's accept both of them until this is cleared up.
- lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
- lt_cv_file_magic_cmd=/usr/bin/file
- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
- ;;
- esac
- else
- lt_cv_deplibs_check_method=pass_all
- fi
- ;;
-
-gnu*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-hpux10.20* | hpux11*)
- lt_cv_file_magic_cmd=/usr/bin/file
- case $host_cpu in
- ia64*)
- lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
- lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
- ;;
- hppa*64*)
- [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
- lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
- ;;
- *)
- lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
- lt_cv_file_magic_test_file=/usr/lib/libc.sl
- ;;
- esac
- ;;
-
-interix3*)
- # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
- lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
- ;;
-
-irix5* | irix6* | nonstopux*)
- case $LD in
- *-32|*"-32 ") libmagic=32-bit;;
- *-n32|*"-n32 ") libmagic=N32;;
- *-64|*"-64 ") libmagic=64-bit;;
- *) libmagic=never-match;;
- esac
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-# This must be Linux ELF.
-linux*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-netbsd*)
- if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
- lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
- else
- lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
- fi
- ;;
-
-newos6*)
- lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
- lt_cv_file_magic_cmd=/usr/bin/file
- lt_cv_file_magic_test_file=/usr/lib/libnls.so
- ;;
-
-nto-qnx*)
- lt_cv_deplibs_check_method=unknown
- ;;
-
-openbsd*)
- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
- lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
- else
- lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
- fi
- ;;
-
-osf3* | osf4* | osf5*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-solaris*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-sysv4 | sysv4.3*)
- case $host_vendor in
- motorola)
- lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
- lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
- ;;
- ncr)
- lt_cv_deplibs_check_method=pass_all
- ;;
- sequent)
- lt_cv_file_magic_cmd='/bin/file'
- lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
- ;;
- sni)
- lt_cv_file_magic_cmd='/bin/file'
- lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
- lt_cv_file_magic_test_file=/lib/libc.so
- ;;
- siemens)
- lt_cv_deplibs_check_method=pass_all
- ;;
- pc)
- lt_cv_deplibs_check_method=pass_all
- ;;
- esac
- ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-esac
-])
-file_magic_cmd=$lt_cv_file_magic_cmd
-deplibs_check_method=$lt_cv_deplibs_check_method
-test -z "$deplibs_check_method" && deplibs_check_method=unknown
-])# AC_DEPLIBS_CHECK_METHOD
-
-
-# AC_PROG_NM
-# ----------
-# find the pathname to a BSD-compatible name lister
-AC_DEFUN([AC_PROG_NM],
-[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
-[if test -n "$NM"; then
- # Let the user override the test.
- lt_cv_path_NM="$NM"
-else
- lt_nm_to_check="${ac_tool_prefix}nm"
- if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
- lt_nm_to_check="$lt_nm_to_check nm"
- fi
- for lt_tmp_nm in $lt_nm_to_check; do
- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
- for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
- IFS="$lt_save_ifs"
- test -z "$ac_dir" && ac_dir=.
- tmp_nm="$ac_dir/$lt_tmp_nm"
- if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
- # Check to see if the nm accepts a BSD-compat flag.
- # Adding the `sed 1q' prevents false positives on HP-UX, which says:
- # nm: unknown option "B" ignored
- # Tru64's nm complains that /dev/null is an invalid object file
- case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
- */dev/null* | *'Invalid file or object type'*)
- lt_cv_path_NM="$tmp_nm -B"
- break
- ;;
- *)
- case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
- */dev/null*)
- lt_cv_path_NM="$tmp_nm -p"
- break
- ;;
- *)
- lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
- continue # so that we can try to find one that supports BSD flags
- ;;
- esac
- ;;
- esac
- fi
- done
- IFS="$lt_save_ifs"
- done
- test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
-fi])
-NM="$lt_cv_path_NM"
-])# AC_PROG_NM
-
-
-# AC_CHECK_LIBM
-# -------------
-# check for math library
-AC_DEFUN([AC_CHECK_LIBM],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-LIBM=
-case $host in
-*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
- # These system don't have libm, or don't need it
- ;;
-*-ncr-sysv4.3*)
- AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
- AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
- ;;
-*)
- AC_CHECK_LIB(m, cos, LIBM="-lm")
- ;;
-esac
-])# AC_CHECK_LIBM
-
-
-# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
-# -----------------------------------
-# sets LIBLTDL to the link flags for the libltdl convenience library and
-# LTDLINCL to the include flags for the libltdl header and adds
-# --enable-ltdl-convenience to the configure arguments. Note that
-# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided,
-# it is assumed to be `libltdl'. LIBLTDL will be prefixed with
-# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
-# (note the single quotes!). If your package is not flat and you're not
-# using automake, define top_builddir and top_srcdir appropriately in
-# the Makefiles.
-AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
- case $enable_ltdl_convenience in
- no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
- "") enable_ltdl_convenience=yes
- ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
- esac
- LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
- LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
- # For backwards non-gettext consistent compatibility...
- INCLTDL="$LTDLINCL"
-])# AC_LIBLTDL_CONVENIENCE
-
-
-# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
-# -----------------------------------
-# sets LIBLTDL to the link flags for the libltdl installable library and
-# LTDLINCL to the include flags for the libltdl header and adds
-# --enable-ltdl-install to the configure arguments. Note that
-# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided,
-# and an installed libltdl is not found, it is assumed to be `libltdl'.
-# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
-# '${top_srcdir}/' (note the single quotes!). If your package is not
-# flat and you're not using automake, define top_builddir and top_srcdir
-# appropriately in the Makefiles.
-# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
-AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
- AC_CHECK_LIB(ltdl, lt_dlinit,
- [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
- [if test x"$enable_ltdl_install" = xno; then
- AC_MSG_WARN([libltdl not installed, but installation disabled])
- else
- enable_ltdl_install=yes
- fi
- ])
- if test x"$enable_ltdl_install" = x"yes"; then
- ac_configure_args="$ac_configure_args --enable-ltdl-install"
- LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
- LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
- else
- ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
- LIBLTDL="-lltdl"
- LTDLINCL=
- fi
- # For backwards non-gettext consistent compatibility...
- INCLTDL="$LTDLINCL"
-])# AC_LIBLTDL_INSTALLABLE
-
-
-# AC_LIBTOOL_CXX
-# --------------
-# enable support for C++ libraries
-AC_DEFUN([AC_LIBTOOL_CXX],
-[AC_REQUIRE([_LT_AC_LANG_CXX])
-])# AC_LIBTOOL_CXX
-
-
-# _LT_AC_LANG_CXX
-# ---------------
-AC_DEFUN([_LT_AC_LANG_CXX],
-[AC_REQUIRE([AC_PROG_CXX])
-AC_REQUIRE([_LT_AC_PROG_CXXCPP])
-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
-])# _LT_AC_LANG_CXX
-
-# _LT_AC_PROG_CXXCPP
-# ------------------
-AC_DEFUN([_LT_AC_PROG_CXXCPP],
-[
-AC_REQUIRE([AC_PROG_CXX])
-if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
- ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
- (test "X$CXX" != "Xg++"))) ; then
- AC_PROG_CXXCPP
-fi
-])# _LT_AC_PROG_CXXCPP
-
-# AC_LIBTOOL_F77
-# --------------
-# enable support for Fortran 77 libraries
-AC_DEFUN([AC_LIBTOOL_F77],
-[AC_REQUIRE([_LT_AC_LANG_F77])
-])# AC_LIBTOOL_F77
-
-
-# _LT_AC_LANG_F77
-# ---------------
-AC_DEFUN([_LT_AC_LANG_F77],
-[AC_REQUIRE([AC_PROG_F77])
-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
-])# _LT_AC_LANG_F77
-
-
-# AC_LIBTOOL_GCJ
-# --------------
-# enable support for GCJ libraries
-AC_DEFUN([AC_LIBTOOL_GCJ],
-[AC_REQUIRE([_LT_AC_LANG_GCJ])
-])# AC_LIBTOOL_GCJ
-
-
-# _LT_AC_LANG_GCJ
-# ---------------
-AC_DEFUN([_LT_AC_LANG_GCJ],
-[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
- [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
- [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
- [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
- [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
- [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
-])# _LT_AC_LANG_GCJ
-
-
-# AC_LIBTOOL_RC
-# -------------
-# enable support for Windows resource files
-AC_DEFUN([AC_LIBTOOL_RC],
-[AC_REQUIRE([LT_AC_PROG_RC])
-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
-])# AC_LIBTOOL_RC
-
-
-# AC_LIBTOOL_LANG_C_CONFIG
-# ------------------------
-# Ensure that the configuration vars for the C compiler are
-# suitably defined. Those variables are subsequently used by
-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
-AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
-AC_DEFUN([_LT_AC_LANG_C_CONFIG],
-[lt_save_CC="$CC"
-AC_LANG_PUSH(C)
-
-# Source file extension for C test sources.
-ac_ext=c
-
-# Object file extension for compiled C test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;\n"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}\n'
-
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-## CAVEAT EMPTOR:
-## There is no encapsulation within the following macros, do not change
-## the running order or otherwise move them around unless you know exactly
-## what you are doing...
-AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
-AC_LIBTOOL_PROG_COMPILER_PIC($1)
-AC_LIBTOOL_PROG_CC_C_O($1)
-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
-AC_LIBTOOL_PROG_LD_SHLIBS($1)
-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
-AC_LIBTOOL_SYS_LIB_STRIP
-AC_LIBTOOL_DLOPEN_SELF
-
-# Report which library types will actually be built
-AC_MSG_CHECKING([if libtool supports shared libraries])
-AC_MSG_RESULT([$can_build_shared])
-
-AC_MSG_CHECKING([whether to build shared libraries])
-test "$can_build_shared" = "no" && enable_shared=no
-
-# On AIX, shared libraries and static libraries use the same namespace, and
-# are all built from PIC.
-case $host_os in
-aix3*)
- test "$enable_shared" = yes && enable_static=no
- if test -n "$RANLIB"; then
- archive_cmds="$archive_cmds~\$RANLIB \$lib"
- postinstall_cmds='$RANLIB $lib'
- fi
- ;;
-
-aix4* | aix5*)
- if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
- test "$enable_shared" = yes && enable_static=no
- fi
- ;;
-esac
-AC_MSG_RESULT([$enable_shared])
-
-AC_MSG_CHECKING([whether to build static libraries])
-# Make sure either enable_shared or enable_static is yes.
-test "$enable_shared" = yes || enable_static=yes
-AC_MSG_RESULT([$enable_static])
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_POP
-CC="$lt_save_CC"
-])# AC_LIBTOOL_LANG_C_CONFIG
-
-
-# AC_LIBTOOL_LANG_CXX_CONFIG
-# --------------------------
-# Ensure that the configuration vars for the C compiler are
-# suitably defined. Those variables are subsequently used by
-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
-AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
-AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
-[AC_LANG_PUSH(C++)
-AC_REQUIRE([AC_PROG_CXX])
-AC_REQUIRE([_LT_AC_PROG_CXXCPP])
-
-_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_AC_TAGVAR(allow_undefined_flag, $1)=
-_LT_AC_TAGVAR(always_export_symbols, $1)=no
-_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
-_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_AC_TAGVAR(hardcode_direct, $1)=no
-_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
-_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
-_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-_LT_AC_TAGVAR(hardcode_automatic, $1)=no
-_LT_AC_TAGVAR(module_cmds, $1)=
-_LT_AC_TAGVAR(module_expsym_cmds, $1)=
-_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_AC_TAGVAR(no_undefined_flag, $1)=
-_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Dependencies to place before and after the object being linked:
-_LT_AC_TAGVAR(predep_objects, $1)=
-_LT_AC_TAGVAR(postdep_objects, $1)=
-_LT_AC_TAGVAR(predeps, $1)=
-_LT_AC_TAGVAR(postdeps, $1)=
-_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
-
-# Source file extension for C++ test sources.
-ac_ext=cpp
-
-# Object file extension for compiled C++ test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;\n"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }\n'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC=$CC
-lt_save_LD=$LD
-lt_save_GCC=$GCC
-GCC=$GXX
-lt_save_with_gnu_ld=$with_gnu_ld
-lt_save_path_LD=$lt_cv_path_LD
-if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
- lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
-else
- $as_unset lt_cv_prog_gnu_ld
-fi
-if test -n "${lt_cv_path_LDCXX+set}"; then
- lt_cv_path_LD=$lt_cv_path_LDCXX
-else
- $as_unset lt_cv_path_LD
-fi
-test -z "${LDCXX+set}" || LD=$LDCXX
-CC=${CXX-"c++"}
-compiler=$CC
-_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-
-# We don't want -fno-exception wen compiling C++ code, so set the
-# no_builtin_flag separately
-if test "$GXX" = yes; then
- _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
-else
- _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
-fi
-
-if test "$GXX" = yes; then
- # Set up default GNU C++ configuration
-
- AC_PROG_LD
-
- # Check if GNU C++ uses GNU ld as the underlying linker, since the
- # archiving commands below assume that GNU ld is being used.
- if test "$with_gnu_ld" = yes; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-
- # If archive_cmds runs LD, not CC, wlarc should be empty
- # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
- # investigate it a little bit more. (MM)
- wlarc='${wl}'
-
- # ancient GNU ld didn't support --whole-archive et. al.
- if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
- grep 'no-whole-archive' > /dev/null; then
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
- else
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
- fi
- else
- with_gnu_ld=no
- wlarc=
-
- # A generic and very simple default shared library creation
- # command for GNU C++ for the case where it uses the native
- # linker, instead of GNU ld. If possible, this setting should
- # overridden to take advantage of the native linker features on
- # the platform it is being used on.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
- fi
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
-
-else
- GXX=no
- with_gnu_ld=no
- wlarc=
-fi
-
-# PORTME: fill in a description of your system's C++ link characteristics
-AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
-_LT_AC_TAGVAR(ld_shlibs, $1)=yes
-case $host_os in
- aix3*)
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- aix4* | aix5*)
- if test "$host_cpu" = ia64; then
- # On IA64, the linker does run time linking by default, so we don't
- # have to do anything special.
- aix_use_runtimelinking=no
- exp_sym_flag='-Bexport'
- no_entry_flag=""
- else
- aix_use_runtimelinking=no
-
- # Test if we are trying to use run time linking or normal
- # AIX style linking. If -brtl is somewhere in LDFLAGS, we
- # need to do runtime linking.
- case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
- for ld_flag in $LDFLAGS; do
- case $ld_flag in
- *-brtl*)
- aix_use_runtimelinking=yes
- break
- ;;
- esac
- done
- ;;
- esac
-
- exp_sym_flag='-bexport'
- no_entry_flag='-bnoentry'
- fi
-
- # When large executables or shared objects are built, AIX ld can
- # have problems creating the table of contents. If linking a library
- # or program results in "error TOC overflow" add -mminimal-toc to
- # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
- # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
-
- _LT_AC_TAGVAR(archive_cmds, $1)=''
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-
- if test "$GXX" = yes; then
- case $host_os in aix4.[[012]]|aix4.[[012]].*)
- # We only want to do this on AIX 4.2 and lower, the check
- # below for broken collect2 doesn't work under 4.3+
- collect2name=`${CC} -print-prog-name=collect2`
- if test -f "$collect2name" && \
- strings "$collect2name" | grep resolve_lib_name >/dev/null
- then
- # We have reworked collect2
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- else
- # We have old collect2
- _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
- # It fails to find uninstalled libraries when the uninstalled
- # path is not listed in the libpath. Setting hardcode_minus_L
- # to unsupported forces relinking
- _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
- fi
- ;;
- esac
- shared_flag='-shared'
- if test "$aix_use_runtimelinking" = yes; then
- shared_flag="$shared_flag "'${wl}-G'
- fi
- else
- # not using gcc
- if test "$host_cpu" = ia64; then
- # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
- # chokes on -Wl,-G. The following line is correct:
- shared_flag='-G'
- else
- if test "$aix_use_runtimelinking" = yes; then
- shared_flag='${wl}-G'
- else
- shared_flag='${wl}-bM:SRE'
- fi
- fi
- fi
-
- # It seems that -bexpall does not export symbols beginning with
- # underscore (_), so it is better to generate a list of symbols to export.
- _LT_AC_TAGVAR(always_export_symbols, $1)=yes
- if test "$aix_use_runtimelinking" = yes; then
- # Warning - without using the other runtime loading flags (-brtl),
- # -berok will link without error, but may produce a broken library.
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
- # Determine the default libpath from the value encoded in an empty executable.
- _LT_AC_SYS_LIBPATH_AIX
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
- else
- if test "$host_cpu" = ia64; then
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
- _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
- else
- # Determine the default libpath from the value encoded in an empty executable.
- _LT_AC_SYS_LIBPATH_AIX
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
- # Warning - without using the other run time loading flags,
- # -berok will link without error, but may produce a broken library.
- _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
- # Exported symbols can be pulled into shared objects from archives
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
- # This is similar to how AIX traditionally builds its shared libraries.
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
- fi
- fi
- ;;
-
- beos*)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
- # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
- # support --undefined. This deserves some investigation. FIXME
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
-
- chorus*)
- case $cc_basename in
- *)
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- esac
- ;;
-
- cygwin* | mingw* | pw32*)
- # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
- # as there is no search path for DLLs.
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_AC_TAGVAR(always_export_symbols, $1)=no
- _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-
- if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
- # If the export-symbols file already is a .def file (1st line
- # is EXPORTS), use it as is; otherwise, prepend...
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
- cp $export_symbols $output_objdir/$soname.def;
- else
- echo EXPORTS > $output_objdir/$soname.def;
- cat $export_symbols >> $output_objdir/$soname.def;
- fi~
- $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- darwin* | rhapsody*)
- case $host_os in
- rhapsody* | darwin1.[[012]])
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
- ;;
- *) # Darwin 1.3 on
- if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
- else
- case ${MACOSX_DEPLOYMENT_TARGET} in
- 10.[[012]])
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
- ;;
- 10.*)
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
- ;;
- esac
- fi
- ;;
- esac
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-
- if test "$GXX" = yes ; then
- lt_int_apple_cc_single_mod=no
- output_verbose_link_cmd='echo'
- if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
- lt_int_apple_cc_single_mod=yes
- fi
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- fi
- _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
- if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- else
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- fi
- _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- else
- case $cc_basename in
- xlc*)
- output_verbose_link_cmd='echo'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
- _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- ;;
- *)
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- esac
- fi
- ;;
-
- dgux*)
- case $cc_basename in
- ec++*)
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- ghcx*)
- # Green Hills C++ Compiler
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- *)
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- esac
- ;;
- freebsd[[12]]*)
- # C++ shared libraries reported to be fairly broken before switch to ELF
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- freebsd-elf*)
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- ;;
- freebsd* | kfreebsd*-gnu | dragonfly*)
- # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
- # conventions
- _LT_AC_TAGVAR(ld_shlibs, $1)=yes
- ;;
- gnu*)
- ;;
- hpux9*)
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
- # but as the default
- # location of the library.
-
- case $cc_basename in
- CC*)
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- aCC*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
- ;;
- *)
- if test "$GXX" = yes; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
- else
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- esac
- ;;
- hpux10*|hpux11*)
- if test $with_gnu_ld = no; then
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
- case $host_cpu in
- hppa*64*|ia64*)
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
- ;;
- *)
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- ;;
- esac
- fi
- case $host_cpu in
- hppa*64*|ia64*)
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
- *)
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
- # but as the default
- # location of the library.
- ;;
- esac
-
- case $cc_basename in
- CC*)
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- aCC*)
- case $host_cpu in
- hppa*64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- ia64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- *)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- esac
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
- ;;
- *)
- if test "$GXX" = yes; then
- if test $with_gnu_ld = no; then
- case $host_cpu in
- hppa*64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- ia64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- *)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- esac
- fi
- else
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- esac
- ;;
- interix3*)
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
- # Instead, shared libraries are loaded at an image base (0x10000000 by
- # default) and relocated if they conflict, which is a slow very memory
- # consuming and fragmenting process. To avoid this, we pick a random,
- # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
- # time. Moving up from 0x10000000 also allows more sbrk(2) space.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- ;;
- irix5* | irix6*)
- case $cc_basename in
- CC*)
- # SGI C++
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-
- # Archives containing C++ object files must be created using
- # "CC -ar", where "CC" is the IRIX C++ compiler. This is
- # necessary to make sure instantiated templates are included
- # in the archive.
- _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
- ;;
- *)
- if test "$GXX" = yes; then
- if test "$with_gnu_ld" = no; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
- fi
- fi
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- ;;
- esac
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
- ;;
- linux*)
- case $cc_basename in
- KCC*)
- # Kuck and Associates, Inc. (KAI) C++ Compiler
-
- # KCC will only create a shared library if the output file
- # ends with ".so" (or ".sl" for HP-UX), so rename the library
- # to its proper name (with version) after linking.
- _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-
- # Archives containing C++ object files must be created using
- # "CC -Bstatic", where "CC" is the KAI C++ compiler.
- _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
- ;;
- icpc*)
- # Intel C++
- with_gnu_ld=yes
- # version 8.0 and above of icpc choke on multiply defined symbols
- # if we add $predep_objects and $postdep_objects, however 7.1 and
- # earlier do not add the objects themselves.
- case `$CC -V 2>&1` in
- *"Version 7."*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
- ;;
- *) # Version 8.0 or newer
- tmp_idyn=
- case $host_cpu in
- ia64*) tmp_idyn=' -i_dynamic';;
- esac
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
- ;;
- esac
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
- ;;
- pgCC*)
- # Portland Group C++ compiler
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
-
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
- ;;
- cxx*)
- # Compaq C++
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
-
- runpath_var=LD_RUN_PATH
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
- ;;
- esac
- ;;
- lynxos*)
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- m88k*)
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- mvs*)
- case $cc_basename in
- cxx*)
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- *)
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- esac
- ;;
- netbsd*)
- if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
- wlarc=
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- fi
- # Workaround some broken pre-1.5 toolchains
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
- ;;
- openbsd2*)
- # C++ shared libraries are fairly broken
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- openbsd*)
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
- fi
- output_verbose_link_cmd='echo'
- ;;
- osf3*)
- case $cc_basename in
- KCC*)
- # Kuck and Associates, Inc. (KAI) C++ Compiler
-
- # KCC will only create a shared library if the output file
- # ends with ".so" (or ".sl" for HP-UX), so rename the library
- # to its proper name (with version) after linking.
- _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
- # Archives containing C++ object files must be created using
- # "CC -Bstatic", where "CC" is the KAI C++ compiler.
- _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
-
- ;;
- RCC*)
- # Rational C++ 2.4.1
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- cxx*)
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
- ;;
- *)
- if test "$GXX" = yes && test "$with_gnu_ld" = no; then
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
-
- else
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- esac
- ;;
- osf4* | osf5*)
- case $cc_basename in
- KCC*)
- # Kuck and Associates, Inc. (KAI) C++ Compiler
-
- # KCC will only create a shared library if the output file
- # ends with ".so" (or ".sl" for HP-UX), so rename the library
- # to its proper name (with version) after linking.
- _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
- # Archives containing C++ object files must be created using
- # the KAI C++ compiler.
- _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
- ;;
- RCC*)
- # Rational C++ 2.4.1
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- cxx*)
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
- echo "-hidden">> $lib.exp~
- $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~
- $rm $lib.exp'
-
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
- ;;
- *)
- if test "$GXX" = yes && test "$with_gnu_ld" = no; then
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
-
- else
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- esac
- ;;
- psos*)
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- sunos4*)
- case $cc_basename in
- CC*)
- # Sun C++ 4.x
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- lcc*)
- # Lucid
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- *)
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- esac
- ;;
- solaris*)
- case $cc_basename in
- CC*)
- # Sun C++ 4.2, 5.x and Centerline C++
- _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes
- _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
- $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
-
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- case $host_os in
- solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
- *)
- # The C++ compiler is used as linker so we must use $wl
- # flag to pass the commands to the underlying system
- # linker. We must also pass each convience library through
- # to the system linker between allextract/defaultextract.
- # The C++ compiler will combine linker options so we
- # cannot just pass the convience library names through
- # without $wl.
- # Supported since Solaris 2.6 (maybe 2.5.1?)
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract'
- ;;
- esac
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-
- output_verbose_link_cmd='echo'
-
- # Archives containing C++ object files must be created using
- # "CC -xar", where "CC" is the Sun C++ compiler. This is
- # necessary to make sure instantiated templates are included
- # in the archive.
- _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
- ;;
- gcx*)
- # Green Hills C++ Compiler
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-
- # The C++ compiler must be used to create the archive.
- _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
- ;;
- *)
- # GNU C++ compiler with Solaris linker
- if test "$GXX" = yes && test "$with_gnu_ld" = no; then
- _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
- if $CC --version | grep -v '^2\.7' > /dev/null; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
- $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
- else
- # g++ 2.7 appears to require `-G' NOT `-shared' on this
- # platform.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
- $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
- fi
-
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
- fi
- ;;
- esac
- ;;
- sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
- _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- runpath_var='LD_RUN_PATH'
-
- case $cc_basename in
- CC*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
- ;;
- sysv5* | sco3.2v5* | sco5v6*)
- # Note: We can NOT use -z defs as we might desire, because we do not
- # link with -lc, and that would cause any symbols used from libc to
- # always be unresolved, which means just about no library would
- # ever link correctly. If we're not using GNU ld we use -z text
- # though, which does catch some bad symbols but isn't as heavy-handed
- # as -z defs.
- # For security reasons, it is highly recommended that you always
- # use absolute paths for naming shared libraries, and exclude the
- # DT_RUNPATH tag from executables and libraries. But doing so
- # requires that you compile everything twice, which is a pain.
- # So that behaviour is only enabled if SCOABSPATH is set to a
- # non-empty value in the environment. Most likely only useful for
- # creating official distributions of packages.
- # This is a hack until libtool officially supports absolute path
- # names for shared libraries.
- _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
- runpath_var='LD_RUN_PATH'
-
- case $cc_basename in
- CC*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
- ;;
- tandem*)
- case $cc_basename in
- NCC*)
- # NonStop-UX NCC 3.20
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- *)
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- esac
- ;;
- vxworks*)
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- *)
- # FIXME: insert proper C++ library support
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
-esac
-AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
-test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
-_LT_AC_TAGVAR(GCC, $1)="$GXX"
-_LT_AC_TAGVAR(LD, $1)="$LD"
-
-## CAVEAT EMPTOR:
-## There is no encapsulation within the following macros, do not change
-## the running order or otherwise move them around unless you know exactly
-## what you are doing...
-AC_LIBTOOL_POSTDEP_PREDEP($1)
-AC_LIBTOOL_PROG_COMPILER_PIC($1)
-AC_LIBTOOL_PROG_CC_C_O($1)
-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
-AC_LIBTOOL_PROG_LD_SHLIBS($1)
-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_POP
-CC=$lt_save_CC
-LDCXX=$LD
-LD=$lt_save_LD
-GCC=$lt_save_GCC
-with_gnu_ldcxx=$with_gnu_ld
-with_gnu_ld=$lt_save_with_gnu_ld
-lt_cv_path_LDCXX=$lt_cv_path_LD
-lt_cv_path_LD=$lt_save_path_LD
-lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
-lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
-])# AC_LIBTOOL_LANG_CXX_CONFIG
-
-# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
-# ------------------------------------
-# Figure out "hidden" library dependencies from verbose
-# compiler output when linking a shared library.
-# Parse the compiler output and extract the necessary
-# objects, libraries and library flags.
-AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
-dnl we can't use the lt_simple_compile_test_code here,
-dnl because it contains code intended for an executable,
-dnl not a library. It's possible we should let each
-dnl tag define a new lt_????_link_test_code variable,
-dnl but it's only used here...
-ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
-int a;
-void foo (void) { a = 0; }
-EOF
-],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
-class Foo
-{
-public:
- Foo (void) { a = 0; }
-private:
- int a;
-};
-EOF
-],[$1],[F77],[cat > conftest.$ac_ext <<EOF
- subroutine foo
- implicit none
- integer*4 a
- a=0
- return
- end
-EOF
-],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
-public class foo {
- private int a;
- public void bar (void) {
- a = 0;
- }
-};
-EOF
-])
-dnl Parse the compiler output and extract the necessary
-dnl objects, libraries and library flags.
-if AC_TRY_EVAL(ac_compile); then
- # Parse the compiler output and extract the necessary
- # objects, libraries and library flags.
-
- # Sentinel used to keep track of whether or not we are before
- # the conftest object file.
- pre_test_object_deps_done=no
-
- # The `*' in the case matches for architectures that use `case' in
- # $output_verbose_cmd can trigger glob expansion during the loop
- # eval without this substitution.
- output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
-
- for p in `eval $output_verbose_link_cmd`; do
- case $p in
-
- -L* | -R* | -l*)
- # Some compilers place space between "-{L,R}" and the path.
- # Remove the space.
- if test $p = "-L" \
- || test $p = "-R"; then
- prev=$p
- continue
- else
- prev=
- fi
-
- if test "$pre_test_object_deps_done" = no; then
- case $p in
- -L* | -R*)
- # Internal compiler library paths should come after those
- # provided the user. The postdeps already come after the
- # user supplied libs so there is no need to process them.
- if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
- _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
- else
- _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
- fi
- ;;
- # The "-l" case would never come before the object being
- # linked, so don't bother handling this case.
- esac
- else
- if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
- _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
- else
- _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
- fi
- fi
- ;;
-
- *.$objext)
- # This assumes that the test object file only shows up
- # once in the compiler output.
- if test "$p" = "conftest.$objext"; then
- pre_test_object_deps_done=yes
- continue
- fi
-
- if test "$pre_test_object_deps_done" = no; then
- if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
- _LT_AC_TAGVAR(predep_objects, $1)="$p"
- else
- _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
- fi
- else
- if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
- _LT_AC_TAGVAR(postdep_objects, $1)="$p"
- else
- _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
- fi
- fi
- ;;
-
- *) ;; # Ignore the rest.
-
- esac
- done
-
- # Clean up.
- rm -f a.out a.exe
-else
- echo "libtool.m4: error: problem compiling $1 test program"
-fi
-
-$rm -f confest.$objext
-
-# PORTME: override above test on systems where it is broken
-ifelse([$1],[CXX],
-[case $host_os in
-interix3*)
- # Interix 3.5 installs completely hosed .la files for C++, so rather than
- # hack all around it, let's just trust "g++" to DTRT.
- _LT_AC_TAGVAR(predep_objects,$1)=
- _LT_AC_TAGVAR(postdep_objects,$1)=
- _LT_AC_TAGVAR(postdeps,$1)=
- ;;
-
-solaris*)
- case $cc_basename in
- CC*)
- # Adding this requires a known-good setup of shared libraries for
- # Sun compiler versions before 5.6, else PIC objects from an old
- # archive will be linked into the output, leading to subtle bugs.
- _LT_AC_TAGVAR(postdeps,$1)='-lCstd -lCrun'
- ;;
- esac
- ;;
-esac
-])
-
-case " $_LT_AC_TAGVAR(postdeps, $1) " in
-*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
-esac
-])# AC_LIBTOOL_POSTDEP_PREDEP
-
-# AC_LIBTOOL_LANG_F77_CONFIG
-# --------------------------
-# Ensure that the configuration vars for the C compiler are
-# suitably defined. Those variables are subsequently used by
-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
-AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
-AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
-[AC_REQUIRE([AC_PROG_F77])
-AC_LANG_PUSH(Fortran 77)
-
-_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_AC_TAGVAR(allow_undefined_flag, $1)=
-_LT_AC_TAGVAR(always_export_symbols, $1)=no
-_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
-_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_AC_TAGVAR(hardcode_direct, $1)=no
-_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
-_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
-_LT_AC_TAGVAR(hardcode_automatic, $1)=no
-_LT_AC_TAGVAR(module_cmds, $1)=
-_LT_AC_TAGVAR(module_expsym_cmds, $1)=
-_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_AC_TAGVAR(no_undefined_flag, $1)=
-_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for f77 test sources.
-ac_ext=f
-
-# Object file extension for compiled f77 test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code=" subroutine t\n return\n end\n"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code=" program t\n end\n"
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-CC=${F77-"f77"}
-compiler=$CC
-_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-
-AC_MSG_CHECKING([if libtool supports shared libraries])
-AC_MSG_RESULT([$can_build_shared])
-
-AC_MSG_CHECKING([whether to build shared libraries])
-test "$can_build_shared" = "no" && enable_shared=no
-
-# On AIX, shared libraries and static libraries use the same namespace, and
-# are all built from PIC.
-case $host_os in
-aix3*)
- test "$enable_shared" = yes && enable_static=no
- if test -n "$RANLIB"; then
- archive_cmds="$archive_cmds~\$RANLIB \$lib"
- postinstall_cmds='$RANLIB $lib'
- fi
- ;;
-aix4* | aix5*)
- if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
- test "$enable_shared" = yes && enable_static=no
- fi
- ;;
-esac
-AC_MSG_RESULT([$enable_shared])
-
-AC_MSG_CHECKING([whether to build static libraries])
-# Make sure either enable_shared or enable_static is yes.
-test "$enable_shared" = yes || enable_static=yes
-AC_MSG_RESULT([$enable_static])
-
-_LT_AC_TAGVAR(GCC, $1)="$G77"
-_LT_AC_TAGVAR(LD, $1)="$LD"
-
-AC_LIBTOOL_PROG_COMPILER_PIC($1)
-AC_LIBTOOL_PROG_CC_C_O($1)
-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
-AC_LIBTOOL_PROG_LD_SHLIBS($1)
-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_POP
-CC="$lt_save_CC"
-])# AC_LIBTOOL_LANG_F77_CONFIG
-
-
-# AC_LIBTOOL_LANG_GCJ_CONFIG
-# --------------------------
-# Ensure that the configuration vars for the C compiler are
-# suitably defined. Those variables are subsequently used by
-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
-AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
-AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
-[AC_LANG_SAVE
-
-# Source file extension for Java test sources.
-ac_ext=java
-
-# Object file extension for compiled Java test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}\n"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }\n'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-CC=${GCJ-"gcj"}
-compiler=$CC
-_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-
-# GCJ did not exist at the time GCC didn't implicitly link libc in.
-_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-
-_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-
-## CAVEAT EMPTOR:
-## There is no encapsulation within the following macros, do not change
-## the running order or otherwise move them around unless you know exactly
-## what you are doing...
-AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
-AC_LIBTOOL_PROG_COMPILER_PIC($1)
-AC_LIBTOOL_PROG_CC_C_O($1)
-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
-AC_LIBTOOL_PROG_LD_SHLIBS($1)
-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_RESTORE
-CC="$lt_save_CC"
-])# AC_LIBTOOL_LANG_GCJ_CONFIG
-
-
-# AC_LIBTOOL_LANG_RC_CONFIG
-# -------------------------
-# Ensure that the configuration vars for the Windows resource compiler are
-# suitably defined. Those variables are subsequently used by
-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
-AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
-AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
-[AC_LANG_SAVE
-
-# Source file extension for RC test sources.
-ac_ext=rc
-
-# Object file extension for compiled RC test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }\n'
-
-# Code to be used in simple link tests
-lt_simple_link_test_code="$lt_simple_compile_test_code"
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-CC=${RC-"windres"}
-compiler=$CC
-_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_RESTORE
-CC="$lt_save_CC"
-])# AC_LIBTOOL_LANG_RC_CONFIG
-
-
-# AC_LIBTOOL_CONFIG([TAGNAME])
-# ----------------------------
-# If TAGNAME is not passed, then create an initial libtool script
-# with a default configuration from the untagged config vars. Otherwise
-# add code to config.status for appending the configuration named by
-# TAGNAME from the matching tagged config vars.
-AC_DEFUN([AC_LIBTOOL_CONFIG],
-[# The else clause should only fire when bootstrapping the
-# libtool distribution, otherwise you forgot to ship ltmain.sh
-# with your package, and you will get complaints that there are
-# no rules to generate ltmain.sh.
-if test -f "$ltmain"; then
- # See if we are running on zsh, and set the options which allow our commands through
- # without removal of \ escapes.
- if test -n "${ZSH_VERSION+set}" ; then
- setopt NO_GLOB_SUBST
- fi
- # Now quote all the things that may contain metacharacters while being
- # careful not to overquote the AC_SUBSTed values. We take copies of the
- # variables and quote the copies for generation of the libtool script.
- for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
- SED SHELL STRIP \
- libname_spec library_names_spec soname_spec extract_expsyms_cmds \
- old_striplib striplib file_magic_cmd finish_cmds finish_eval \
- deplibs_check_method reload_flag reload_cmds need_locks \
- lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
- lt_cv_sys_global_symbol_to_c_name_address \
- sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
- old_postinstall_cmds old_postuninstall_cmds \
- _LT_AC_TAGVAR(compiler, $1) \
- _LT_AC_TAGVAR(CC, $1) \
- _LT_AC_TAGVAR(LD, $1) \
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
- _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
- _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
- _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
- _LT_AC_TAGVAR(old_archive_cmds, $1) \
- _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
- _LT_AC_TAGVAR(predep_objects, $1) \
- _LT_AC_TAGVAR(postdep_objects, $1) \
- _LT_AC_TAGVAR(predeps, $1) \
- _LT_AC_TAGVAR(postdeps, $1) \
- _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
- _LT_AC_TAGVAR(archive_cmds, $1) \
- _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
- _LT_AC_TAGVAR(postinstall_cmds, $1) \
- _LT_AC_TAGVAR(postuninstall_cmds, $1) \
- _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
- _LT_AC_TAGVAR(allow_undefined_flag, $1) \
- _LT_AC_TAGVAR(no_undefined_flag, $1) \
- _LT_AC_TAGVAR(export_symbols_cmds, $1) \
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
- _LT_AC_TAGVAR(hardcode_automatic, $1) \
- _LT_AC_TAGVAR(module_cmds, $1) \
- _LT_AC_TAGVAR(module_expsym_cmds, $1) \
- _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
- _LT_AC_TAGVAR(exclude_expsyms, $1) \
- _LT_AC_TAGVAR(include_expsyms, $1); do
-
- case $var in
- _LT_AC_TAGVAR(old_archive_cmds, $1) | \
- _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
- _LT_AC_TAGVAR(archive_cmds, $1) | \
- _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
- _LT_AC_TAGVAR(module_cmds, $1) | \
- _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
- _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
- _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
- extract_expsyms_cmds | reload_cmds | finish_cmds | \
- postinstall_cmds | postuninstall_cmds | \
- old_postinstall_cmds | old_postuninstall_cmds | \
- sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
- # Double-quote double-evaled strings.
- eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
- ;;
- *)
- eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
- ;;
- esac
- done
-
- case $lt_echo in
- *'\[$]0 --fallback-echo"')
- lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
- ;;
- esac
-
-ifelse([$1], [],
- [cfgfile="${ofile}T"
- trap "$rm \"$cfgfile\"; exit 1" 1 2 15
- $rm -f "$cfgfile"
- AC_MSG_NOTICE([creating $ofile])],
- [cfgfile="$ofile"])
-
- cat <<__EOF__ >> "$cfgfile"
-ifelse([$1], [],
-[#! $SHELL
-
-# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001
-# Free Software Foundation, Inc.
-#
-# This file is part of GNU Libtool:
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# A sed program that does not truncate output.
-SED=$lt_SED
-
-# Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="$SED -e 1s/^X//"
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-# The names of the tagged configurations supported by this script.
-available_tags=
-
-# ### BEGIN LIBTOOL CONFIG],
-[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
-
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
-
-# Whether or not to build shared libraries.
-build_libtool_libs=$enable_shared
-
-# Whether or not to build static libraries.
-build_old_libs=$enable_static
-
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
-
-# Whether or not to disallow shared libs when runtime libs are static
-allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
-
-# Whether or not to optimize for fast installation.
-fast_install=$enable_fast_install
-
-# The host system.
-host_alias=$host_alias
-host=$host
-host_os=$host_os
-
-# The build system.
-build_alias=$build_alias
-build=$build
-build_os=$build_os
-
-# An echo program that does not interpret backslashes.
-echo=$lt_echo
-
-# The archiver.
-AR=$lt_AR
-AR_FLAGS=$lt_AR_FLAGS
-
-# A C compiler.
-LTCC=$lt_LTCC
-
-# LTCC compiler flags.
-LTCFLAGS=$lt_LTCFLAGS
-
-# A language-specific compiler.
-CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
-
-# Is the compiler the GNU C compiler?
-with_gcc=$_LT_AC_TAGVAR(GCC, $1)
-
-# An ERE matcher.
-EGREP=$lt_EGREP
-
-# The linker used to build libraries.
-LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
-
-# Whether we need hard or soft links.
-LN_S=$lt_LN_S
-
-# A BSD-compatible nm program.
-NM=$lt_NM
-
-# A symbol stripping program
-STRIP=$lt_STRIP
-
-# Used to examine libraries when file_magic_cmd begins "file"
-MAGIC_CMD=$MAGIC_CMD
-
-# Used on cygwin: DLL creation program.
-DLLTOOL="$DLLTOOL"
-
-# Used on cygwin: object dumper.
-OBJDUMP="$OBJDUMP"
-
-# Used on cygwin: assembler.
-AS="$AS"
-
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
-
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
-
-# How to pass a linker flag through the compiler.
-wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
-
-# Object file suffix (normally "o").
-objext="$ac_objext"
-
-# Old archive suffix (normally "a").
-libext="$libext"
-
-# Shared library suffix (normally ".so").
-shrext_cmds='$shrext_cmds'
-
-# Executable file suffix (normally "").
-exeext="$exeext"
-
-# Additional compiler flags for building library objects.
-pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
-pic_mode=$pic_mode
-
-# What is the maximum length of a command?
-max_cmd_len=$lt_cv_sys_max_cmd_len
-
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
-
-# Must we lock files when doing compilation?
-need_locks=$lt_need_locks
-
-# Do we need the lib prefix for modules?
-need_lib_prefix=$need_lib_prefix
-
-# Do we need a version for libraries?
-need_version=$need_version
-
-# Whether dlopen is supported.
-dlopen_support=$enable_dlopen
-
-# Whether dlopen of programs is supported.
-dlopen_self=$enable_dlopen_self
-
-# Whether dlopen of statically linked programs is supported.
-dlopen_self_static=$enable_dlopen_self_static
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
-
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
-
-# Compiler flag to generate thread-safe objects.
-thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
-
-# Library versioning type.
-version_type=$version_type
-
-# Format of library name prefix.
-libname_spec=$lt_libname_spec
-
-# List of archive names. First name is the real one, the rest are links.
-# The last name is the one that the linker finds with -lNAME.
-library_names_spec=$lt_library_names_spec
-
-# The coded name of the library, if different from the real name.
-soname_spec=$lt_soname_spec
-
-# Commands used to build and install an old-style archive.
-RANLIB=$lt_RANLIB
-old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
-old_postinstall_cmds=$lt_old_postinstall_cmds
-old_postuninstall_cmds=$lt_old_postuninstall_cmds
-
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
-
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
-
-# Commands used to build and install a shared archive.
-archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
-archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
-postinstall_cmds=$lt_postinstall_cmds
-postuninstall_cmds=$lt_postuninstall_cmds
-
-# Commands used to build a loadable module (assumed same as above if empty)
-module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
-module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
-
-# Commands to strip libraries.
-old_striplib=$lt_old_striplib
-striplib=$lt_striplib
-
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
-
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
-
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
-
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
-
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
-
-# Method to check whether dependent libraries are shared objects.
-deplibs_check_method=$lt_deplibs_check_method
-
-# Command to use when deplibs_check_method == file_magic.
-file_magic_cmd=$lt_file_magic_cmd
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
-
-# Flag that forces no undefined symbols.
-no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
-
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds=$lt_finish_cmds
-
-# Same as above, but a single script fragment to be evaled but not shown.
-finish_eval=$lt_finish_eval
-
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
-
-# Transform the output of nm in a proper C declaration
-global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
-
-# Transform the output of nm in a C name address pair
-global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
-
-# This is the shared library runtime path variable.
-runpath_var=$runpath_var
-
-# This is the shared library path variable.
-shlibpath_var=$shlibpath_var
-
-# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=$shlibpath_overrides_runpath
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
-
-# Whether we should hardcode library paths into libraries.
-hardcode_into_libs=$hardcode_into_libs
-
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
-
-# If ld is used when linking, flag to hardcode \$libdir into
-# a binary during linking. This must work even if \$libdir does
-# not exist.
-hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
-
-# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
-
-# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
-# resulting binary.
-hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
-
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
-hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
-
-# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
-# the resulting binary.
-hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
-
-# Set to yes if building a shared library automatically hardcodes DIR into the library
-# and all subsequent libraries and executables linked against it.
-hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
-
-# Variables whose values should be saved in libtool wrapper scripts and
-# restored at relink time.
-variables_saved_for_relink="$variables_saved_for_relink"
-
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
-
-# Compile-time system search path for libraries
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
-
-# Run-time system search path for libraries
-sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
-
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path="$_LT_AC_TAGVAR(fix_srcfile_path, $1)"
-
-# Set to yes if exported symbols are required.
-always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
-
-# The commands to list exported symbols.
-export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
-
-# The commands to extract the exported symbol list from a shared archive.
-extract_expsyms_cmds=$lt_extract_expsyms_cmds
-
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
-
-# Symbols that must always be exported.
-include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
-
-ifelse([$1],[],
-[# ### END LIBTOOL CONFIG],
-[# ### END LIBTOOL TAG CONFIG: $tagname])
-
-__EOF__
-
-ifelse([$1],[], [
- case $host_os in
- aix3*)
- cat <<\EOF >> "$cfgfile"
-
-# AIX sometimes has problems with the GCC collect2 program. For some
-# reason, if we set the COLLECT_NAMES environment variable, the problems
-# vanish in a puff of smoke.
-if test "X${COLLECT_NAMES+set}" != Xset; then
- COLLECT_NAMES=
- export COLLECT_NAMES
-fi
-EOF
- ;;
- esac
-
- # We use sed instead of cat because bash on DJGPP gets confused if
- # if finds mixed CR/LF and LF-only lines. Since sed operates in
- # text mode, it properly converts lines to CR/LF. This bash problem
- # is reportedly fixed, but why not run on old versions too?
- sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
-
- mv -f "$cfgfile" "$ofile" || \
- (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
- chmod +x "$ofile"
-])
-else
- # If there is no Makefile yet, we rely on a make rule to execute
- # `config.status --recheck' to rerun these tests and create the
- # libtool script then.
- ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
- if test -f "$ltmain_in"; then
- test -f Makefile && make "$ltmain"
- fi
-fi
-])# AC_LIBTOOL_CONFIG
-
-
-# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
-# -------------------------------------------
-AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
-[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
-
-_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
-
-if test "$GCC" = yes; then
- _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
-
- AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
- lt_cv_prog_compiler_rtti_exceptions,
- [-fno-rtti -fno-exceptions], [],
- [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
-fi
-])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
-
-
-# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
-# ---------------------------------
-AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
-[AC_REQUIRE([AC_CANONICAL_HOST])
-AC_REQUIRE([AC_PROG_NM])
-AC_REQUIRE([AC_OBJEXT])
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-AC_MSG_CHECKING([command to parse $NM output from $compiler object])
-AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
-[
-# These are sane defaults that work on at least a few old systems.
-# [They come from Ultrix. What could be older than Ultrix?!! ;)]
-
-# Character class describing NM global symbol codes.
-symcode='[[BCDEGRST]]'
-
-# Regexp to match symbols that can be accessed directly from C.
-sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
-
-# Transform an extracted symbol line into a proper C declaration
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
-
-# Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
-
-# Define system-specific variables.
-case $host_os in
-aix*)
- symcode='[[BCDT]]'
- ;;
-cygwin* | mingw* | pw32*)
- symcode='[[ABCDGISTW]]'
- ;;
-hpux*) # Its linker distinguishes data from code symbols
- if test "$host_cpu" = ia64; then
- symcode='[[ABCDEGRST]]'
- fi
- lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
- lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
- ;;
-linux*)
- if test "$host_cpu" = ia64; then
- symcode='[[ABCDGIRSTW]]'
- lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
- lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
- fi
- ;;
-irix* | nonstopux*)
- symcode='[[BCDEGRST]]'
- ;;
-osf*)
- symcode='[[BCDEGQRST]]'
- ;;
-solaris*)
- symcode='[[BDRT]]'
- ;;
-sco3.2v5*)
- symcode='[[DT]]'
- ;;
-sysv4.2uw2*)
- symcode='[[DT]]'
- ;;
-sysv5* | sco5v6* | unixware* | OpenUNIX*)
- symcode='[[ABDT]]'
- ;;
-sysv4)
- symcode='[[DFNSTU]]'
- ;;
-esac
-
-# Handle CRLF in mingw tool chain
-opt_cr=
-case $build_os in
-mingw*)
- opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
- ;;
-esac
-
-# If we're using GNU nm, then use its standard symbol codes.
-case `$NM -V 2>&1` in
-*GNU* | *'with BFD'*)
- symcode='[[ABCDGIRSTW]]' ;;
-esac
-
-# Try without a prefix undercore, then with it.
-for ac_symprfx in "" "_"; do
-
- # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
- symxfrm="\\1 $ac_symprfx\\2 \\2"
-
- # Write the raw and C identifiers.
- lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
-
- # Check to see that the pipe works correctly.
- pipe_works=no
-
- rm -f conftest*
- cat > conftest.$ac_ext <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
-EOF
-
- if AC_TRY_EVAL(ac_compile); then
- # Now try to grab the symbols.
- nlist=conftest.nm
- if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
- # Try sorting and uniquifying the output.
- if sort "$nlist" | uniq > "$nlist"T; then
- mv -f "$nlist"T "$nlist"
- else
- rm -f "$nlist"T
- fi
-
- # Make sure that we snagged all the symbols we need.
- if grep ' nm_test_var$' "$nlist" >/dev/null; then
- if grep ' nm_test_func$' "$nlist" >/dev/null; then
- cat <<EOF > conftest.$ac_ext
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
- # Now generate the symbol file.
- eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
-
- cat <<EOF >> conftest.$ac_ext
-#if defined (__STDC__) && __STDC__
-# define lt_ptr_t void *
-#else
-# define lt_ptr_t char *
-# define const
-#endif
-
-/* The mapping between symbol names and symbols. */
-const struct {
- const char *name;
- lt_ptr_t address;
-}
-lt_preloaded_symbols[[]] =
-{
-EOF
- $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
- cat <<\EOF >> conftest.$ac_ext
- {0, (lt_ptr_t) 0}
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
- # Now try linking the two files.
- mv conftest.$ac_objext conftstm.$ac_objext
- lt_save_LIBS="$LIBS"
- lt_save_CFLAGS="$CFLAGS"
- LIBS="conftstm.$ac_objext"
- CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
- if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
- pipe_works=yes
- fi
- LIBS="$lt_save_LIBS"
- CFLAGS="$lt_save_CFLAGS"
- else
- echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
- fi
- else
- echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
- fi
- else
- echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
- fi
- else
- echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
- cat conftest.$ac_ext >&5
- fi
- rm -f conftest* conftst*
-
- # Do not use the global_symbol_pipe unless it works.
- if test "$pipe_works" = yes; then
- break
- else
- lt_cv_sys_global_symbol_pipe=
- fi
-done
-])
-if test -z "$lt_cv_sys_global_symbol_pipe"; then
- lt_cv_sys_global_symbol_to_cdecl=
-fi
-if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
- AC_MSG_RESULT(failed)
-else
- AC_MSG_RESULT(ok)
-fi
-]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
-
-
-# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
-# ---------------------------------------
-AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
-[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
-_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
-_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
-
-AC_MSG_CHECKING([for $compiler option to produce PIC])
- ifelse([$1],[CXX],[
- # C++ specific cases for pic, static, wl, etc.
- if test "$GXX" = yes; then
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
-
- case $host_os in
- aix*)
- # All AIX code is PIC.
- if test "$host_cpu" = ia64; then
- # AIX 5 now supports IA64 processor
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- fi
- ;;
- amigaos*)
- # FIXME: we need at least 68020 code to build shared libraries, but
- # adding the `-m68020' flag to GCC prevents building anything better,
- # like `-m68040'.
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
- ;;
- beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
- # PIC is the default for these OSes.
- ;;
- mingw* | os2* | pw32*)
- # This hack is so that the source file can tell whether it is being
- # built for inclusion in a dll (and should export symbols for example).
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
- ;;
- darwin* | rhapsody*)
- # PIC is the default on this platform
- # Common symbols not allowed in MH_DYLIB files
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
- ;;
- *djgpp*)
- # DJGPP does not support shared libraries at all
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
- ;;
- interix3*)
- # Interix 3.x gcc -fpic/-fPIC options generate broken code.
- # Instead, we relocate shared libraries at runtime.
- ;;
- sysv4*MP*)
- if test -d /usr/nec; then
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
- fi
- ;;
- hpux*)
- # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
- # not for PA HP-UX.
- case $host_cpu in
- hppa*64*|ia64*)
- ;;
- *)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
- ;;
- esac
- ;;
- *)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
- ;;
- esac
- else
- case $host_os in
- aix4* | aix5*)
- # All AIX code is PIC.
- if test "$host_cpu" = ia64; then
- # AIX 5 now supports IA64 processor
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- else
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
- fi
- ;;
- chorus*)
- case $cc_basename in
- cxch68*)
- # Green Hills C++ Compiler
- # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
- ;;
- esac
- ;;
- darwin*)
- # PIC is the default on this platform
- # Common symbols not allowed in MH_DYLIB files
- case $cc_basename in
- xlc*)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- ;;
- esac
- ;;
- dgux*)
- case $cc_basename in
- ec++*)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- ;;
- ghcx*)
- # Green Hills C++ Compiler
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
- ;;
- *)
- ;;
- esac
- ;;
- freebsd* | kfreebsd*-gnu | dragonfly*)
- # FreeBSD uses GNU C++
- ;;
- hpux9* | hpux10* | hpux11*)
- case $cc_basename in
- CC*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
- if test "$host_cpu" != ia64; then
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
- fi
- ;;
- aCC*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
- case $host_cpu in
- hppa*64*|ia64*)
- # +Z the default
- ;;
- *)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
- ;;
- esac
- ;;
- *)
- ;;
- esac
- ;;
- interix*)
- # This is c89, which is MS Visual C++ (no shared libs)
- # Anyone wants to do a port?
- ;;
- irix5* | irix6* | nonstopux*)
- case $cc_basename in
- CC*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
- # CC pic flag -KPIC is the default.
- ;;
- *)
- ;;
- esac
- ;;
- linux*)
- case $cc_basename in
- KCC*)
- # KAI C++ Compiler
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
- ;;
- icpc* | ecpc*)
- # Intel C++
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
- ;;
- pgCC*)
- # Portland Group C++ compiler.
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
- cxx*)
- # Compaq C++
- # Make sure the PIC flag is empty. It appears that all Alpha
- # Linux and Compaq Tru64 Unix objects are PIC.
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
- ;;
- *)
- ;;
- esac
- ;;
- lynxos*)
- ;;
- m88k*)
- ;;
- mvs*)
- case $cc_basename in
- cxx*)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
- ;;
- *)
- ;;
- esac
- ;;
- netbsd*)
- ;;
- osf3* | osf4* | osf5*)
- case $cc_basename in
- KCC*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
- ;;
- RCC*)
- # Rational C++ 2.4.1
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
- ;;
- cxx*)
- # Digital/Compaq C++
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- # Make sure the PIC flag is empty. It appears that all Alpha
- # Linux and Compaq Tru64 Unix objects are PIC.
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
- ;;
- *)
- ;;
- esac
- ;;
- psos*)
- ;;
- solaris*)
- case $cc_basename in
- CC*)
- # Sun C++ 4.2, 5.x and Centerline C++
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
- ;;
- gcx*)
- # Green Hills C++ Compiler
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
- ;;
- *)
- ;;
- esac
- ;;
- sunos4*)
- case $cc_basename in
- CC*)
- # Sun C++ 4.x
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
- lcc*)
- # Lucid
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
- ;;
- *)
- ;;
- esac
- ;;
- tandem*)
- case $cc_basename in
- NCC*)
- # NonStop-UX NCC 3.20
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- ;;
- *)
- ;;
- esac
- ;;
- sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
- case $cc_basename in
- CC*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
- esac
- ;;
- vxworks*)
- ;;
- *)
- _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
- ;;
- esac
- fi
-],
-[
- if test "$GCC" = yes; then
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
-
- case $host_os in
- aix*)
- # All AIX code is PIC.
- if test "$host_cpu" = ia64; then
- # AIX 5 now supports IA64 processor
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- fi
- ;;
-
- amigaos*)
- # FIXME: we need at least 68020 code to build shared libraries, but
- # adding the `-m68020' flag to GCC prevents building anything better,
- # like `-m68040'.
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
- ;;
-
- beos* | cygwin* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
- # PIC is the default for these OSes.
- ;;
-
- mingw* | pw32* | os2*)
- # This hack is so that the source file can tell whether it is being
- # built for inclusion in a dll (and should export symbols for example).
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
- ;;
-
- darwin* | rhapsody*)
- # PIC is the default on this platform
- # Common symbols not allowed in MH_DYLIB files
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
- ;;
-
- interix3*)
- # Interix 3.x gcc -fpic/-fPIC options generate broken code.
- # Instead, we relocate shared libraries at runtime.
- ;;
-
- msdosdjgpp*)
- # Just because we use GCC doesn't mean we suddenly get shared libraries
- # on systems that don't support them.
- _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
- enable_shared=no
- ;;
-
- sysv4*MP*)
- if test -d /usr/nec; then
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
- fi
- ;;
-
- hpux*)
- # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
- # not for PA HP-UX.
- case $host_cpu in
- hppa*64*|ia64*)
- # +Z the default
- ;;
- *)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
- ;;
- esac
- ;;
-
- *)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
- ;;
- esac
- else
- # PORTME Check for flag to pass linker flags through the system compiler.
- case $host_os in
- aix*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- if test "$host_cpu" = ia64; then
- # AIX 5 now supports IA64 processor
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- else
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
- fi
- ;;
- darwin*)
- # PIC is the default on this platform
- # Common symbols not allowed in MH_DYLIB files
- case $cc_basename in
- xlc*)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- ;;
- esac
- ;;
-
- mingw* | pw32* | os2*)
- # This hack is so that the source file can tell whether it is being
- # built for inclusion in a dll (and should export symbols for example).
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
- ;;
-
- hpux9* | hpux10* | hpux11*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
- # not for PA HP-UX.
- case $host_cpu in
- hppa*64*|ia64*)
- # +Z the default
- ;;
- *)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
- ;;
- esac
- # Is there a better lt_prog_compiler_static that works with the bundled CC?
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
- ;;
-
- irix5* | irix6* | nonstopux*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- # PIC (with -KPIC) is the default.
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
- ;;
-
- newsos6)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
-
- linux*)
- case $cc_basename in
- icc* | ecc*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
- ;;
- pgcc* | pgf77* | pgf90* | pgf95*)
- # Portland Group compilers (*not* the Pentium gcc compiler,
- # which looks to be a dead project)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
- ccc*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- # All Alpha code is PIC.
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
- ;;
- esac
- ;;
-
- osf3* | osf4* | osf5*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- # All OSF/1 code is PIC.
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
- ;;
-
- solaris*)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- case $cc_basename in
- f77* | f90* | f95*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
- *)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
- esac
- ;;
-
- sunos4*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
-
- sysv4 | sysv4.2uw2* | sysv4.3*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
-
- sysv4*MP*)
- if test -d /usr/nec ;then
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- fi
- ;;
-
- sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
-
- unicos*)
- _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
- ;;
-
- uts4*)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
-
- *)
- _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
- ;;
- esac
- fi
-])
-AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
-
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
- AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
- _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
- [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
- [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
- "" | " "*) ;;
- *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
- esac],
- [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
- _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
-fi
-case $host_os in
- # For platforms which do not support PIC, -DPIC is meaningless:
- *djgpp*)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
- ;;
- *)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
- ;;
-esac
-
-#
-# Check to make sure the static flag actually works.
-#
-wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
-AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
- _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
- $lt_tmp_static_flag,
- [],
- [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
-])
-
-
-# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
-# ------------------------------------
-# See if the linker supports building shared libraries.
-AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
-[AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
-ifelse([$1],[CXX],[
- _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
- case $host_os in
- aix4* | aix5*)
- # If we're using GNU nm, then we don't want the "-C" option.
- # -C means demangle to AIX nm, but means don't demangle with GNU nm
- if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
- _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
- else
- _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
- fi
- ;;
- pw32*)
- _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
- ;;
- cygwin* | mingw*)
- _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/;/^.* __nm__/s/^.* __nm__\([[^ ]]*\) [[^ ]]*/\1 DATA/;/^I /d;/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
- ;;
- *)
- _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
- ;;
- esac
-],[
- runpath_var=
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=
- _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
- _LT_AC_TAGVAR(archive_cmds, $1)=
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
- _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
- _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
- _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
- _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
- _LT_AC_TAGVAR(hardcode_automatic, $1)=no
- _LT_AC_TAGVAR(module_cmds, $1)=
- _LT_AC_TAGVAR(module_expsym_cmds, $1)=
- _LT_AC_TAGVAR(always_export_symbols, $1)=no
- _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
- # include_expsyms should be a list of space-separated symbols to be *always*
- # included in the symbol list
- _LT_AC_TAGVAR(include_expsyms, $1)=
- # exclude_expsyms can be an extended regexp of symbols to exclude
- # it will be wrapped by ` (' and `)$', so one must not match beginning or
- # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
- # as well as any symbol that contains `d'.
- _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
- # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
- # platforms (ab)use it in PIC code, but their linkers get confused if
- # the symbol is explicitly referenced. Since portable code cannot
- # rely on this symbol name, it's probably fine to never include it in
- # preloaded symbol tables.
- extract_expsyms_cmds=
- # Just being paranoid about ensuring that cc_basename is set.
- _LT_CC_BASENAME([$compiler])
- case $host_os in
- cygwin* | mingw* | pw32*)
- # FIXME: the MSVC++ port hasn't been tested in a loooong time
- # When not using gcc, we currently assume that we are using
- # Microsoft Visual C++.
- if test "$GCC" != yes; then
- with_gnu_ld=no
- fi
- ;;
- interix*)
- # we just hope/assume this is gcc and not c89 (= MSVC++)
- with_gnu_ld=yes
- ;;
- openbsd*)
- with_gnu_ld=no
- ;;
- esac
-
- _LT_AC_TAGVAR(ld_shlibs, $1)=yes
- if test "$with_gnu_ld" = yes; then
- # If archive_cmds runs LD, not CC, wlarc should be empty
- wlarc='${wl}'
-
- # Set some defaults for GNU ld with shared library support. These
- # are reset later if shared libraries are not supported. Putting them
- # here allows them to be overridden if necessary.
- runpath_var=LD_RUN_PATH
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
- # ancient GNU ld didn't support --whole-archive et. al.
- if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
- else
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
- fi
- supports_anon_versioning=no
- case `$LD -v 2>/dev/null` in
- *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
- *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
- *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
- *\ 2.11.*) ;; # other 2.11 versions
- *) supports_anon_versioning=yes ;;
- esac
-
- # See if GNU ld supports shared libraries.
- case $host_os in
- aix3* | aix4* | aix5*)
- # On AIX/PPC, the GNU linker is very broken
- if test "$host_cpu" != ia64; then
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- cat <<EOF 1>&2
-
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support. If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
-
-EOF
- fi
- ;;
-
- amigaos*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-
- # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
- # that the semantics of dynamic libraries on AmigaOS, at least up
- # to version 4, is to share data among multiple programs linked
- # with the same dynamic library. Since this doesn't match the
- # behavior of shared libraries on other platforms, we can't use
- # them.
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
-
- beos*)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
- # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
- # support --undefined. This deserves some investigation. FIXME
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
-
- cygwin* | mingw* | pw32*)
- # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
- # as there is no search path for DLLs.
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_AC_TAGVAR(always_export_symbols, $1)=no
- _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
- _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]] /s/.* \([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]] /s/.* //'\'' | sort | uniq > $export_symbols'
-
- if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
- # If the export-symbols file already is a .def file (1st line
- # is EXPORTS), use it as is; otherwise, prepend...
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
- cp $export_symbols $output_objdir/$soname.def;
- else
- echo EXPORTS > $output_objdir/$soname.def;
- cat $export_symbols >> $output_objdir/$soname.def;
- fi~
- $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
-
- interix3*)
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
- # Instead, shared libraries are loaded at an image base (0x10000000 by
- # default) and relocated if they conflict, which is a slow very memory
- # consuming and fragmenting process. To avoid this, we pick a random,
- # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
- # time. Moving up from 0x10000000 also allows more sbrk(2) space.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- ;;
-
- linux*)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- tmp_addflag=
- case $cc_basename,$host_cpu in
- pgcc*) # Portland Group C compiler
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
- tmp_addflag=' $pic_flag'
- ;;
- pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
- tmp_addflag=' $pic_flag -Mnomain' ;;
- ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
- tmp_addflag=' -i_dynamic' ;;
- efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
- tmp_addflag=' -i_dynamic -nofor_main' ;;
- ifc* | ifort*) # Intel Fortran compiler
- tmp_addflag=' -nofor_main' ;;
- esac
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-
- if test $supports_anon_versioning = yes; then
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
- cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
- $echo "local: *; };" >> $output_objdir/$libname.ver~
- $CC -shared'"$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
- fi
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
-
- netbsd*)
- if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
- wlarc=
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
- fi
- ;;
-
- solaris*)
- if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- cat <<EOF 1>&2
-
-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
-*** create shared libraries on Solaris systems. Therefore, libtool
-*** is disabling shared libraries support. We urge you to upgrade GNU
-*** binutils to release 2.9.1 or newer. Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-EOF
- elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
-
- sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
- case `$LD -v 2>&1` in
- *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- cat <<_LT_EOF 1>&2
-
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems. Therefore, libtool
-*** is disabling shared libraries support. We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
- ;;
- *)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- esac
- ;;
-
- sunos4*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
- wlarc=
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
-
- *)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- esac
-
- if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then
- runpath_var=
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
- fi
- else
- # PORTME fill in a description of your system's linker (not GNU ld)
- case $host_os in
- aix3*)
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_AC_TAGVAR(always_export_symbols, $1)=yes
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
- # Note: this linker hardcodes the directories in LIBPATH if there
- # are no directories specified by -L.
- _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
- if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
- # Neither direct hardcoding nor static linking is supported with a
- # broken collect2.
- _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
- fi
- ;;
-
- aix4* | aix5*)
- if test "$host_cpu" = ia64; then
- # On IA64, the linker does run time linking by default, so we don't
- # have to do anything special.
- aix_use_runtimelinking=no
- exp_sym_flag='-Bexport'
- no_entry_flag=""
- else
- # If we're using GNU nm, then we don't want the "-C" option.
- # -C means demangle to AIX nm, but means don't demangle with GNU nm
- if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
- _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
- else
- _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
- fi
- aix_use_runtimelinking=no
-
- # Test if we are trying to use run time linking or normal
- # AIX style linking. If -brtl is somewhere in LDFLAGS, we
- # need to do runtime linking.
- case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
- for ld_flag in $LDFLAGS; do
- if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
- aix_use_runtimelinking=yes
- break
- fi
- done
- ;;
- esac
-
- exp_sym_flag='-bexport'
- no_entry_flag='-bnoentry'
- fi
-
- # When large executables or shared objects are built, AIX ld can
- # have problems creating the table of contents. If linking a library
- # or program results in "error TOC overflow" add -mminimal-toc to
- # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
- # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
-
- _LT_AC_TAGVAR(archive_cmds, $1)=''
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-
- if test "$GCC" = yes; then
- case $host_os in aix4.[[012]]|aix4.[[012]].*)
- # We only want to do this on AIX 4.2 and lower, the check
- # below for broken collect2 doesn't work under 4.3+
- collect2name=`${CC} -print-prog-name=collect2`
- if test -f "$collect2name" && \
- strings "$collect2name" | grep resolve_lib_name >/dev/null
- then
- # We have reworked collect2
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- else
- # We have old collect2
- _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
- # It fails to find uninstalled libraries when the uninstalled
- # path is not listed in the libpath. Setting hardcode_minus_L
- # to unsupported forces relinking
- _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
- fi
- ;;
- esac
- shared_flag='-shared'
- if test "$aix_use_runtimelinking" = yes; then
- shared_flag="$shared_flag "'${wl}-G'
- fi
- else
- # not using gcc
- if test "$host_cpu" = ia64; then
- # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
- # chokes on -Wl,-G. The following line is correct:
- shared_flag='-G'
- else
- if test "$aix_use_runtimelinking" = yes; then
- shared_flag='${wl}-G'
- else
- shared_flag='${wl}-bM:SRE'
- fi
- fi
- fi
-
- # It seems that -bexpall does not export symbols beginning with
- # underscore (_), so it is better to generate a list of symbols to export.
- _LT_AC_TAGVAR(always_export_symbols, $1)=yes
- if test "$aix_use_runtimelinking" = yes; then
- # Warning - without using the other runtime loading flags (-brtl),
- # -berok will link without error, but may produce a broken library.
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
- # Determine the default libpath from the value encoded in an empty executable.
- _LT_AC_SYS_LIBPATH_AIX
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
- else
- if test "$host_cpu" = ia64; then
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
- _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
- else
- # Determine the default libpath from the value encoded in an empty executable.
- _LT_AC_SYS_LIBPATH_AIX
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
- # Warning - without using the other run time loading flags,
- # -berok will link without error, but may produce a broken library.
- _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
- # Exported symbols can be pulled into shared objects from archives
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
- # This is similar to how AIX traditionally builds its shared libraries.
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
- fi
- fi
- ;;
-
- amigaos*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
- # see comment about different semantics on the GNU ld section
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
-
- bsdi[[45]]*)
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
- ;;
-
- cygwin* | mingw* | pw32*)
- # When not using gcc, we currently assume that we are using
- # Microsoft Visual C++.
- # hardcode_libdir_flag_spec is actually meaningless, as there is
- # no search path for DLLs.
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
- # Tell ltmain to make .lib files, not .a files.
- libext=lib
- # Tell ltmain to make .dll files, not .so files.
- shrext_cmds=".dll"
- # FIXME: Setting linknames here is a bad hack.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
- # The linker will automatically build a .lib file if we build a DLL.
- _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
- # FIXME: Should let the user specify the lib program.
- _LT_AC_TAGVAR(old_archive_cmds, $1)='lib /OUT:$oldlib$oldobjs$old_deplibs'
- _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
- _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
- ;;
-
- darwin* | rhapsody*)
- case $host_os in
- rhapsody* | darwin1.[[012]])
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
- ;;
- *) # Darwin 1.3 on
- if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
- else
- case ${MACOSX_DEPLOYMENT_TARGET} in
- 10.[[012]])
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
- ;;
- 10.*)
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
- ;;
- esac
- fi
- ;;
- esac
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- if test "$GCC" = yes ; then
- output_verbose_link_cmd='echo'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
- _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- else
- case $cc_basename in
- xlc*)
- output_verbose_link_cmd='echo'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $verstring'
- _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
- # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
- ;;
- *)
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- esac
- fi
- ;;
-
- dgux*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
-
- freebsd1*)
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
-
- # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
- # support. Future versions do this automatically, but an explicit c++rt0.o
- # does not break anything, and helps significantly (at the cost of a little
- # extra space).
- freebsd2.2*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
-
- # Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
-
- # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
- freebsd* | kfreebsd*-gnu | dragonfly*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
-
- hpux9*)
- if test "$GCC" = yes; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
- fi
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-
- # hardcode_minus_L: Not really in the search PATH,
- # but as the default location of the library.
- _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- ;;
-
- hpux10*)
- if test "$GCC" = yes -a "$with_gnu_ld" = no; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
- fi
- if test "$with_gnu_ld" = no; then
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-
- # hardcode_minus_L: Not really in the search PATH,
- # but as the default location of the library.
- _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
- fi
- ;;
-
- hpux11*)
- if test "$GCC" = yes -a "$with_gnu_ld" = no; then
- case $host_cpu in
- hppa*64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- ia64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
- else
- case $host_cpu in
- hppa*64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- ia64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
- fi
- if test "$with_gnu_ld" = no; then
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
- case $host_cpu in
- hppa*64*|ia64*)
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
- *)
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-
- # hardcode_minus_L: Not really in the search PATH,
- # but as the default location of the library.
- _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
- ;;
- esac
- fi
- ;;
-
- irix5* | irix6* | nonstopux*)
- if test "$GCC" = yes; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
- fi
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- ;;
-
- netbsd*)
- if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
- fi
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
-
- newsos6)
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
-
- openbsd*)
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- else
- case $host_os in
- openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- ;;
- *)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- ;;
- esac
- fi
- ;;
-
- os2*)
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
- _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
- ;;
-
- osf3*)
- if test "$GCC" = yes; then
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
- else
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
- fi
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
- ;;
-
- osf4* | osf5*) # as osf3* with the addition of -msym flag
- if test "$GCC" = yes; then
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- else
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
- $LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
-
- # Both c and cxx compiler support -rpath directly
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
- fi
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
- ;;
-
- solaris*)
- _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
- if test "$GCC" = yes; then
- wlarc='${wl}'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
- $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
- else
- wlarc=''
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
- $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
- fi
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- case $host_os in
- solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
- *)
- # The compiler driver will combine linker options so we
- # cannot just pass the convience library names through
- # without $wl, iff we do not link with $LD.
- # Luckily, gcc supports the same syntax we need for Sun Studio.
- # Supported since Solaris 2.6 (maybe 2.5.1?)
- case $wlarc in
- '')
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;;
- *)
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}-z ${wl}defaultextract' ;;
- esac ;;
- esac
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- ;;
-
- sunos4*)
- if test "x$host_vendor" = xsequent; then
- # Use $CC to link under sequent, because it throws in some extra .o
- # files that make .init and .fini sections work.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
- fi
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes
- _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
-
- sysv4)
- case $host_vendor in
- sni)
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
- ;;
- siemens)
- ## LD is ld it makes a PLAMLIB
- ## CC just makes a GrossModule.
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
- _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- ;;
- motorola)
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
- ;;
- esac
- runpath_var='LD_RUN_PATH'
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
-
- sysv4.3*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
- ;;
-
- sysv4*MP*)
- if test -d /usr/nec; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- runpath_var=LD_RUN_PATH
- hardcode_runpath_var=yes
- _LT_AC_TAGVAR(ld_shlibs, $1)=yes
- fi
- ;;
-
- sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7*)
- _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- runpath_var='LD_RUN_PATH'
-
- if test "$GCC" = yes; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- fi
- ;;
-
- sysv5* | sco3.2v5* | sco5v6*)
- # Note: We can NOT use -z defs as we might desire, because we do not
- # link with -lc, and that would cause any symbols used from libc to
- # always be unresolved, which means just about no library would
- # ever link correctly. If we're not using GNU ld we use -z text
- # though, which does catch some bad symbols but isn't as heavy-handed
- # as -z defs.
- _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
- runpath_var='LD_RUN_PATH'
-
- if test "$GCC" = yes; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- fi
- ;;
-
- uts4*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
-
- *)
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- ;;
- esac
- fi
-])
-AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
-test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
-#
-# Do we need to explicitly link libc?
-#
-case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
-x|xyes)
- # Assume -lc should be added
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
-
- if test "$enable_shared" = yes && test "$GCC" = yes; then
- case $_LT_AC_TAGVAR(archive_cmds, $1) in
- *'~'*)
- # FIXME: we may have to deal with multi-command sequences.
- ;;
- '$CC '*)
- # Test whether the compiler implicitly links with -lc since on some
- # systems, -lgcc has to come before -lc. If gcc already passes -lc
- # to ld, don't add -lc before -lgcc.
- AC_MSG_CHECKING([whether -lc should be explicitly linked in])
- $rm conftest*
- printf "$lt_simple_compile_test_code" > conftest.$ac_ext
-
- if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
- soname=conftest
- lib=conftest
- libobjs=conftest.$ac_objext
- deplibs=
- wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
- pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
- compiler_flags=-v
- linker_flags=-v
- verstring=
- output_objdir=.
- libname=conftest
- lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=
- if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
- then
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- else
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
- fi
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
- else
- cat conftest.err 1>&5
- fi
- $rm conftest*
- AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
- ;;
- esac
- fi
- ;;
-esac
-])# AC_LIBTOOL_PROG_LD_SHLIBS
-
-
-# _LT_AC_FILE_LTDLL_C
-# -------------------
-# Be careful that the start marker always follows a newline.
-AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
-# /* ltdll.c starts here */
-# #define WIN32_LEAN_AND_MEAN
-# #include <windows.h>
-# #undef WIN32_LEAN_AND_MEAN
-# #include <stdio.h>
-#
-# #ifndef __CYGWIN__
-# # ifdef __CYGWIN32__
-# # define __CYGWIN__ __CYGWIN32__
-# # endif
-# #endif
-#
-# #ifdef __cplusplus
-# extern "C" {
-# #endif
-# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
-# #ifdef __cplusplus
-# }
-# #endif
-#
-# #ifdef __CYGWIN__
-# #include <cygwin/cygwin_dll.h>
-# DECLARE_CYGWIN_DLL( DllMain );
-# #endif
-# HINSTANCE __hDllInstance_base;
-#
-# BOOL APIENTRY
-# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
-# {
-# __hDllInstance_base = hInst;
-# return TRUE;
-# }
-# /* ltdll.c ends here */
-])# _LT_AC_FILE_LTDLL_C
-
-
-# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
-# ---------------------------------
-AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
-
-
-# old names
-AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL])
-AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
-AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
-AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
-AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
-AC_DEFUN([AM_PROG_LD], [AC_PROG_LD])
-AC_DEFUN([AM_PROG_NM], [AC_PROG_NM])
-
-# This is just to silence aclocal about the macro not being used
-ifelse([AC_DISABLE_FAST_INSTALL])
-
-AC_DEFUN([LT_AC_PROG_GCJ],
-[AC_CHECK_TOOL(GCJ, gcj, no)
- test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
- AC_SUBST(GCJFLAGS)
-])
-
-AC_DEFUN([LT_AC_PROG_RC],
-[AC_CHECK_TOOL(RC, windres, no)
-])
-
-############################################################
-# NOTE: This macro has been submitted for inclusion into #
-# GNU Autoconf as AC_PROG_SED. When it is available in #
-# a released version of Autoconf we should remove this #
-# macro and use it instead. #
-############################################################
-# LT_AC_PROG_SED
-# --------------
-# Check for a fully-functional sed program, that truncates
-# as few characters as possible. Prefer GNU sed if found.
-AC_DEFUN([LT_AC_PROG_SED],
-[AC_MSG_CHECKING([for a sed that does not truncate output])
-AC_CACHE_VAL(lt_cv_path_SED,
-[# Loop through the user's path and test for sed and gsed.
-# Then use that list of sed's as ones to test for truncation.
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for lt_ac_prog in sed gsed; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
- lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
- fi
- done
- done
-done
-lt_ac_max=0
-lt_ac_count=0
-# Add /usr/xpg4/bin/sed as it is typically found on Solaris
-# along with /bin/sed that truncates output.
-for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
- test ! -f $lt_ac_sed && continue
- cat /dev/null > conftest.in
- lt_ac_count=0
- echo $ECHO_N "0123456789$ECHO_C" >conftest.in
- # Check for GNU sed and select it if it is found.
- if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
- lt_cv_path_SED=$lt_ac_sed
- break
- fi
- while true; do
- cat conftest.in conftest.in >conftest.tmp
- mv conftest.tmp conftest.in
- cp conftest.in conftest.nl
- echo >>conftest.nl
- $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
- cmp -s conftest.out conftest.nl || break
- # 10000 chars as input seems more than enough
- test $lt_ac_count -gt 10 && break
- lt_ac_count=`expr $lt_ac_count + 1`
- if test $lt_ac_count -gt $lt_ac_max; then
- lt_ac_max=$lt_ac_count
- lt_cv_path_SED=$lt_ac_sed
- fi
- done
-done
-])
-SED=$lt_cv_path_SED
-AC_MSG_RESULT([$SED])
-])
mkdir releng
cd releng
-git init && git fetch git://git.gromacs.org/releng.git refs/heads/4.5.0 && git checkout -q -f FETCH_HEAD && cd .. && python -u releng/GerritBuild.py
+git init && git fetch git://git.gromacs.org/releng.git refs/heads/4.6.0 && git checkout -q -f FETCH_HEAD && cd .. && python -u releng/GerritBuild.py
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-EXTRA_SCRIPTS = mkcompl mkhtml mknroff.pl mktex
-
-EXTRA_DIST = gromacs.spec programs.txt README.patches $(EXTRA_SCRIPTS)\
- InstallInfo.txt InstallLicense.txt InstallWelcome.txt
#!/bin/sh
-# This is a script to create all the configuration files when
-# you compile from the CVS source. You should NOT use it to
-# compile the distribution.
-#
-# Step 1 - check if the necessary tools appear to be there.
-# Ideally we should check versions too, which we don't...
+# This is a stub script to help developers during the final
+# part of the change-over from autotools to CMake.
-if ! autoconf --version 2>&1 | grep GNU >/dev/null 2>&1; then
- echo "Cannot find GNU autoconf! Exiting..."
- exit 0
-fi
-if ! automake --version 2>&1 | grep GNU >/dev/null 2>&1; then
- echo "Cannot find GNU automake! Exiting..."
- exit 0
-fi
-
-if ! libtool --version 2>&1 | grep GNU >/dev/null 2>&1; then
-# on Mac OS X the GNU version is called glibtool...
- if ! glibtool --version 2>&1 | grep GNU >/dev/null 2>&1; then
- echo "Cannot find GNU libtool! Exiting..."
- exit 0
- fi
-fi
-
-aclocal -I config
-# fix for OSX producing debug directories; replace rm -f with rm -rf in built-in scripts
-cat aclocal.m4 | sed -e 's/rm="rm -f"/rm="rm -rf"/' | sed -e 's/rm -f /rm -rf /' > aclocal.tmp && mv aclocal.tmp aclocal.m4
-autoheader
-automake
-autoconf
+echo "\
+The use of autotools for installing GROMACS is deprecated for 4.6 onwards
+Please switch to CMake. Check http://www.gromacs.org/Developer_Zone/Cmake
+for instructions."
+++ /dev/null
-# - Find BLAS library
-# This module finds an installed fortran library that implements the BLAS
-# linear-algebra interface (see http://www.netlib.org/blas/).
-# The list of libraries searched for is taken
-# from the autoconf macro file, acx_blas.m4 (distributed at
-# http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).
-#
-# This module sets the following variables:
-# BLAS_FOUND - set to true if a library implementing the BLAS interface
-# is found
-# BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l
-# and -L).
-# BLAS_LIBRARIES - uncached list of libraries (using full path name) to
-# link against to use BLAS
-# BLAS95_LIBRARIES - uncached list of libraries (using full path name)
-# to link against to use BLAS95 interface
-# BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface
-# is found
-# BLA_STATIC if set on this determines what kind of linkage we do (static)
-# BLA_VENDOR if set checks only the specified vendor, if not set checks
-# all the possibilities
-# BLA_F95 if set on tries to find the f95 interfaces for BLAS/LAPACK
-##########
-### List of vendors (BLA_VENDOR) valid in this module
-## ATLAS, PhiPACK,CXML,DXML,SunPerf,SCSL,SGIMATH,IBMESSL,Intel10_32 (intel mkl v10 32 bit),Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model),
-## Intel( older versions of mkl 32 and 64 bit), ACML,Apple, NAS, Generic
-# C/CXX should be enabled to use Intel mkl
-
-#=============================================================================
-# Copyright 2007-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distributed this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
-if(NOT _LANGUAGES_ MATCHES Fortran)
- if(BLAS_FIND_REQUIRED)
- message(FATAL_ERROR "FindBLAS is Fortran-only so Fortran must be enabled.")
- else(BLAS_FIND_REQUIRED)
- message(STATUS "Looking for BLAS... - NOT found (Fortran not enabled)") #
- return()
- endif(BLAS_FIND_REQUIRED)
-endif(NOT _LANGUAGES_ MATCHES Fortran)
-
-include(CheckFortranFunctionExists)
-
-macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _threads)
-# This macro checks for the existence of the combination of fortran libraries
-# given by _list. If the combination is found, this macro checks (using the
-# Check_Fortran_Function_Exists macro) whether can link against that library
-# combination using the name of a routine given by _name using the linker
-# flags given by _flags. If the combination of libraries is found and passes
-# the link test, LIBRARIES is set to the list of complete library paths that
-# have been found. Otherwise, LIBRARIES is set to FALSE.
-
-# N.B. _prefix is the prefix applied to the names of all cached variables that
-# are generated internally and marked advanced by this macro.
-
-set(_libraries_work TRUE)
-set(${LIBRARIES})
-set(_combined_name)
-foreach(_library ${_list})
- set(_combined_name ${_combined_name}_${_library})
-
- if(_libraries_work)
- if ( WIN32 )
- if(BLA_STATIC)
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
- endif(BLA_STATIC)
- find_library(${_prefix}_${_library}_LIBRARY
- NAMES ${_library}
- PATHS ENV LIB
- )
- endif ( WIN32 )
-
- if ( APPLE )
- if(BLA_STATIC)
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
- endif(BLA_STATIC)
- find_library(${_prefix}_${_library}_LIBRARY
- NAMES ${_library}
- PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
- )
-
- else ( APPLE )
- if(BLA_STATIC)
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
- endif(BLA_STATIC)
- find_library(${_prefix}_${_library}_LIBRARY
- NAMES ${_library}
- PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH
- )
- endif( APPLE )
- mark_as_advanced(${_prefix}_${_library}_LIBRARY)
- set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
- set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
- endif(_libraries_work)
-endforeach(_library ${_list})
-if(_libraries_work)
- # Test this combination of libraries.
- set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_threads})
-# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
- check_fortran_function_exists(${_name} ${_prefix}${_combined_name}_WORKS)
- set(CMAKE_REQUIRED_LIBRARIES)
- mark_as_advanced(${_prefix}${_combined_name}_WORKS)
- set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
-endif(_libraries_work)
-if(NOT _libraries_work)
- set(${LIBRARIES} FALSE)
-endif(NOT _libraries_work)
-#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
-endmacro(Check_Fortran_Libraries)
-
-set(BLAS_LINKER_FLAGS)
-set(BLAS_LIBRARIES)
-set(BLAS95_LIBRARIES)
-if ($ENV{BLA_VENDOR} MATCHES ".+")
- set(BLA_VENDOR $ENV{BLA_VENDOR})
-else ($ENV{BLA_VENDOR} MATCHES ".+")
- if(NOT BLA_VENDOR)
- set(BLA_VENDOR "All")
- endif(NOT BLA_VENDOR)
-endif ($ENV{BLA_VENDOR} MATCHES ".+")
-
-if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- cblas_dgemm
- ""
- "cblas;f77blas;atlas"
- ""
- )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")
-
-# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)
-if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "sgemm;dgemm;blas"
- ""
- )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")
-
-# BLAS in Alpha CXML library?
-if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "cxml"
- ""
- )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")
-
-# BLAS in Alpha DXML library? (now called CXML, see above)
-if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "dxml"
- ""
- )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")
-
-# BLAS in Sun Performance library?
-if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- "-xlic_lib=sunperf"
- "sunperf;sunmath"
- ""
- )
- if(BLAS_LIBRARIES)
- set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")
- endif(BLAS_LIBRARIES)
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")
-
-# BLAS in SCSL library? (SGI/Cray Scientific Library)
-if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "scsl"
- ""
- )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")
-
-# BLAS in SGIMATH library?
-if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "complib.sgimath"
- ""
- )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")
-
-# BLAS in IBM ESSL library? (requires generic BLAS lib, too)
-if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "essl;blas"
- ""
- )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")
-
-#BLAS in acml library?
-if (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "acml"
- ""
- )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "ACML" OR BLA_VENDOR STREQUAL "All")
-
-# Apple BLAS library?
-if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
-if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- cblas_dgemm
- ""
- "Accelerate"
- ""
- )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")
-
-if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
- if ( NOT BLAS_LIBRARIES )
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- cblas_dgemm
- ""
- "vecLib"
- ""
- )
- endif ( NOT BLAS_LIBRARIES )
-endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
-# Generic BLAS library?
-if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "blas"
- ""
- )
- endif(NOT BLAS_LIBRARIES)
-endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")
-
-#BLAS in intel mkl 10 library? (em64t 64bit)
-if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
- if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
- if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
- find_package(Threads)
- else(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
- find_package(Threads REQUIRED)
- endif(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)
- if (WIN32)
- if(BLA_F95)
- if(NOT BLAS95_LIBRARIES)
- check_fortran_libraries(
- BLAS95_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl_blas95;mkl_intel_c;mkl_intel_thread;mkl_core;libguide40"
- ""
- )
- endif(NOT BLAS95_LIBRARIES)
- else(BLA_F95)
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- SGEMM
- ""
- "mkl_c_dll;mkl_intel_thread_dll;mkl_core_dll;libguide40"
- ""
- )
- endif(NOT BLAS_LIBRARIES)
- endif(BLA_F95)
- else(WIN32)
- if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
- if(BLA_F95)
- if(NOT BLAS95_LIBRARIES)
- check_fortran_libraries(
- BLAS95_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl_blas95;mkl_intel;mkl_intel_thread;mkl_core;guide"
- "${CMAKE_THREAD_LIBS_INIT}"
- )
- endif(NOT BLAS95_LIBRARIES)
- else(BLA_F95)
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl_intel;mkl_intel_thread;mkl_core;guide"
- "${CMAKE_THREAD_LIBS_INIT}"
- )
- endif(NOT BLAS_LIBRARIES)
- endif(BLA_F95)
- endif (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")
- if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
- if(BLA_F95)
- if(NOT BLAS95_LIBRARIES)
- check_fortran_libraries(
- BLAS95_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl_blas95;mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
- "${CMAKE_THREAD_LIBS_INIT}"
- )
- endif(NOT BLAS95_LIBRARIES)
- else(BLA_F95)
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl_intel_lp64;mkl_intel_thread;mkl_core;guide"
- "${CMAKE_THREAD_LIBS_INIT}"
- )
- endif(NOT BLAS_LIBRARIES)
- endif(BLA_F95)
- endif (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")
- endif (WIN32)
- #older vesions of intel mkl libs
- # BLAS in intel mkl library? (shared)
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl;guide"
- "${CMAKE_THREAD_LIBS_INIT}"
- )
- endif(NOT BLAS_LIBRARIES)
- #BLAS in intel mkl library? (static, 32bit)
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl_ia32;guide"
- "${CMAKE_THREAD_LIBS_INIT}"
- )
- endif(NOT BLAS_LIBRARIES)
- #BLAS in intel mkl library? (static, em64t 64bit)
- if(NOT BLAS_LIBRARIES)
- check_fortran_libraries(
- BLAS_LIBRARIES
- BLAS
- sgemm
- ""
- "mkl_em64t;guide"
- "${CMAKE_THREAD_LIBS_INIT}"
- )
- endif(NOT BLAS_LIBRARIES)
- endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)
-endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")
-
-
-if(BLA_F95)
- if(BLAS95_LIBRARIES)
- set(BLAS95_FOUND TRUE)
- else(BLAS95_LIBRARIES)
- set(BLAS95_FOUND FALSE)
- endif(BLAS95_LIBRARIES)
-
- if(NOT BLAS_FIND_QUIETLY)
- if(BLAS95_FOUND)
- message(STATUS "A library with BLAS95 API found.")
- else(BLAS95_FOUND)
- if(BLAS_FIND_REQUIRED)
- message(FATAL_ERROR
- "A required library with BLAS95 API not found. Please specify library location.")
- else(BLAS_FIND_REQUIRED)
- message(STATUS
- "A library with BLAS95 API not found. Please specify library location.")
- endif(BLAS_FIND_REQUIRED)
- endif(BLAS95_FOUND)
- endif(NOT BLAS_FIND_QUIETLY)
- set(BLAS_FOUND TRUE)
- set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")
-else(BLA_F95)
- if(BLAS_LIBRARIES)
- set(BLAS_FOUND TRUE)
- else(BLAS_LIBRARIES)
- set(BLAS_FOUND FALSE)
- endif(BLAS_LIBRARIES)
-
- if(NOT BLAS_FIND_QUIETLY)
- if(BLAS_FOUND)
- message(STATUS "A library with BLAS API found.")
- else(BLAS_FOUND)
- if(BLAS_FIND_REQUIRED)
- message(FATAL_ERROR
- "A required library with BLAS API not found. Please specify library location."
- )
- else(BLAS_FIND_REQUIRED)
- message(STATUS
- "A library with BLAS API not found. Please specify library location."
- )
- endif(BLAS_FIND_REQUIRED)
- endif(BLAS_FOUND)
- endif(NOT BLAS_FIND_QUIETLY)
-endif(BLA_F95)
+++ /dev/null
-# - Tools for building CUDA C files: libraries and build dependencies.
-# This script locates the NVIDIA CUDA C tools. It should work on linux, windows,
-# and mac and should be reasonably up to date with CUDA C releases.
-#
-# This script makes use of the standard find_package arguments of <VERSION>,
-# REQUIRED and QUIET. CUDA_FOUND will report if an acceptable version of CUDA
-# was found.
-#
-# The script will prompt the user to specify CUDA_TOOLKIT_ROOT_DIR if the prefix
-# cannot be determined by the location of nvcc in the system path and REQUIRED
-# is specified to find_package(). To use a different installed version of the
-# toolkit set the environment variable CUDA_BIN_PATH before running cmake
-# (e.g. CUDA_BIN_PATH=/usr/local/cuda1.0 instead of the default /usr/local/cuda)
-# or set CUDA_TOOLKIT_ROOT_DIR after configuring. If you change the value of
-# CUDA_TOOLKIT_ROOT_DIR, various components that depend on the path will be
-# relocated.
-#
-# It might be necessary to set CUDA_TOOLKIT_ROOT_DIR manually on certain
-# platforms, or to use a cuda runtime not installed in the default location. In
-# newer versions of the toolkit the cuda library is included with the graphics
-# driver- be sure that the driver version matches what is needed by the cuda
-# runtime version.
-#
-# The following variables affect the behavior of the macros in the script (in
-# alphebetical order). Note that any of these flags can be changed multiple
-# times in the same directory before calling CUDA_ADD_EXECUTABLE,
-# CUDA_ADD_LIBRARY, CUDA_COMPILE, CUDA_COMPILE_PTX or CUDA_WRAP_SRCS.
-#
-# CUDA_64_BIT_DEVICE_CODE (Default matches host bit size)
-# -- Set to ON to compile for 64 bit device code, OFF for 32 bit device code.
-# Note that making this different from the host code when generating object
-# or C files from CUDA code just won't work, because size_t gets defined by
-# nvcc in the generated source. If you compile to PTX and then load the
-# file yourself, you can mix bit sizes between device and host.
-#
-# CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE (Default ON)
-# -- Set to ON if you want the custom build rule to be attached to the source
-# file in Visual Studio. Turn OFF if you add the same cuda file to multiple
-# targets.
-#
-# This allows the user to build the target from the CUDA file; however, bad
-# things can happen if the CUDA source file is added to multiple targets.
-# When performing parallel builds it is possible for the custom build
-# command to be run more than once and in parallel causing cryptic build
-# errors. VS runs the rules for every source file in the target, and a
-# source can have only one rule no matter how many projects it is added to.
-# When the rule is run from multiple targets race conditions can occur on
-# the generated file. Eventually everything will get built, but if the user
-# is unaware of this behavior, there may be confusion. It would be nice if
-# this script could detect the reuse of source files across multiple targets
-# and turn the option off for the user, but no good solution could be found.
-#
-# CUDA_BUILD_CUBIN (Default OFF)
-# -- Set to ON to enable and extra compilation pass with the -cubin option in
-# Device mode. The output is parsed and register, shared memory usage is
-# printed during build.
-#
-# CUDA_BUILD_EMULATION (Default OFF for device mode)
-# -- Set to ON for Emulation mode. -D_DEVICEEMU is defined for CUDA C files
-# when CUDA_BUILD_EMULATION is TRUE.
-#
-# CUDA_GENERATED_OUTPUT_DIR (Default CMAKE_CURRENT_BINARY_DIR)
-# -- Set to the path you wish to have the generated files placed. If it is
-# blank output files will be placed in CMAKE_CURRENT_BINARY_DIR.
-# Intermediate files will always be placed in
-# CMAKE_CURRENT_BINARY_DIR/CMakeFiles.
-#
-# CUDA_HOST_COMPILATION_CPP (Default ON)
-# -- Set to OFF for C compilation of host code.
-#
-# CUDA_NVCC_FLAGS
-# CUDA_NVCC_FLAGS_<CONFIG>
-# -- Additional NVCC command line arguments. NOTE: multiple arguments must be
-# semi-colon delimited (e.g. --compiler-options;-Wall)
-#
-# CUDA_PROPAGATE_HOST_FLAGS (Default ON)
-# -- Set to ON to propagate CMAKE_{C,CXX}_FLAGS and their configuration
-# dependent counterparts (e.g. CMAKE_C_FLAGS_DEBUG) automatically to the
-# host compiler through nvcc's -Xcompiler flag. This helps make the
-# generated host code match the rest of the system better. Sometimes
-# certain flags give nvcc problems, and this will help you turn the flag
-# propagation off. This does not affect the flags supplied directly to nvcc
-# via CUDA_NVCC_FLAGS or through the OPTION flags specified through
-# CUDA_ADD_LIBRARY, CUDA_ADD_EXECUTABLE, or CUDA_WRAP_SRCS. Flags used for
-# shared library compilation are not affected by this flag.
-#
-# CUDA_VERBOSE_BUILD (Default OFF)
-# -- Set to ON to see all the commands used when building the CUDA file. When
-# using a Makefile generator the value defaults to VERBOSE (run make
-# VERBOSE=1 to see output), although setting CUDA_VERBOSE_BUILD to ON will
-# always print the output.
-#
-# The script creates the following macros (in alphebetical order):
-#
-# CUDA_ADD_CUFFT_TO_TARGET( cuda_target )
-# -- Adds the cufft library to the target (can be any target). Handles whether
-# you are in emulation mode or not.
-#
-# CUDA_ADD_CUBLAS_TO_TARGET( cuda_target )
-# -- Adds the cublas library to the target (can be any target). Handles
-# whether you are in emulation mode or not.
-#
-# CUDA_ADD_EXECUTABLE( cuda_target file0 file1 ...
-# [WIN32] [MACOSX_BUNDLE] [EXCLUDE_FROM_ALL] [OPTIONS ...] )
-# -- Creates an executable "cuda_target" which is made up of the files
-# specified. All of the non CUDA C files are compiled using the standard
-# build rules specified by CMAKE and the cuda files are compiled to object
-# files using nvcc and the host compiler. In addition CUDA_INCLUDE_DIRS is
-# added automatically to include_directories(). Some standard CMake target
-# calls can be used on the target after calling this macro
-# (e.g. set_target_properties and target_link_libraries), but setting
-# properties that adjust compilation flags will not affect code compiled by
-# nvcc. Such flags should be modified before calling CUDA_ADD_EXECUTABLE,
-# CUDA_ADD_LIBRARY or CUDA_WRAP_SRCS.
-#
-# CUDA_ADD_LIBRARY( cuda_target file0 file1 ...
-# [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] [OPTIONS ...] )
-# -- Same as CUDA_ADD_EXECUTABLE except that a library is created.
-#
-# CUDA_BUILD_CLEAN_TARGET()
-# -- Creates a convience target that deletes all the dependency files
-# generated. You should make clean after running this target to ensure the
-# dependency files get regenerated.
-#
-# CUDA_COMPILE( generated_files file0 file1 ... [STATIC | SHARED | MODULE]
-# [OPTIONS ...] )
-# -- Returns a list of generated files from the input source files to be used
-# with ADD_LIBRARY or ADD_EXECUTABLE.
-#
-# CUDA_COMPILE_PTX( generated_files file0 file1 ... [OPTIONS ...] )
-# -- Returns a list of PTX files generated from the input source files.
-#
-# CUDA_INCLUDE_DIRECTORIES( path0 path1 ... )
-# -- Sets the directories that should be passed to nvcc
-# (e.g. nvcc -Ipath0 -Ipath1 ... ). These paths usually contain other .cu
-# files.
-#
-# CUDA_WRAP_SRCS ( cuda_target format generated_files file0 file1 ...
-# [STATIC | SHARED | MODULE] [OPTIONS ...] )
-# -- This is where all the magic happens. CUDA_ADD_EXECUTABLE,
-# CUDA_ADD_LIBRARY, CUDA_COMPILE, and CUDA_COMPILE_PTX all call this
-# function under the hood.
-#
-# Given the list of files (file0 file1 ... fileN) this macro generates
-# custom commands that generate either PTX or linkable objects (use "PTX" or
-# "OBJ" for the format argument to switch). Files that don't end with .cu
-# or have the HEADER_FILE_ONLY property are ignored.
-#
-# The arguments passed in after OPTIONS are extra command line options to
-# give to nvcc. You can also specify per configuration options by
-# specifying the name of the configuration followed by the options. General
-# options must preceed configuration specific options. Not all
-# configurations need to be specified, only the ones provided will be used.
-#
-# OPTIONS -DFLAG=2 "-DFLAG_OTHER=space in flag"
-# DEBUG -g
-# RELEASE --use_fast_math
-# RELWITHDEBINFO --use_fast_math;-g
-# MINSIZEREL --use_fast_math
-#
-# For certain configurations (namely VS generating object files with
-# CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE set to ON), no generated file will
-# be produced for the given cuda file. This is because when you add the
-# cuda file to Visual Studio it knows that this file produces an object file
-# and will link in the resulting object file automatically.
-#
-# This script will also generate a separate cmake script that is used at
-# build time to invoke nvcc. This is for serveral reasons.
-#
-# 1. nvcc can return negative numbers as return values which confuses
-# Visual Studio into thinking that the command succeeded. The script now
-# checks the error codes and produces errors when there was a problem.
-#
-# 2. nvcc has been known to not delete incomplete results when it
-# encounters problems. This confuses build systems into thinking the
-# target was generated when in fact an unusable file exists. The script
-# now deletes the output files if there was an error.
-#
-# 3. By putting all the options that affect the build into a file and then
-# make the build rule dependent on the file, the output files will be
-# regenerated when the options change.
-#
-# This script also looks at optional arguments STATIC, SHARED, or MODULE to
-# determine when to target the object compilation for a shared library.
-# BUILD_SHARED_LIBS is ignored in CUDA_WRAP_SRCS, but it is respected in
-# CUDA_ADD_LIBRARY. On some systems special flags are added for building
-# objects intended for shared libraries. A preprocessor macro,
-# <target_name>_EXPORTS is defined when a shared library compilation is
-# detected.
-#
-# Flags passed into add_definitions with -D or /D are passed along to nvcc.
-#
-# The script defines the following variables:
-#
-# CUDA_VERSION_MAJOR -- The major version of cuda as reported by nvcc.
-# CUDA_VERSION_MINOR -- The minor version.
-# CUDA_VERSION
-# CUDA_VERSION_STRING -- CUDA_VERSION_MAJOR.CUDA_VERSION_MINOR
-#
-# CUDA_TOOLKIT_ROOT_DIR -- Path to the CUDA Toolkit (defined if not set).
-# CUDA_SDK_ROOT_DIR -- Path to the CUDA SDK. Use this to find files in the
-# SDK. This script will not directly support finding
-# specific libraries or headers, as that isn't
-# supported by NVIDIA. If you want to change
-# libraries when the path changes see the
-# FindCUDA.cmake script for an example of how to clear
-# these variables. There are also examples of how to
-# use the CUDA_SDK_ROOT_DIR to locate headers or
-# libraries, if you so choose (at your own risk).
-# CUDA_INCLUDE_DIRS -- Include directory for cuda headers. Added automatically
-# for CUDA_ADD_EXECUTABLE and CUDA_ADD_LIBRARY.
-# CUDA_LIBRARIES -- Cuda RT library.
-# CUDA_CUFFT_LIBRARIES -- Device or emulation library for the Cuda FFT
-# implementation (alternative to:
-# CUDA_ADD_CUFFT_TO_TARGET macro)
-# CUDA_CUBLAS_LIBRARIES -- Device or emulation library for the Cuda BLAS
-# implementation (alterative to:
-# CUDA_ADD_CUBLAS_TO_TARGET macro).
-#
-#
-# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
-# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
-#
-# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
-#
-# Copyright (c) 2007-2009
-# Scientific Computing and Imaging Institute, University of Utah
-#
-# This code is licensed under the MIT License. See the FindCUDA.cmake script
-# for the text of the license.
-
-# The MIT License
-#
-# License for the specific language governing rights and limitations under
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-#
-###############################################################################
-
-# FindCUDA.cmake
-
-# We need to have at least this version to support the VERSION_LESS argument to 'if' (2.6.2) and unset (2.6.3)
-cmake_policy(PUSH)
-cmake_minimum_required(VERSION 2.6.3)
-cmake_policy(POP)
-
-# This macro helps us find the location of helper files we will need the full path to
-macro(CUDA_FIND_HELPER_FILE _name _extension)
- set(_full_name "${_name}.${_extension}")
- # CMAKE_CURRENT_LIST_FILE contains the full path to the file currently being
- # processed. Using this variable, we can pull out the current path, and
- # provide a way to get access to the other files we need local to here.
- get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
- find_file(CUDA_${_name} ${_full_name} PATHS ${CMAKE_CURRENT_LIST_DIR}/FindCUDA NO_DEFAULT_PATH)
- if(NOT CUDA_${_name})
- set(error_message "${_full_name} not found in CMAKE_MODULE_PATH")
- if(CUDA_FIND_REQUIRED)
- message(FATAL_ERROR "${error_message}")
- else(CUDA_FIND_REQUIRED)
- if(NOT CUDA_FIND_QUIETLY)
- message(STATUS "${error_message}")
- endif(NOT CUDA_FIND_QUIETLY)
- endif(CUDA_FIND_REQUIRED)
- endif(NOT CUDA_${_name})
- # Set this variable as internal, so the user isn't bugged with it.
- set(CUDA_${_name} ${CUDA_${_name}} CACHE INTERNAL "Location of ${_full_name}" FORCE)
-endmacro(CUDA_FIND_HELPER_FILE)
-
-#####################################################################
-## CUDA_INCLUDE_NVCC_DEPENDENCIES
-##
-
-# So we want to try and include the dependency file if it exists. If
-# it doesn't exist then we need to create an empty one, so we can
-# include it.
-
-# If it does exist, then we need to check to see if all the files it
-# depends on exist. If they don't then we should clear the dependency
-# file and regenerate it later. This covers the case where a header
-# file has disappeared or moved.
-
-macro(CUDA_INCLUDE_NVCC_DEPENDENCIES dependency_file)
- set(CUDA_NVCC_DEPEND)
- set(CUDA_NVCC_DEPEND_REGENERATE FALSE)
-
-
- # Include the dependency file. Create it first if it doesn't exist . The
- # INCLUDE puts a dependency that will force CMake to rerun and bring in the
- # new info when it changes. DO NOT REMOVE THIS (as I did and spent a few
- # hours figuring out why it didn't work.
- if(NOT EXISTS ${dependency_file})
- file(WRITE ${dependency_file} "#FindCUDA.cmake generated file. Do not edit.\n")
- endif()
- # Always include this file to force CMake to run again next
- # invocation and rebuild the dependencies.
- #message("including dependency_file = ${dependency_file}")
- include(${dependency_file})
-
- # Now we need to verify the existence of all the included files
- # here. If they aren't there we need to just blank this variable and
- # make the file regenerate again.
-# if(DEFINED CUDA_NVCC_DEPEND)
-# message("CUDA_NVCC_DEPEND set")
-# else()
-# message("CUDA_NVCC_DEPEND NOT set")
-# endif()
- if(CUDA_NVCC_DEPEND)
- #message("CUDA_NVCC_DEPEND true")
- foreach(f ${CUDA_NVCC_DEPEND})
- #message("searching for ${f}")
- if(NOT EXISTS ${f})
- #message("file ${f} not found")
- set(CUDA_NVCC_DEPEND_REGENERATE TRUE)
- endif()
- endforeach(f)
- else(CUDA_NVCC_DEPEND)
- #message("CUDA_NVCC_DEPEND false")
- # No dependencies, so regenerate the file.
- set(CUDA_NVCC_DEPEND_REGENERATE TRUE)
- endif(CUDA_NVCC_DEPEND)
-
- #message("CUDA_NVCC_DEPEND_REGENERATE = ${CUDA_NVCC_DEPEND_REGENERATE}")
- # No incoming dependencies, so we need to generate them. Make the
- # output depend on the dependency file itself, which should cause the
- # rule to re-run.
- if(CUDA_NVCC_DEPEND_REGENERATE)
- file(WRITE ${dependency_file} "#FindCUDA.cmake generated file. Do not edit.\n")
- endif(CUDA_NVCC_DEPEND_REGENERATE)
-
-endmacro(CUDA_INCLUDE_NVCC_DEPENDENCIES)
-
-###############################################################################
-###############################################################################
-# Setup variables' defaults
-###############################################################################
-###############################################################################
-
-# Allow the user to specify if the device code is supposed to be 32 or 64 bit.
-if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- set(CUDA_64_BIT_DEVICE_CODE_DEFAULT ON)
-else()
- set(CUDA_64_BIT_DEVICE_CODE_DEFAULT OFF)
-endif()
-option(CUDA_64_BIT_DEVICE_CODE "Compile device code in 64 bit mode" ${CUDA_64_BIT_DEVICE_CODE_DEFAULT})
-
-# Attach the build rule to the source file in VS. This option
-option(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE "Attach the build rule to the CUDA source file. Enable only when the CUDA source file is added to at most one target." ON)
-
-# Prints out extra information about the cuda file during compilation
-option(CUDA_BUILD_CUBIN "Generate and parse .cubin files in Device mode." OFF)
-
-# Set whether we are using emulation or device mode.
-option(CUDA_BUILD_EMULATION "Build in Emulation mode" OFF)
-
-# Where to put the generated output.
-set(CUDA_GENERATED_OUTPUT_DIR "" CACHE PATH "Directory to put all the output files. If blank it will default to the CMAKE_CURRENT_BINARY_DIR")
-
-# Parse HOST_COMPILATION mode.
-option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON)
-
-# Extra user settable flags
-set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.")
-
-# Propagate the host flags to the host compiler via -Xcompiler
-option(CUDA_PROPAGATE_HOST_FLAGS "Propage C/CXX_FLAGS and friends to the host compiler via -Xcompile" ON)
-
-# Specifies whether the commands used when compiling the .cu file will be printed out.
-option(CUDA_VERBOSE_BUILD "Print out the commands run while compiling the CUDA source file. With the Makefile generator this defaults to VERBOSE variable specified on the command line, but can be forced on with this option." OFF)
-
-mark_as_advanced(
- CUDA_64_BIT_DEVICE_CODE
- CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE
- CUDA_GENERATED_OUTPUT_DIR
- CUDA_HOST_COMPILATION_CPP
- CUDA_NVCC_FLAGS
- CUDA_PROPAGATE_HOST_FLAGS
- )
-
-# Makefile and similar generators don't define CMAKE_CONFIGURATION_TYPES, so we
-# need to add another entry for the CMAKE_BUILD_TYPE. We also need to add the
-# standerd set of 4 build types (Debug, MinSizeRel, Release, and RelWithDebInfo)
-# for completeness. We need run this loop in order to accomodate the addition
-# of extra configuration types. Duplicate entries will be removed by
-# REMOVE_DUPLICATES.
-set(CUDA_configuration_types ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE} Debug MinSizeRel Release RelWithDebInfo)
-list(REMOVE_DUPLICATES CUDA_configuration_types)
-foreach(config ${CUDA_configuration_types})
- string(TOUPPER ${config} config_upper)
- set(CUDA_NVCC_FLAGS_${config_upper} "" CACHE STRING "Semi-colon delimit multiple arguments.")
- mark_as_advanced(CUDA_NVCC_FLAGS_${config_upper})
-endforeach()
-
-###############################################################################
-###############################################################################
-# Locate CUDA, Set Build Type, etc.
-###############################################################################
-###############################################################################
-
-# Check to see if the CUDA_TOOLKIT_ROOT_DIR and CUDA_SDK_ROOT_DIR have changed,
-# if they have then clear the cache variables, so that will be detected again.
-if(NOT "${CUDA_TOOLKIT_ROOT_DIR}" STREQUAL "${CUDA_TOOLKIT_ROOT_DIR_INTERNAL}")
- unset(CUDA_NVCC_EXECUTABLE CACHE)
- unset(CUDA_VERSION CACHE)
- unset(CUDA_TOOLKIT_INCLUDE CACHE)
- unset(CUDA_CUDART_LIBRARY CACHE)
- if(CUDA_VERSION VERSION_EQUAL "3.0")
- # This only existed in the 3.0 version of the CUDA toolkit
- unset(CUDA_CUDARTEMU_LIBRARY CACHE)
- endif()
- unset(CUDA_CUDA_LIBRARY CACHE)
- unset(CUDA_cublas_LIBRARY CACHE)
- unset(CUDA_cublasemu_LIBRARY CACHE)
- unset(CUDA_cufft_LIBRARY CACHE)
- unset(CUDA_cufftemu_LIBRARY CACHE)
-endif()
-
-if(NOT "${CUDA_SDK_ROOT_DIR}" STREQUAL "${CUDA_SDK_ROOT_DIR_INTERNAL}")
- # No specific variables to catch. Use this kind of code before calling
- # find_package(CUDA) to clean up any variables that may depend on this path.
-
- # unset(MY_SPECIAL_CUDA_SDK_INCLUDE_DIR CACHE)
- # unset(MY_SPECIAL_CUDA_SDK_LIBRARY CACHE)
-endif()
-
-# Search for the cuda distribution.
-if(NOT CUDA_TOOLKIT_ROOT_DIR)
-
- # Search in the CUDA_BIN_PATH first.
- find_path(CUDA_TOOLKIT_ROOT_DIR
- NAMES nvcc nvcc.exe
- PATHS ENV CUDA_BIN_PATH
- DOC "Toolkit location."
- NO_DEFAULT_PATH
- )
- # Now search default paths
- find_path(CUDA_TOOLKIT_ROOT_DIR
- NAMES nvcc nvcc.exe
- PATHS /usr/local/bin
- /usr/local/cuda/bin
- DOC "Toolkit location."
- )
-
- if (CUDA_TOOLKIT_ROOT_DIR)
- string(REGEX REPLACE "[/\\\\]?bin[64]*[/\\\\]?$" "" CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR})
- # We need to force this back into the cache.
- set(CUDA_TOOLKIT_ROOT_DIR ${CUDA_TOOLKIT_ROOT_DIR} CACHE PATH "Toolkit location." FORCE)
- endif(CUDA_TOOLKIT_ROOT_DIR)
- if (NOT EXISTS ${CUDA_TOOLKIT_ROOT_DIR})
- if(CUDA_FIND_REQUIRED)
- message(FATAL_ERROR "Specify CUDA_TOOLKIT_ROOT_DIR")
- elseif(NOT CUDA_FIND_QUIETLY)
- message("CUDA_TOOLKIT_ROOT_DIR not found or specified")
- endif()
- endif (NOT EXISTS ${CUDA_TOOLKIT_ROOT_DIR})
-endif (NOT CUDA_TOOLKIT_ROOT_DIR)
-
-# CUDA_NVCC_EXECUTABLE
-find_program(CUDA_NVCC_EXECUTABLE
- NAMES nvcc
- PATHS "${CUDA_TOOLKIT_ROOT_DIR}/bin"
- "${CUDA_TOOLKIT_ROOT_DIR}/bin64"
- ENV CUDA_BIN_PATH
- NO_DEFAULT_PATH
- )
-# Search default search paths, after we search our own set of paths.
-find_program(CUDA_NVCC_EXECUTABLE nvcc)
-mark_as_advanced(CUDA_NVCC_EXECUTABLE)
-
-if(CUDA_NVCC_EXECUTABLE AND NOT CUDA_VERSION)
- # Compute the version.
- execute_process (COMMAND ${CUDA_NVCC_EXECUTABLE} "--version" OUTPUT_VARIABLE NVCC_OUT)
- string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR ${NVCC_OUT})
- string(REGEX REPLACE ".*release ([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR ${NVCC_OUT})
- set(CUDA_VERSION "${CUDA_VERSION_MAJOR}.${CUDA_VERSION_MINOR}" CACHE STRING "Version of CUDA as computed from nvcc.")
- mark_as_advanced(CUDA_VERSION)
-else()
- # Need to set these based off of the cached value
- string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\1" CUDA_VERSION_MAJOR "${CUDA_VERSION}")
- string(REGEX REPLACE "([0-9]+)\\.([0-9]+).*" "\\2" CUDA_VERSION_MINOR "${CUDA_VERSION}")
-endif()
-
-# Always set this convenience variable
-set(CUDA_VERSION_STRING "${CUDA_VERSION}")
-
-# Here we need to determine if the version we found is acceptable. We will
-# assume that is unless CUDA_FIND_VERSION_EXACT or CUDA_FIND_VERSION is
-# specified. The presence of either of these options checks the version
-# string and signals if the version is acceptable or not.
-set(_cuda_version_acceptable TRUE)
-#
-if(CUDA_FIND_VERSION_EXACT AND NOT CUDA_VERSION VERSION_EQUAL CUDA_FIND_VERSION)
- set(_cuda_version_acceptable FALSE)
-endif()
-#
-if(CUDA_FIND_VERSION AND CUDA_VERSION VERSION_LESS CUDA_FIND_VERSION)
- set(_cuda_version_acceptable FALSE)
-endif()
-#
-if(NOT _cuda_version_acceptable)
- set(_cuda_error_message "Requested CUDA version ${CUDA_FIND_VERSION}, but found unacceptable version ${CUDA_VERSION}")
- if(CUDA_FIND_REQUIRED)
- message("${_cuda_error_message}")
- elseif(NOT CUDA_FIND_QUIETLY)
- message("${_cuda_error_message}")
- endif()
-endif()
-
-# CUDA_TOOLKIT_INCLUDE
-find_path(CUDA_TOOLKIT_INCLUDE
- device_functions.h # Header included in toolkit
- PATHS "${CUDA_TOOLKIT_ROOT_DIR}/include"
- ENV CUDA_INC_PATH
- NO_DEFAULT_PATH
- )
-# Search default search paths, after we search our own set of paths.
-find_path(CUDA_TOOLKIT_INCLUDE device_functions.h)
-mark_as_advanced(CUDA_TOOLKIT_INCLUDE)
-
-# Set the user list of include dir to nothing to initialize it.
-set (CUDA_NVCC_INCLUDE_ARGS_USER "")
-set (CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE})
-
-macro(FIND_LIBRARY_LOCAL_FIRST _var _names _doc)
- if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- set(_cuda_64bit_lib_dir "${CUDA_TOOLKIT_ROOT_DIR}/lib64")
- endif()
- find_library(${_var}
- NAMES ${_names}
- PATHS ${_cuda_64bit_lib_dir}
- "${CUDA_TOOLKIT_ROOT_DIR}/lib"
- ENV CUDA_LIB_PATH
- DOC ${_doc}
- NO_DEFAULT_PATH
- )
- # Search default search paths, after we search our own set of paths.
- find_library(${_var} NAMES ${_names} DOC ${_doc})
-endmacro()
-
-# CUDA_LIBRARIES
-find_library_local_first(CUDA_CUDART_LIBRARY cudart "\"cudart\" library")
-if(CUDA_VERSION VERSION_EQUAL "3.0")
- # The cudartemu library only existed for the 3.0 version of CUDA.
- find_library_local_first(CUDA_CUDARTEMU_LIBRARY cudartemu "\"cudartemu\" library")
- mark_as_advanced(
- CUDA_CUDARTEMU_LIBRARY
- )
-endif()
-# If we are using emulation mode and we found the cudartemu library then use
-# that one instead of cudart.
-if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY)
- set(CUDA_LIBRARIES ${CUDA_CUDARTEMU_LIBRARY})
-else()
- set(CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY})
-endif()
-if(APPLE)
- # We need to add the path to cudart to the linker using rpath, since the
- # library name for the cuda libraries is prepended with @rpath.
- if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY)
- get_filename_component(_cuda_path_to_cudart "${CUDA_CUDARTEMU_LIBRARY}" PATH)
- else()
- get_filename_component(_cuda_path_to_cudart "${CUDA_CUDART_LIBRARY}" PATH)
- endif()
- if(_cuda_path_to_cudart)
- list(APPEND CUDA_LIBRARIES -Wl,-rpath "-Wl,${_cuda_path_to_cudart}")
- endif()
-endif()
-
-# 1.1 toolkit on linux doesn't appear to have a separate library on
-# some platforms.
-find_library_local_first(CUDA_CUDA_LIBRARY cuda "\"cuda\" library (older versions only).")
-
-# Add cuda library to the link line only if it is found.
-if (CUDA_CUDA_LIBRARY)
- set(CUDA_LIBRARIES ${CUDA_LIBRARIES} ${CUDA_CUDA_LIBRARY})
-endif(CUDA_CUDA_LIBRARY)
-
-mark_as_advanced(
- CUDA_CUDA_LIBRARY
- CUDA_CUDART_LIBRARY
- )
-
-#######################
-# Look for some of the toolkit helper libraries
-macro(FIND_CUDA_HELPER_LIBS _name)
- find_library_local_first(CUDA_${_name}_LIBRARY ${_name} "\"${_name}\" library")
- mark_as_advanced(CUDA_${_name}_LIBRARY)
-endmacro(FIND_CUDA_HELPER_LIBS)
-
-# Search for cufft and cublas libraries.
-find_cuda_helper_libs(cufftemu)
-find_cuda_helper_libs(cublasemu)
-find_cuda_helper_libs(cufft)
-find_cuda_helper_libs(cublas)
-
-if (CUDA_BUILD_EMULATION)
- set(CUDA_CUFFT_LIBRARIES ${CUDA_cufftemu_LIBRARY})
- set(CUDA_CUBLAS_LIBRARIES ${CUDA_cublasemu_LIBRARY})
-else()
- set(CUDA_CUFFT_LIBRARIES ${CUDA_cufft_LIBRARY})
- set(CUDA_CUBLAS_LIBRARIES ${CUDA_cublas_LIBRARY})
-endif()
-
-########################
-# Look for the SDK stuff
-find_path(CUDA_SDK_ROOT_DIR common/inc/cutil.h
- "$ENV{NVSDKCUDA_ROOT}"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\NVIDIA Corporation\\Installed Products\\NVIDIA SDK 10\\Compute;InstallDir]"
- "/Developer/GPU\ Computing/C"
- )
-
-# Keep the CUDA_SDK_ROOT_DIR first in order to be able to override the
-# environment variables.
-set(CUDA_SDK_SEARCH_PATH
- "${CUDA_SDK_ROOT_DIR}"
- "${CUDA_TOOLKIT_ROOT_DIR}/local/NVSDK0.2"
- "${CUDA_TOOLKIT_ROOT_DIR}/NVSDK0.2"
- "${CUDA_TOOLKIT_ROOT_DIR}/NV_CUDA_SDK"
- "$ENV{HOME}/NVIDIA_CUDA_SDK"
- "$ENV{HOME}/NVIDIA_CUDA_SDK_MACOSX"
- "/Developer/CUDA"
- )
-
-# Example of how to find an include file from the CUDA_SDK_ROOT_DIR
-
-# find_path(CUDA_CUT_INCLUDE_DIR
-# cutil.h
-# PATHS ${CUDA_SDK_SEARCH_PATH}
-# PATH_SUFFIXES "common/inc"
-# DOC "Location of cutil.h"
-# NO_DEFAULT_PATH
-# )
-# # Now search system paths
-# find_path(CUDA_CUT_INCLUDE_DIR cutil.h DOC "Location of cutil.h")
-
-# mark_as_advanced(CUDA_CUT_INCLUDE_DIR)
-
-
-# Example of how to find a library in the CUDA_SDK_ROOT_DIR
-
-# # cutil library is called cutil64 for 64 bit builds on windows. We don't want
-# # to get these confused, so we are setting the name based on the word size of
-# # the build.
-
-# if(CMAKE_SIZEOF_VOID_P EQUAL 8)
-# set(cuda_cutil_name cutil64)
-# else(CMAKE_SIZEOF_VOID_P EQUAL 8)
-# set(cuda_cutil_name cutil32)
-# endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
-
-# find_library(CUDA_CUT_LIBRARY
-# NAMES cutil ${cuda_cutil_name}
-# PATHS ${CUDA_SDK_SEARCH_PATH}
-# # The new version of the sdk shows up in common/lib, but the old one is in lib
-# PATH_SUFFIXES "common/lib" "lib"
-# DOC "Location of cutil library"
-# NO_DEFAULT_PATH
-# )
-# # Now search system paths
-# find_library(CUDA_CUT_LIBRARY NAMES cutil ${cuda_cutil_name} DOC "Location of cutil library")
-# mark_as_advanced(CUDA_CUT_LIBRARY)
-# set(CUDA_CUT_LIBRARIES ${CUDA_CUT_LIBRARY})
-
-
-
-#############################
-# Check for required components
-set(CUDA_FOUND TRUE)
-
-set(CUDA_TOOLKIT_ROOT_DIR_INTERNAL "${CUDA_TOOLKIT_ROOT_DIR}" CACHE INTERNAL
- "This is the value of the last time CUDA_TOOLKIT_ROOT_DIR was set successfully." FORCE)
-set(CUDA_SDK_ROOT_DIR_INTERNAL "${CUDA_SDK_ROOT_DIR}" CACHE INTERNAL
- "This is the value of the last time CUDA_SDK_ROOT_DIR was set successfully." FORCE)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(CUDA DEFAULT_MSG
- CUDA_TOOLKIT_ROOT_DIR
- CUDA_NVCC_EXECUTABLE
- CUDA_INCLUDE_DIRS
- CUDA_CUDART_LIBRARY
- _cuda_version_acceptable
- )
-
-
-
-###############################################################################
-###############################################################################
-# Macros
-###############################################################################
-###############################################################################
-
-###############################################################################
-# Add include directories to pass to the nvcc command.
-macro(CUDA_INCLUDE_DIRECTORIES)
- foreach(dir ${ARGN})
- list(APPEND CUDA_NVCC_INCLUDE_ARGS_USER "-I${dir}")
- endforeach(dir ${ARGN})
-endmacro(CUDA_INCLUDE_DIRECTORIES)
-
-
-##############################################################################
-cuda_find_helper_file(parse_cubin cmake)
-cuda_find_helper_file(make2cmake cmake)
-cuda_find_helper_file(run_nvcc cmake)
-
-##############################################################################
-# Separate the OPTIONS out from the sources
-#
-macro(CUDA_GET_SOURCES_AND_OPTIONS _sources _cmake_options _options)
- set( ${_sources} )
- set( ${_cmake_options} )
- set( ${_options} )
- set( _found_options FALSE )
- foreach(arg ${ARGN})
- if(arg STREQUAL "OPTIONS")
- set( _found_options TRUE )
- elseif(
- arg STREQUAL "WIN32" OR
- arg STREQUAL "MACOSX_BUNDLE" OR
- arg STREQUAL "EXCLUDE_FROM_ALL" OR
- arg STREQUAL "STATIC" OR
- arg STREQUAL "SHARED" OR
- arg STREQUAL "MODULE"
- )
- list(APPEND ${_cmake_options} "${arg}")
- else()
- if ( _found_options )
- list(APPEND ${_options} "${arg}")
- else()
- # Assume this is a file
- list(APPEND ${_sources} "${arg}")
- endif()
- endif()
- endforeach()
-endmacro()
-
-##############################################################################
-# Parse the OPTIONS from ARGN and set the variables prefixed by _option_prefix
-#
-macro(CUDA_PARSE_NVCC_OPTIONS _option_prefix)
- set( _found_config )
- foreach(arg ${ARGN})
- # Determine if we are dealing with a perconfiguration flag
- foreach(config ${CUDA_configuration_types})
- string(TOUPPER ${config} config_upper)
- if (arg STREQUAL "${config_upper}")
- set( _found_config _${arg})
- # Set arg to nothing to keep it from being processed further
- set( arg )
- endif()
- endforeach()
-
- if ( arg )
- list(APPEND ${_option_prefix}${_found_config} "${arg}")
- endif()
- endforeach()
-endmacro()
-
-##############################################################################
-# Helper to add the include directory for CUDA only once
-function(CUDA_ADD_CUDA_INCLUDE_ONCE)
- get_directory_property(_include_directories INCLUDE_DIRECTORIES)
- set(_add TRUE)
- if(_include_directories)
- foreach(dir ${_include_directories})
- if("${dir}" STREQUAL "${CUDA_INCLUDE_DIRS}")
- set(_add FALSE)
- endif()
- endforeach()
- endif()
- if(_add)
- include_directories(${CUDA_INCLUDE_DIRS})
- endif()
-endfunction()
-
-function(CUDA_BUILD_SHARED_LIBRARY shared_flag)
- set(cmake_args ${ARGN})
- # If SHARED, MODULE, or STATIC aren't already in the list of arguments, then
- # add SHARED or STATIC based on the value of BUILD_SHARED_LIBS.
- list(FIND cmake_args SHARED _cuda_found_SHARED)
- list(FIND cmake_args MODULE _cuda_found_MODULE)
- list(FIND cmake_args STATIC _cuda_found_STATIC)
- if( _cuda_found_SHARED GREATER -1 OR
- _cuda_found_MODULE GREATER -1 OR
- _cuda_found_STATIC GREATER -1)
- set(_cuda_build_shared_libs)
- else()
- if (BUILD_SHARED_LIBS)
- set(_cuda_build_shared_libs SHARED)
- else()
- set(_cuda_build_shared_libs STATIC)
- endif()
- endif()
- set(${shared_flag} ${_cuda_build_shared_libs} PARENT_SCOPE)
-endfunction()
-
-##############################################################################
-# This helper macro populates the following variables and setups up custom
-# commands and targets to invoke the nvcc compiler to generate C or PTX source
-# dependant upon the format parameter. The compiler is invoked once with -M
-# to generate a dependency file and a second time with -cuda or -ptx to generate
-# a .cpp or .ptx file.
-# INPUT:
-# cuda_target - Target name
-# format - PTX or OBJ
-# FILE1 .. FILEN - The remaining arguments are the sources to be wrapped.
-# OPTIONS - Extra options to NVCC
-# OUTPUT:
-# generated_files - List of generated files
-##############################################################################
-##############################################################################
-
-macro(CUDA_WRAP_SRCS cuda_target format generated_files)
-
- if( ${format} MATCHES "PTX" )
- set( compile_to_ptx ON )
- elseif( ${format} MATCHES "OBJ")
- set( compile_to_ptx OFF )
- else()
- message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS: '${format}'. Use OBJ or PTX.")
- endif()
-
- # Set up all the command line flags here, so that they can be overriden on a per target basis.
-
- set(nvcc_flags "")
-
- # Emulation if the card isn't present.
- if (CUDA_BUILD_EMULATION)
- # Emulation.
- set(nvcc_flags ${nvcc_flags} --device-emulation -D_DEVICEEMU -g)
- else(CUDA_BUILD_EMULATION)
- # Device mode. No flags necessary.
- endif(CUDA_BUILD_EMULATION)
-
- if(CUDA_HOST_COMPILATION_CPP)
- set(CUDA_C_OR_CXX CXX)
- else(CUDA_HOST_COMPILATION_CPP)
- if(CUDA_VERSION VERSION_LESS "3.0")
- set(nvcc_flags ${nvcc_flags} --host-compilation C)
- else()
- message(WARNING "--host-compilation flag is deprecated in CUDA version >= 3.0. Removing --host-compilation C flag" )
- endif()
- set(CUDA_C_OR_CXX C)
- endif(CUDA_HOST_COMPILATION_CPP)
-
- set(generated_extension ${CMAKE_${CUDA_C_OR_CXX}_OUTPUT_EXTENSION})
-
- if(CUDA_64_BIT_DEVICE_CODE)
- set(nvcc_flags ${nvcc_flags} -m64)
- else()
- set(nvcc_flags ${nvcc_flags} -m32)
- endif()
-
- # This needs to be passed in at this stage, because VS needs to fill out the
- # value of VCInstallDir from within VS.
- if(CMAKE_GENERATOR MATCHES "Visual Studio")
- if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
- # Add nvcc flag for 64b Windows
- set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" )
- endif()
- endif()
-
- # Figure out which configure we will use and pass that in as an argument to
- # the script. We need to defer the decision until compilation time, because
- # for VS projects we won't know if we are making a debug or release build
- # until build time.
- if(CMAKE_GENERATOR MATCHES "Visual Studio")
- set( CUDA_build_configuration "$(ConfigurationName)" )
- else()
- set( CUDA_build_configuration "${CMAKE_BUILD_TYPE}")
- endif()
-
- # Initialize our list of includes with the user ones followed by the CUDA system ones.
- set(CUDA_NVCC_INCLUDE_ARGS ${CUDA_NVCC_INCLUDE_ARGS_USER} "-I${CUDA_INCLUDE_DIRS}")
- # Get the include directories for this directory and use them for our nvcc command.
- get_directory_property(CUDA_NVCC_INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES)
- if(CUDA_NVCC_INCLUDE_DIRECTORIES)
- foreach(dir ${CUDA_NVCC_INCLUDE_DIRECTORIES})
- list(APPEND CUDA_NVCC_INCLUDE_ARGS "-I${dir}")
- endforeach()
- endif()
-
- # Reset these variables
- set(CUDA_WRAP_OPTION_NVCC_FLAGS)
- foreach(config ${CUDA_configuration_types})
- string(TOUPPER ${config} config_upper)
- set(CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper})
- endforeach()
-
- CUDA_GET_SOURCES_AND_OPTIONS(_cuda_wrap_sources _cuda_wrap_cmake_options _cuda_wrap_options ${ARGN})
- CUDA_PARSE_NVCC_OPTIONS(CUDA_WRAP_OPTION_NVCC_FLAGS ${_cuda_wrap_options})
-
- # Figure out if we are building a shared library. BUILD_SHARED_LIBS is
- # respected in CUDA_ADD_LIBRARY.
- set(_cuda_build_shared_libs FALSE)
- # SHARED, MODULE
- list(FIND _cuda_wrap_cmake_options SHARED _cuda_found_SHARED)
- list(FIND _cuda_wrap_cmake_options MODULE _cuda_found_MODULE)
- if(_cuda_found_SHARED GREATER -1 OR _cuda_found_MODULE GREATER -1)
- set(_cuda_build_shared_libs TRUE)
- endif()
- # STATIC
- list(FIND _cuda_wrap_cmake_options STATIC _cuda_found_STATIC)
- if(_cuda_found_STATIC GREATER -1)
- set(_cuda_build_shared_libs FALSE)
- endif()
-
- # CUDA_HOST_FLAGS
- if(_cuda_build_shared_libs)
- # If we are setting up code for a shared library, then we need to add extra flags for
- # compiling objects for shared libraries.
- set(CUDA_HOST_SHARED_FLAGS ${CMAKE_SHARED_LIBRARY_${CUDA_C_OR_CXX}_FLAGS})
- else()
- set(CUDA_HOST_SHARED_FLAGS)
- endif()
- # Only add the CMAKE_{C,CXX}_FLAGS if we are propagating host flags. We
- # always need to set the SHARED_FLAGS, though.
- if(CUDA_PROPAGATE_HOST_FLAGS)
- set(CUDA_HOST_FLAGS "set(CMAKE_HOST_FLAGS ${CMAKE_${CUDA_C_OR_CXX}_FLAGS} ${CUDA_HOST_SHARED_FLAGS})")
- else()
- set(CUDA_HOST_FLAGS "set(CMAKE_HOST_FLAGS ${CUDA_HOST_SHARED_FLAGS})")
- endif()
-
- set(CUDA_NVCC_FLAGS_CONFIG "# Build specific configuration flags")
- # Loop over all the configuration types to generate appropriate flags for run_nvcc.cmake
- foreach(config ${CUDA_configuration_types})
- string(TOUPPER ${config} config_upper)
- # CMAKE_FLAGS are strings and not lists. By not putting quotes around CMAKE_FLAGS
- # we convert the strings to lists (like we want).
-
- if(CUDA_PROPAGATE_HOST_FLAGS)
- # nvcc chokes on -g3, so replace it with -g
- if(CMAKE_COMPILER_IS_GNUCC)
- string(REPLACE "-g3" "-g" _cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}")
- else()
- set(_cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}")
- endif()
-
- set(CUDA_HOST_FLAGS "${CUDA_HOST_FLAGS}\nset(CMAKE_HOST_FLAGS_${config_upper} ${_cuda_C_FLAGS})")
- endif()
-
- # Note that if we ever want CUDA_NVCC_FLAGS_<CONFIG> to be string (instead of a list
- # like it is currently), we can remove the quotes around the
- # ${CUDA_NVCC_FLAGS_${config_upper}} variable like the CMAKE_HOST_FLAGS_<CONFIG> variable.
- set(CUDA_NVCC_FLAGS_CONFIG "${CUDA_NVCC_FLAGS_CONFIG}\nset(CUDA_NVCC_FLAGS_${config_upper} \"${CUDA_NVCC_FLAGS_${config_upper}};;${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}}\")")
- endforeach()
-
- if(compile_to_ptx)
- # Don't use any of the host compilation flags for PTX targets.
- set(CUDA_HOST_FLAGS)
- set(CUDA_NVCC_FLAGS_CONFIG)
- endif()
-
- # Get the list of definitions from the directory property
- get_directory_property(CUDA_NVCC_DEFINITIONS COMPILE_DEFINITIONS)
- if(CUDA_NVCC_DEFINITIONS)
- foreach(_definition ${CUDA_NVCC_DEFINITIONS})
- list(APPEND nvcc_flags "-D${_definition}")
- endforeach()
- endif()
-
- if(_cuda_build_shared_libs)
- list(APPEND nvcc_flags "-D${cuda_target}_EXPORTS")
- endif()
-
- # Determine output directory
- if(CUDA_GENERATED_OUTPUT_DIR)
- set(cuda_compile_output_dir "${CUDA_GENERATED_OUTPUT_DIR}")
- else()
- set(cuda_compile_output_dir "${CMAKE_CURRENT_BINARY_DIR}")
- endif()
-
- # Reset the output variable
- set(_cuda_wrap_generated_files "")
-
- # Iterate over the macro arguments and create custom
- # commands for all the .cu files.
- foreach(file ${ARGN})
- # Ignore any file marked as a HEADER_FILE_ONLY
- get_source_file_property(_is_header ${file} HEADER_FILE_ONLY)
- if(${file} MATCHES ".*\\.cu$" AND NOT _is_header)
-
- # Add a custom target to generate a c or ptx file. ######################
-
- get_filename_component( basename ${file} NAME )
- if( compile_to_ptx )
- set(generated_file_path "${cuda_compile_output_dir}")
- set(generated_file_basename "${cuda_target}_generated_${basename}.ptx")
- set(format_flag "-ptx")
- file(MAKE_DIRECTORY "${cuda_compile_output_dir}")
- else( compile_to_ptx )
- set(generated_file_path "${cuda_compile_output_dir}/${CMAKE_CFG_INTDIR}")
- set(generated_file_basename "${cuda_target}_generated_${basename}${generated_extension}")
- set(format_flag "-c")
- endif( compile_to_ptx )
-
- # Set all of our file names. Make sure that whatever filenames that have
- # generated_file_path in them get passed in through as a command line
- # argument, so that the ${CMAKE_CFG_INTDIR} gets expanded at run time
- # instead of configure time.
- set(generated_file "${generated_file_path}/${generated_file_basename}")
- set(cmake_dependency_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${generated_file_basename}.depend")
- set(NVCC_generated_dependency_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${generated_file_basename}.NVCC-depend")
- set(generated_cubin_file "${generated_file_path}/${generated_file_basename}.cubin.txt")
- set(custom_target_script "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${generated_file_basename}.cmake")
-
- # Setup properties for obj files:
- if( NOT compile_to_ptx )
- set_source_files_properties("${generated_file}"
- PROPERTIES
- EXTERNAL_OBJECT true # This is an object file not to be compiled, but only be linked.
- )
- endif()
-
- # Don't add CMAKE_CURRENT_SOURCE_DIR if the path is already an absolute path.
- get_filename_component(file_path "${file}" PATH)
- if(IS_ABSOLUTE "${file_path}")
- set(source_file "${file}")
- else()
- set(source_file "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
- endif()
-
- # Bring in the dependencies. Creates a variable CUDA_NVCC_DEPEND #######
- cuda_include_nvcc_dependencies(${cmake_dependency_file})
-
- # Convience string for output ###########################################
- if(CUDA_BUILD_EMULATION)
- set(cuda_build_type "Emulation")
- else(CUDA_BUILD_EMULATION)
- set(cuda_build_type "Device")
- endif(CUDA_BUILD_EMULATION)
-
- # Build the NVCC made dependency file ###################################
- set(build_cubin OFF)
- if ( NOT CUDA_BUILD_EMULATION AND CUDA_BUILD_CUBIN )
- if ( NOT compile_to_ptx )
- set ( build_cubin ON )
- endif( NOT compile_to_ptx )
- endif( NOT CUDA_BUILD_EMULATION AND CUDA_BUILD_CUBIN )
-
- # Configure the build script
- configure_file("${CUDA_run_nvcc}" "${custom_target_script}" @ONLY)
-
- # So if a user specifies the same cuda file as input more than once, you
- # can have bad things happen with dependencies. Here we check an option
- # to see if this is the behavior they want.
- if(CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE)
- set(main_dep MAIN_DEPENDENCY ${source_file})
- else()
- set(main_dep DEPENDS ${source_file})
- endif()
-
- if(CUDA_VERBOSE_BUILD)
- set(verbose_output ON)
- elseif(CMAKE_GENERATOR MATCHES "Makefiles")
- set(verbose_output "$(VERBOSE)")
- else()
- set(verbose_output OFF)
- endif()
-
- # Create up the comment string
- file(RELATIVE_PATH generated_file_relative_path "${CMAKE_BINARY_DIR}" "${generated_file}")
- if(compile_to_ptx)
- set(cuda_build_comment_string "Building NVCC ptx file ${generated_file_relative_path}")
- else()
- set(cuda_build_comment_string "Building NVCC (${cuda_build_type}) object ${generated_file_relative_path}")
- endif()
-
- # Build the generated file and dependency file ##########################
- add_custom_command(
- OUTPUT ${generated_file}
- # These output files depend on the source_file and the contents of cmake_dependency_file
- ${main_dep}
- DEPENDS ${CUDA_NVCC_DEPEND}
- DEPENDS ${custom_target_script}
- # Make sure the output directory exists before trying to write to it.
- COMMAND ${CMAKE_COMMAND} -E make_directory "${generated_file_path}"
- COMMAND ${CMAKE_COMMAND} ARGS
- -D verbose:BOOL=${verbose_output}
- ${ccbin_flags}
- -D build_configuration:STRING=${CUDA_build_configuration}
- -D "generated_file:STRING=${generated_file}"
- -D "generated_cubin_file:STRING=${generated_cubin_file}"
- -P "${custom_target_script}"
- COMMENT "${cuda_build_comment_string}"
- )
-
- # Make sure the build system knows the file is generated.
- set_source_files_properties(${generated_file} PROPERTIES GENERATED TRUE)
-
- # Don't add the object file to the list of generated files if we are using
- # visual studio and we are attaching the build rule to the cuda file. VS
- # will add our object file to the linker automatically for us.
- set(cuda_add_generated_file TRUE)
-
- if(NOT compile_to_ptx AND CMAKE_GENERATOR MATCHES "Visual Studio" AND CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE)
- # Visual Studio 8 crashes when you close the solution when you don't add the object file.
- if(NOT CMAKE_GENERATOR MATCHES "Visual Studio 8")
- #message("Not adding ${generated_file}")
- set(cuda_add_generated_file FALSE)
- endif()
- endif()
-
- if(cuda_add_generated_file)
- list(APPEND _cuda_wrap_generated_files ${generated_file})
- endif()
-
- # Add the other files that we want cmake to clean on a cleanup ##########
- list(APPEND CUDA_ADDITIONAL_CLEAN_FILES "${cmake_dependency_file}")
- list(REMOVE_DUPLICATES CUDA_ADDITIONAL_CLEAN_FILES)
- set(CUDA_ADDITIONAL_CLEAN_FILES ${CUDA_ADDITIONAL_CLEAN_FILES} CACHE INTERNAL "List of intermediate files that are part of the cuda dependency scanning.")
-
- endif(${file} MATCHES ".*\\.cu$" AND NOT _is_header)
- endforeach(file)
-
- # Set the return parameter
- set(${generated_files} ${_cuda_wrap_generated_files})
-endmacro(CUDA_WRAP_SRCS)
-
-
-###############################################################################
-###############################################################################
-# ADD LIBRARY
-###############################################################################
-###############################################################################
-macro(CUDA_ADD_LIBRARY cuda_target)
-
- CUDA_ADD_CUDA_INCLUDE_ONCE()
-
- # Separate the sources from the options
- CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN})
- CUDA_BUILD_SHARED_LIBRARY(_cuda_shared_flag ${ARGN})
- # Create custom commands and targets for each file.
- CUDA_WRAP_SRCS( ${cuda_target} OBJ _generated_files ${_sources}
- ${_cmake_options} ${_cuda_shared_flag}
- OPTIONS ${_options} )
-
- # Add the library.
- add_library(${cuda_target} ${_cmake_options}
- ${_generated_files}
- ${_sources}
- )
-
- target_link_libraries(${cuda_target}
- ${CUDA_LIBRARIES}
- )
-
- # We need to set the linker language based on what the expected generated file
- # would be. CUDA_C_OR_CXX is computed based on CUDA_HOST_COMPILATION_CPP.
- set_target_properties(${cuda_target}
- PROPERTIES
- LINKER_LANGUAGE ${CUDA_C_OR_CXX}
- )
-
-endmacro(CUDA_ADD_LIBRARY cuda_target)
-
-
-###############################################################################
-###############################################################################
-# ADD EXECUTABLE
-###############################################################################
-###############################################################################
-macro(CUDA_ADD_EXECUTABLE cuda_target)
-
- CUDA_ADD_CUDA_INCLUDE_ONCE()
-
- # Separate the sources from the options
- CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN})
- # Create custom commands and targets for each file.
- CUDA_WRAP_SRCS( ${cuda_target} OBJ _generated_files ${_sources} OPTIONS ${_options} )
-
- # Add the library.
- add_executable(${cuda_target} ${_cmake_options}
- ${_generated_files}
- ${_sources}
- )
-
- target_link_libraries(${cuda_target}
- ${CUDA_LIBRARIES}
- )
-
- # We need to set the linker language based on what the expected generated file
- # would be. CUDA_C_OR_CXX is computed based on CUDA_HOST_COMPILATION_CPP.
- set_target_properties(${cuda_target}
- PROPERTIES
- LINKER_LANGUAGE ${CUDA_C_OR_CXX}
- )
-
-endmacro(CUDA_ADD_EXECUTABLE cuda_target)
-
-
-###############################################################################
-###############################################################################
-# CUDA COMPILE
-###############################################################################
-###############################################################################
-macro(CUDA_COMPILE generated_files)
-
- # Separate the sources from the options
- CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN})
- # Create custom commands and targets for each file.
- CUDA_WRAP_SRCS( cuda_compile OBJ _generated_files ${_sources} ${_cmake_options}
- OPTIONS ${_options} )
-
- set( ${generated_files} ${_generated_files})
-
-endmacro(CUDA_COMPILE)
-
-
-###############################################################################
-###############################################################################
-# CUDA COMPILE PTX
-###############################################################################
-###############################################################################
-macro(CUDA_COMPILE_PTX generated_files)
-
- # Separate the sources from the options
- CUDA_GET_SOURCES_AND_OPTIONS(_sources _cmake_options _options ${ARGN})
- # Create custom commands and targets for each file.
- CUDA_WRAP_SRCS( cuda_compile_ptx PTX _generated_files ${_sources} ${_cmake_options}
- OPTIONS ${_options} )
-
- set( ${generated_files} ${_generated_files})
-
-endmacro(CUDA_COMPILE_PTX)
-
-###############################################################################
-###############################################################################
-# CUDA ADD CUFFT TO TARGET
-###############################################################################
-###############################################################################
-macro(CUDA_ADD_CUFFT_TO_TARGET target)
- if (CUDA_BUILD_EMULATION)
- target_link_libraries(${target} ${CUDA_cufftemu_LIBRARY})
- else()
- target_link_libraries(${target} ${CUDA_cufft_LIBRARY})
- endif()
-endmacro()
-
-###############################################################################
-###############################################################################
-# CUDA ADD CUBLAS TO TARGET
-###############################################################################
-###############################################################################
-macro(CUDA_ADD_CUBLAS_TO_TARGET target)
- if (CUDA_BUILD_EMULATION)
- target_link_libraries(${target} ${CUDA_cublasemu_LIBRARY})
- else()
- target_link_libraries(${target} ${CUDA_cublas_LIBRARY})
- endif()
-endmacro()
-
-###############################################################################
-###############################################################################
-# CUDA BUILD CLEAN TARGET
-###############################################################################
-###############################################################################
-macro(CUDA_BUILD_CLEAN_TARGET)
- # Call this after you add all your CUDA targets, and you will get a convience
- # target. You should also make clean after running this target to get the
- # build system to generate all the code again.
-
- set(cuda_clean_target_name clean_cuda_depends)
- if (CMAKE_GENERATOR MATCHES "Visual Studio")
- string(TOUPPER ${cuda_clean_target_name} cuda_clean_target_name)
- endif()
- add_custom_target(${cuda_clean_target_name}
- COMMAND ${CMAKE_COMMAND} -E remove ${CUDA_ADDITIONAL_CLEAN_FILES})
-
- # Clear out the variable, so the next time we configure it will be empty.
- # This is useful so that the files won't persist in the list after targets
- # have been removed.
- set(CUDA_ADDITIONAL_CLEAN_FILES "" CACHE INTERNAL "List of intermediate files that are part of the cuda dependency scanning.")
-endmacro(CUDA_BUILD_CLEAN_TARGET)
+++ /dev/null
-# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
-# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
-#
-# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
-#
-# Copyright (c) 2007-2009
-# Scientific Computing and Imaging Institute, University of Utah
-#
-# This code is licensed under the MIT License. See the FindCUDA.cmake script
-# for the text of the license.
-
-# The MIT License
-#
-# License for the specific language governing rights and limitations under
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-#
-
-#######################################################################
-# This converts a file written in makefile syntax into one that can be included
-# by CMake.
-
-file(READ ${input_file} depend_text)
-
-if (${depend_text} MATCHES ".+")
-
- # message("FOUND DEPENDS")
-
- # Remember, four backslashes is escaped to one backslash in the string.
- string(REGEX REPLACE "\\\\ " " " depend_text ${depend_text})
-
- # This works for the nvcc -M generated dependency files.
- string(REGEX REPLACE "^.* : " "" depend_text ${depend_text})
- string(REGEX REPLACE "[ \\\\]*\n" ";" depend_text ${depend_text})
-
- set(dependency_list "")
-
- foreach(file ${depend_text})
-
- string(REGEX REPLACE "^ +" "" file ${file})
-
- if(NOT IS_DIRECTORY ${file})
- # If softlinks start to matter, we should change this to REALPATH. For now we need
- # to flatten paths, because nvcc can generate stuff like /bin/../include instead of
- # just /include.
- get_filename_component(file_absolute "${file}" ABSOLUTE)
- list(APPEND dependency_list "${file_absolute}")
- endif(NOT IS_DIRECTORY ${file})
-
- endforeach(file)
-
-else()
- # message("FOUND NO DEPENDS")
-endif()
-
-# Remove the duplicate entries and sort them.
-list(REMOVE_DUPLICATES dependency_list)
-list(SORT dependency_list)
-
-foreach(file ${dependency_list})
- set(cuda_nvcc_depend "${cuda_nvcc_depend} \"${file}\"\n")
-endforeach()
-
-file(WRITE ${output_file} "# Generated by: make2cmake.cmake\nSET(CUDA_NVCC_DEPEND\n ${cuda_nvcc_depend})\n\n")
+++ /dev/null
-# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
-# Abe Stephens, SCI Institute -- http://www.sci.utah.edu/~abe/FindCuda.html
-#
-# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
-#
-# Copyright (c) 2007-2009
-# Scientific Computing and Imaging Institute, University of Utah
-#
-# This code is licensed under the MIT License. See the FindCUDA.cmake script
-# for the text of the license.
-
-# The MIT License
-#
-# License for the specific language governing rights and limitations under
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-#
-
-#######################################################################
-# Parses a .cubin file produced by nvcc and reports statistics about the file.
-
-
-file(READ ${input_file} file_text)
-
-if (${file_text} MATCHES ".+")
-
- # Remember, four backslashes is escaped to one backslash in the string.
- string(REGEX REPLACE ";" "\\\\;" file_text ${file_text})
- string(REGEX REPLACE "\ncode" ";code" file_text ${file_text})
-
- list(LENGTH file_text len)
-
- foreach(line ${file_text})
-
- # Only look at "code { }" blocks.
- if(line MATCHES "^code")
-
- # Break into individual lines.
- string(REGEX REPLACE "\n" ";" line ${line})
-
- foreach(entry ${line})
-
- # Extract kernel names.
- if (${entry} MATCHES "[^g]name = ([^ ]+)")
- string(REGEX REPLACE ".* = ([^ ]+)" "\\1" entry ${entry})
-
- # Check to see if the kernel name starts with "_"
- set(skip FALSE)
- # if (${entry} MATCHES "^_")
- # Skip the rest of this block.
- # message("Skipping ${entry}")
- # set(skip TRUE)
- # else (${entry} MATCHES "^_")
- message("Kernel: ${entry}")
- # endif (${entry} MATCHES "^_")
-
- endif(${entry} MATCHES "[^g]name = ([^ ]+)")
-
- # Skip the rest of the block if necessary
- if(NOT skip)
-
- # Registers
- if (${entry} MATCHES "reg([ ]+)=([ ]+)([^ ]+)")
- string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
- message("Registers: ${entry}")
- endif()
-
- # Local memory
- if (${entry} MATCHES "lmem([ ]+)=([ ]+)([^ ]+)")
- string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
- message("Local: ${entry}")
- endif()
-
- # Shared memory
- if (${entry} MATCHES "smem([ ]+)=([ ]+)([^ ]+)")
- string(REGEX REPLACE ".*([ ]+)=([ ]+)([^ ]+)" "\\3" entry ${entry})
- message("Shared: ${entry}")
- endif()
-
- if (${entry} MATCHES "^}")
- message("")
- endif()
-
- endif(NOT skip)
-
-
- endforeach(entry)
-
- endif(line MATCHES "^code")
-
- endforeach(line)
-
-else()
- # message("FOUND NO DEPENDS")
-endif()
-
-
+++ /dev/null
-# James Bigler, NVIDIA Corp (nvidia.com - jbigler)
-#
-# Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
-#
-# This code is licensed under the MIT License. See the FindCUDA.cmake script
-# for the text of the license.
-
-# The MIT License
-#
-# License for the specific language governing rights and limitations under
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-
-
-##########################################################################
-# This file runs the nvcc commands to produce the desired output file along with
-# the dependency file needed by CMake to compute dependencies. In addition the
-# file checks the output of each command and if the command fails it deletes the
-# output files.
-
-# Input variables
-#
-# verbose:BOOL=<> OFF: Be as quiet as possible (default)
-# ON : Describe each step
-#
-# build_configuration:STRING=<> Typically one of Debug, MinSizeRel, Release, or
-# RelWithDebInfo, but it should match one of the
-# entries in CUDA_HOST_FLAGS. This is the build
-# configuration used when compiling the code. If
-# blank or unspecified Debug is assumed as this is
-# what CMake does.
-#
-# generated_file:STRING=<> File to generate. This argument must be passed in.
-#
-# generated_cubin_file:STRING=<> File to generate. This argument must be passed
-# in if build_cubin is true.
-
-if(NOT generated_file)
- message(FATAL_ERROR "You must specify generated_file on the command line")
-endif()
-
-# Set these up as variables to make reading the generated file easier
-set(CMAKE_COMMAND "@CMAKE_COMMAND@")
-set(source_file "@source_file@")
-set(NVCC_generated_dependency_file "@NVCC_generated_dependency_file@")
-set(cmake_dependency_file "@cmake_dependency_file@")
-set(CUDA_make2cmake "@CUDA_make2cmake@")
-set(CUDA_parse_cubin "@CUDA_parse_cubin@")
-set(build_cubin @build_cubin@)
-# We won't actually use these variables for now, but we need to set this, in
-# order to force this file to be run again if it changes.
-set(generated_file_path "@generated_file_path@")
-set(generated_file_internal "@generated_file@")
-set(generated_cubin_file_internal "@generated_cubin_file@")
-
-set(CUDA_NVCC_EXECUTABLE "@CUDA_NVCC_EXECUTABLE@")
-set(CUDA_NVCC_FLAGS "@CUDA_NVCC_FLAGS@;;@CUDA_WRAP_OPTION_NVCC_FLAGS@")
-@CUDA_NVCC_FLAGS_CONFIG@
-set(nvcc_flags "@nvcc_flags@")
-set(CUDA_NVCC_INCLUDE_ARGS "@CUDA_NVCC_INCLUDE_ARGS@")
-set(format_flag "@format_flag@")
-
-if(build_cubin AND NOT generated_cubin_file)
- message(FATAL_ERROR "You must specify generated_cubin_file on the command line")
-endif()
-
-# This is the list of host compilation flags. It C or CXX should already have
-# been chosen by FindCUDA.cmake.
-@CUDA_HOST_FLAGS@
-
-# Take the compiler flags and package them up to be sent to the compiler via -Xcompiler
-set(nvcc_host_compiler_flags "")
-# If we weren't given a build_configuration, use Debug.
-if(NOT build_configuration)
- set(build_configuration Debug)
-endif()
-string(TOUPPER "${build_configuration}" build_configuration)
-#message("CUDA_NVCC_HOST_COMPILER_FLAGS = ${CUDA_NVCC_HOST_COMPILER_FLAGS}")
-foreach(flag ${CMAKE_HOST_FLAGS} ${CMAKE_HOST_FLAGS_${build_configuration}})
- # Extra quotes are added around each flag to help nvcc parse out flags with spaces.
- set(nvcc_host_compiler_flags "${nvcc_host_compiler_flags},\"${flag}\"")
-endforeach()
-if (nvcc_host_compiler_flags)
- set(nvcc_host_compiler_flags "-Xcompiler" ${nvcc_host_compiler_flags})
-endif()
-#message("nvcc_host_compiler_flags = \"${nvcc_host_compiler_flags}\"")
-# Add the build specific configuration flags
-list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}})
-
-if(DEFINED CCBIN)
- set(CCBIN -ccbin "${CCBIN}")
-endif()
-
-# cuda_execute_process - Executes a command with optional command echo and status message.
-#
-# status - Status message to print if verbose is true
-# command - COMMAND argument from the usual execute_process argument structure
-# ARGN - Remaining arguments are the command with arguments
-#
-# CUDA_result - return value from running the command
-#
-# Make this a macro instead of a function, so that things like RESULT_VARIABLE
-# and other return variables are present after executing the process.
-macro(cuda_execute_process status command)
- set(_command ${command})
- if(NOT _command STREQUAL "COMMAND")
- message(FATAL_ERROR "Malformed call to cuda_execute_process. Missing COMMAND as second argument. (command = ${command})")
- endif()
- if(verbose)
- execute_process(COMMAND "${CMAKE_COMMAND}" -E echo -- ${status})
- # Now we need to build up our command string. We are accounting for quotes
- # and spaces, anything else is left up to the user to fix if they want to
- # copy and paste a runnable command line.
- set(cuda_execute_process_string)
- foreach(arg ${ARGN})
- # If there are quotes, excape them, so they come through.
- string(REPLACE "\"" "\\\"" arg ${arg})
- # Args with spaces need quotes around them to get them to be parsed as a single argument.
- if(arg MATCHES " ")
- list(APPEND cuda_execute_process_string "\"${arg}\"")
- else()
- list(APPEND cuda_execute_process_string ${arg})
- endif()
- endforeach()
- # Echo the command
- execute_process(COMMAND ${CMAKE_COMMAND} -E echo ${cuda_execute_process_string})
- endif(verbose)
- # Run the command
- execute_process(COMMAND ${ARGN} RESULT_VARIABLE CUDA_result )
-endmacro()
-
-# Delete the target file
-cuda_execute_process(
- "Removing ${generated_file}"
- COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
- )
-
-# For CUDA 2.3 and below, -G -M doesn't work, so remove the -G flag
-# for dependency generation and hope for the best.
-set(depends_CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS}")
-set(CUDA_VERSION @CUDA_VERSION@)
-if(CUDA_VERSION VERSION_LESS "3.0")
- cmake_policy(PUSH)
- # CMake policy 0007 NEW states that empty list elements are not
- # ignored. I'm just setting it to avoid the warning that's printed.
- cmake_policy(SET CMP0007 NEW)
- # Note that this will remove all occurances of -G.
- list(REMOVE_ITEM depends_CUDA_NVCC_FLAGS "-G")
- cmake_policy(POP)
-endif()
-
-# nvcc doesn't define __CUDACC__ for some reason when generating dependency files. This
-# can cause incorrect dependencies when #including files based on this macro which is
-# defined in the generating passes of nvcc invokation. We will go ahead and manually
-# define this for now until a future version fixes this bug.
-set(CUDACC_DEFINE -D__CUDACC__)
-
-# Generate the dependency file
-cuda_execute_process(
- "Generating dependency file: ${NVCC_generated_dependency_file}"
- COMMAND "${CUDA_NVCC_EXECUTABLE}"
- -M
- ${CUDACC_DEFINE}
- "${source_file}"
- -o "${NVCC_generated_dependency_file}"
- ${CCBIN}
- ${nvcc_flags}
- ${nvcc_host_compiler_flags}
- ${depends_CUDA_NVCC_FLAGS}
- -DNVCC
- ${CUDA_NVCC_INCLUDE_ARGS}
- )
-
-if(CUDA_result)
- message(FATAL_ERROR "Error generating ${generated_file}")
-endif()
-
-# Generate the cmake readable dependency file to a temp file. Don't put the
-# quotes just around the filenames for the input_file and output_file variables.
-# CMake will pass the quotes through and not be able to find the file.
-cuda_execute_process(
- "Generating temporary cmake readable file: ${cmake_dependency_file}.tmp"
- COMMAND "${CMAKE_COMMAND}"
- -D "input_file:FILEPATH=${NVCC_generated_dependency_file}"
- -D "output_file:FILEPATH=${cmake_dependency_file}.tmp"
- -P "${CUDA_make2cmake}"
- )
-
-if(CUDA_result)
- message(FATAL_ERROR "Error generating ${generated_file}")
-endif()
-
-# Copy the file if it is different
-cuda_execute_process(
- "Copy if different ${cmake_dependency_file}.tmp to ${cmake_dependency_file}"
- COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${cmake_dependency_file}.tmp" "${cmake_dependency_file}"
- )
-
-if(CUDA_result)
- message(FATAL_ERROR "Error generating ${generated_file}")
-endif()
-
-# Delete the temporary file
-cuda_execute_process(
- "Removing ${cmake_dependency_file}.tmp and ${NVCC_generated_dependency_file}"
- COMMAND "${CMAKE_COMMAND}" -E remove "${cmake_dependency_file}.tmp" "${NVCC_generated_dependency_file}"
- )
-
-if(CUDA_result)
- message(FATAL_ERROR "Error generating ${generated_file}")
-endif()
-
-# Generate the code
-cuda_execute_process(
- "Generating ${generated_file}"
- COMMAND "${CUDA_NVCC_EXECUTABLE}"
- "${source_file}"
- ${format_flag} -o "${generated_file}"
- ${CCBIN}
- ${nvcc_flags}
- ${nvcc_host_compiler_flags}
- ${CUDA_NVCC_FLAGS}
- -DNVCC
- ${CUDA_NVCC_INCLUDE_ARGS}
- )
-
-if(CUDA_result)
- # Since nvcc can sometimes leave half done files make sure that we delete the output file.
- cuda_execute_process(
- "Removing ${generated_file}"
- COMMAND "${CMAKE_COMMAND}" -E remove "${generated_file}"
- )
- message(FATAL_ERROR "Error generating file ${generated_file}")
-else()
- if(verbose)
- message("Generated ${generated_file} successfully.")
- endif()
-endif()
-
-# Cubin resource report commands.
-if( build_cubin )
- # Run with -cubin to produce resource usage report.
- cuda_execute_process(
- "Generating ${generated_cubin_file}"
- COMMAND "${CUDA_NVCC_EXECUTABLE}"
- "${source_file}"
- ${CUDA_NVCC_FLAGS}
- ${nvcc_flags}
- ${CCBIN}
- ${nvcc_host_compiler_flags}
- -DNVCC
- -cubin
- -o "${generated_cubin_file}"
- ${CUDA_NVCC_INCLUDE_ARGS}
- )
-
- # Execute the parser script.
- cuda_execute_process(
- "Executing the parser script"
- COMMAND "${CMAKE_COMMAND}"
- -D "input_file:STRING=${generated_cubin_file}"
- -P "${CUDA_parse_cubin}"
- )
-
-endif( build_cubin )
--- /dev/null
+# - Find FFTW 2/3 single double
+# Find the native FFTW headers and libraries.
+#
+# FFTW_INCLUDE_DIRS - where to find FFTW headers
+# FFTW_LIBRARIES - List of libraries when using FFTW.
+# FFTW_PKG - The name of the pkg-config package needed
+# FFTW_FOUND - True if FFTW was found
+#
+# This file is part of Gromacs Copyright (c) 2012
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# To help us fund GROMACS development, we humbly ask that you cite
+# the research papers on the package. Check out http://www.gromacs.org
+
+find_package(PkgConfig)
+list(LENGTH FFTW_FIND_COMPONENTS FFTW_NUM_COMPONENTS_WANTED)
+if(${FFTW_NUM_COMPONENTS_WANTED} LESS 1)
+ message(FATAL_ERROR "No FFTW component to search given")
+elseif(${FFTW_NUM_COMPONENTS_WANTED} GREATER 1)
+ message(FATAL_ERROR "We only support finding one FFTW component at the time, go and implement it ;-)")
+elseif(${FFTW_FIND_COMPONENTS} MATCHES "^fftw(f)?$")
+ if (${FFTW_FIND_VERSION} EQUAL 3 OR NOT FFTW_FIND_VERSION) #find FFTW3 by default
+ string(REGEX REPLACE "fftw" "fftw3" FFTW_PKG "${FFTW_FIND_COMPONENTS}")
+ set(FFTW_HEADER "fftw3.h")
+ set(FFTW_FUNCTION "${FFTW_FIND_COMPONENTS}_plan_r2r_1d")
+ #elseif(${FFTW_FIND_VERSION} EQUAL 2)
+ # set(FFTW_PKG "${FFTW_FIND_COMPONENTS}")
+ # set(FFTW_HEADER "${FFTW_FIND_COMPONENTS}.h")
+ else()
+ message(FATAL_ERROR "We only support finding FFTW version 3, go and implement it ;-)")
+ endif()
+else()
+ message(FATAL_ERROR "We do not support finding ${FFTW_FIND_COMPONENTS}, go and implement it ;-)")
+endif()
+
+if(NOT __pkg_config_checked_PC_FFTW)
+ pkg_check_modules(PC_FFTW "${FFTW_PKG}")
+endif(NOT __pkg_config_checked_PC_FFTW)
+
+find_path(FFTW_INCLUDE_DIR_${FFTW_PKG} "${FFTW_HEADER}" HINTS ${PC_FFTW_INCLUDE_DIRS})
+find_library(FFTW_LIBRARY_${FFTW_PKG} NAMES "${FFTW_PKG}" HINTS ${PC_FFTW_LIBRARY_DIRS} )
+
+#make _${FFTW_PKG} variables INTERNAL to avoid confusion
+set(FFTW_LIBRARY_${FFTW_PKG} ${FFTW_LIBRARY_${FFTW_PKG}} CACHE INTERNAL "Path to library ${FFTW_PKG}")
+set(FFTW_INCLUDE_DIR_${FFTW_PKG} ${FFTW_INCLUDE_DIR_${FFTW_PKG}} CACHE INTERNAL "Path to ${FFTW_HEADER}")
+
+set(FFTW_LIBRARY ${FFTW_LIBRARY_${FFTW_PKG}} CACHE STRING "Path to library ${FFTW_PKG}")
+set(FFTW_INCLUDE_DIR ${FFTW_INCLUDE_DIR_${FFTW_PKG}} CACHE STRING "Path to ${FFTW_HEADER}")
+
+set(FFTW_LIBRARIES ${FFTW_LIBRARY} )
+set(FFTW_INCLUDE_DIRS ${FFTW_INCLUDE_DIR} )
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE
+# if all listed variables are TRUE
+
+find_package_handle_standard_args(FFTW DEFAULT_MSG FFTW_LIBRARY FFTW_INCLUDE_DIR )
+
+if (FFTW_FOUND AND HAVE_LIBM)
+ include(CheckLibraryExists)
+ #adding MATH_LIBRARIES here to allow static libs, this does not harm us as we are anyway using it
+ check_library_exists("${FFTW_LIBRARIES};m" "${FFTW_FUNCTION}" "" FOUND_FFTW_PLAN)
+ if(NOT FOUND_FFTW_PLAN)
+ message(FATAL_ERROR "Could not find ${FFTW_FUNCTION} in ${FFTW_LIBRARY}, take a look at the error message in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log to find out what was going wrong. If you are using a static lib (.a) make sure you have specified all dependencies of ${FFTW_PKG} in FFTW_LIBRARY by hand (e.g. -DFFTW_LIBRARY='/path/to/lib${FFTW_PKG}.so;/path/to/libm.so') !")
+ endif(NOT FOUND_FFTW_PLAN)
+endif (FFTW_FOUND AND HAVE_LIBM)
+
+mark_as_advanced(FFTW_INCLUDE_DIR FFTW_LIBRARY )
+++ /dev/null
-# - Find FFTW2
-# Find the native FFTW2 includes and library, double precision
-#
-# FFTW2_INCLUDE_DIR - where to find [d]fftw.h
-# FFTW2_LIBRARIES - List of libraries when using FFTW.
-# FFTW2_FOUND - True if FFTW found.
-#
-# The FFTW2 root installation directory can be provided in the FFTW2_ROOT_DIR
-
-if (FFTW2_INCLUDE_DIR)
- # Already in cache, be silent
- set (FFTW2_FIND_QUIETLY TRUE)
-endif (FFTW2_INCLUDE_DIR)
-
-set(FFTW2_FOUND 0)
-
-file(TO_CMAKE_PATH "$ENV{FFTW2_ROOT_DIR}" _env_FFTW2_ROOT_DIR)
-
-foreach(fftw2_name dfftw fftw)
- string(TOUPPER ${fftw2_name} fftw2_uname)
- string(REPLACE "fftw" "rfftw" rfftw2_name ${fftw2_name})
- if(NOT FFTW2_FOUND)
- find_path (FFTW2_INCLUDE_DIR
- PATHS "${_env_FFTW2_ROOT_DIR}/include"
- ${fftw2_name}.h)
- CACHE STRING "Path to double precision FFTW2 headers")
- find_library (CFFTW2_LIBRARIES ${fftw2_name}
- PATHS "${_env_FFTW2_ROOT_DIR}/lib"
- CACHE STRING "Double precision CFFTW2 libraries")
- find_library (RFFTW2_LIBRARIES ${rfftw2_name}
- PATHS "${_env_FFTW2_ROOT_DIR}/lib"
- CACHE STRING "Double precision RFFTW2 libraries")
- TRY_COMPILE(FFTW2_FOUND "${CMAKE_BINARY_DIR}"
- "${CMAKE_SOURCE_DIR}/cmake/TestFFTW2.c"
- COMPILE_DEFINITIONS "-I${FFTW2_INCLUDE_DIR} -DDOUBLE -D${fftw2_uname}" )
- endif(NOT FFTW2_FOUND)
-endforeach(fftw2_name dfftw fftw)
-
-if(FFTW2_FOUND)
- set(FFTW2_LIBRARIES "${RFFTW2_LIBRARIES} ${CFFTW2_LIBRARIES}" CACHE STRING "Result of FFTW2 library check" FORCE)
-else(FFTW2_FOUND)
- set(FFTW2_INCLUDE_DIR 0)
- set(FFTW2_LIBRARIES 0)
-endif(FFTW2_FOUND)
-
-# handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
-# all listed variables are TRUE
-include (FindPackageHandleStandardArgs)
-set(__MSG "Could not find FFTW2. Provide the fftw2 install directory in the FFTW2_ROOT_DIR environment variable.")
-find_package_handle_standard_args (FFTW2 ${__MSG} FFTW2_LIBRARIES FFTW2_INCLUDE_DIR)
-
-mark_as_advanced (RFFTW2_LIBRARIES CFFTW2_LIBRARIES FFTW2_LIBRARIES FFTW2_INCLUDE_DIR)
-
-
+++ /dev/null
-# - Find FFTW2
-# Find the native FFTW2 includes and library, double precision
-#
-# FFTW2_INCLUDE_DIR - where to find [d]fftw.h
-# FFTW2_LIBRARIES - List of libraries when using FFTW.
-# FFTW2_FOUND - True if FFTW found.
-#
-# The FFTW2F root installation directory can be provided in the FFTW2F_ROOT_DIR
-
-
-if (FFTW2_INCLUDE_DIR)
- # Already in cache, be silent
- set (FFTW2_FIND_QUIETLY TRUE)
-endif (FFTW2_INCLUDE_DIR)
-
-set(FFTW2_FOUND 0)
-
-file(TO_CMAKE_PATH "$ENV{FFTW2F_ROOT_DIR}" _env_FFTW2F_ROOT_DIR)
-
-foreach(fftw2_name sfftw fftw)
- string(TOUPPER ${fftw2_name} fftw2_uname)
- string(REPLACE "fftw" "rfftw" rfftw2_name ${fftw2_name})
- if(NOT FFTW2_FOUND)
- find_path (FFTW2_INCLUDE_DIR
- PATHS "${_env_FFTW2F_ROOT_DIR}/include"
- ${fftw2_name}.h
- CACHE STRING "Path single precision FFTW2 headers")
- find_library (CFFTW2_LIBRARIES ${fftw2_name}
- PATHS "${_env_FFTW2F_ROOT_DIR}/lib"
- CACHE STRING "Single precision CFFTW2 libraries")
- find_library (RFFTW2_LIBRARIES ${rfftw2_name}
- PATHS "${_env_FFTW2F_ROOT_DIR}/lib"
- CACHE STRING "Single precision RFFTW2 libraries")
- TRY_COMPILE(FFTW2_FOUND "${CMAKE_BINARY_DIR}"
- "${CMAKE_SOURCE_DIR}/cmake/TestFFTW2.c"
- COMPILE_DEFINITIONS "-I${FFTW2_INCLUDE_DIR} -D${fftw2_uname}" )
- endif(NOT FFTW2_FOUND)
-endforeach(fftw2_name sfftw fftw)
-
-if(FFTW2_FOUND)
- set(FFTW2_LIBRARIES "${RFFTW2_LIBRARIES} ${CFFTW2_LIBRARIES}" CACHE STRING "Result of FFTW2 library check" FORCE)
-else(FFTW2_FOUND)
- set(FFTW2_INCLUDE_DIR 0)
- set(FFTW2_LIBRARIES 0)
-endif(FFTW2_FOUND)
-
-# handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
-# all listed variables are TRUE
-include (FindPackageHandleStandardArgs)
-set(__MSG "Could not find FFTW2F. Provide the fftw2 install directory in the FFTW2F_ROOT_DIR environment variable.")
-find_package_handle_standard_args (FFTW2 ${__MSG} FFTW2_LIBRARIES FFTW2_INCLUDE_DIR)
-
-mark_as_advanced (RFFTW2_LIBRARIES CFFTW2_LIBRARIES FFTW2_LIBRARIES FFTW2_INCLUDE_DIR)
-
-
+++ /dev/null
-# - Find FFTW3
-# Find the native FFTW3 includes and library, double precision
-#
-# FFTW3_INCLUDE_DIR - where to find fftw3.h
-# FFTW3_LIBRARIES - List of libraries when using FFTW.
-# FFTW3_FOUND - True if FFTW found.
-#
-# The FFTW3 root installation directory can be provided in the FFTW3_ROOT_DIR
-
-if (FFTW3_INCLUDE_DIR AND FFTW3_LIBRARIES)
- # Already in cache, be silent
- set (FFTW3_FIND_QUIETLY TRUE)
-endif (FFTW3_INCLUDE_DIR AND FFTW3_LIBRARIES)
-
-file(TO_CMAKE_PATH "$ENV{FFTW3_ROOT_DIR}" _env_FFTW3_ROOT_DIR)
-
-find_path (FFTW3_INCLUDE_DIR fftw3.h
- PATHS "${_env_FFTW3_ROOT_DIR}/include"
- CACHE STRING "Path to double precision FFTW3 headers")
-
-find_library (FFTW3_LIBRARIES
- NAMES fftw3
- PATHS "${_env_FFTW3_ROOT_DIR}/lib"
- "${FFTW3_INCLUDE_DIR}/../lib"
- CACHE STRING "Double precision FFTW3 libraries")
-
-# handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
-# all listed variables are TRUE
-include (FindPackageHandleStandardArgs)
-set(__MSG "Could not find FFTW3. Provide the fftw3 install directory in the FFTW3_ROOT_DIR environment variable.")
-find_package_handle_standard_args (FFTW3 ${__MSG} FFTW3_LIBRARIES FFTW3_INCLUDE_DIR)
-
-mark_as_advanced (FFTW3_LIBRARIES FFTW3_INCLUDE_DIR)
-
-
+++ /dev/null
-# - Find FFTW3F
-# Find the native FFTW3 includes and library, single precision
-#
-# FFTW3F_INCLUDE_DIR - where to find fftw3.h
-# FFTW3F_LIBRARIES - List of libraries when using FFTW.
-# FFTW3F_FOUND - True if FFTW found.
-#
-# The FFTW3F root installation directory can be provided in the FFTW3F_ROOT_DIR
-
-if (FFTW3F_INCLUDE_DIR AND FFTW3F_LIBRARIES)
- # Already in cache, be silent
- set (FFTW3F_FIND_QUIETLY TRUE)
-endif (FFTW3F_INCLUDE_DIR AND FFTW3F_LIBRARIES)
-
-file(TO_CMAKE_PATH "$ENV{FFTW3F_ROOT_DIR}" _env_FFTW3F_ROOT_DIR)
-
-find_path (FFTW3F_INCLUDE_DIR fftw3.h
- PATHS "${_env_FFTW3F_ROOT_DIR}/include"
- CACHE STRING "Path to single precision FFTW3 headers")
-
-find_library (FFTW3F_LIBRARIES
- NAMES fftw3f
- PATHS "${_env_FFTW3F_ROOT_DIR}/lib"
- "${FFTW3F_INCLUDE_DIR}/../lib"
- CACHE STRING "Single precision FFTW3 libraries")
-
-# handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
-# all listed variables are TRUE
-include (FindPackageHandleStandardArgs)
-set(__MSG "Could not find FFTW3F. Provide the fftw3 install directory in the FFTW3F_ROOT_DIR environment variable.")
-find_package_handle_standard_args (FFTW3F ${__MSG} FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIR)
-
-mark_as_advanced (FFTW3F_LIBRARIES FFTW3F_INCLUDE_DIR)
-# Try to find the git version control tool
-#
# The module defines the following variables:
-#
-# Git_EXECUTABLE - path the the git executable
-# Git_VERSION - git version
-# Git_FOUND - tru if git was found, false otherwise
-#
-# Author: Szilard Pall (pszilard@cbr.su.se)
+# GIT_EXECUTABLE - path to git command line client
+# GIT_FOUND - true if the command line client was found
+# Example usage:
+# find_package(Git)
+# if(GIT_FOUND)
+# message("git found: ${GIT_EXECUTABLE}")
+# endif()
-if(Git_EXECUTABLE AND Git_VERSION)
- set(Git_FIND_QUIETLY TRUE)
-endif()
+#=============================================================================
+# Copyright 2010 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
-# search for git binary
-find_program(Git_EXECUTABLE git
- PATHS ENV PATH
- CACHE DOC "Git version control tool")
+# Look for 'git' or 'eg' (easy git)
+#
+set(git_names git eg)
-if(NOT Git_EXECUTABLE)
- set(_err_msg "Git executable not found")
- if(Git_FIND_REQUIRED)
- message(FATAL_ERROR " ${_err_msg}")
- elseif(NOT Git_FIND_QUIETLY)
- message("${_err_msg}")
- endif()
+# Prefer .cmd variants on Windows unless running in a Makefile
+# in the MSYS shell.
+#
+if(WIN32)
+ if(NOT CMAKE_GENERATOR MATCHES "MSYS")
+ set(git_names git.cmd git eg.cmd eg)
+ endif()
endif()
-# parse version
-if(Git_EXECUTABLE AND NOT Git_VERSION)
- execute_process(COMMAND ${Git_EXECUTABLE} "--version"
- OUTPUT_VARIABLE _exec_out
- OUTPUT_STRIP_TRAILING_WHITESPACE)
- string(REGEX REPLACE "git version (.*)" "\\1" Git_VERSION ${_exec_out})
- set(Git_VERSION ${Git_VERSION} CACHE STRING "Git version")
-
- # check version
- set(_git_version_ok TRUE)
- # this should at some point become VERSION_EQUAL
- if(Git_FIND_VERSION_EXACT AND NOT Git_VERSION STREQUAL Git_FIND_VERSION)
- set(_err_msg "Found git version ${Git_VERSION} but this does not match the requested ${Git_FIND_VERSION}")
- if(Git_FIND_REQUIRED)
- message(FATAL_ERROR " ${_err_msg}")
- elseif(NOT Git_FIND_QUIETLY)
- message("${_err_msg}")
- endif()
- set(_git_version_ok FALSE)
- endif()
- # this should at some point become VERSION_LESS
- if(Git_FIND_VERSION AND Git_VERSION STRLESS Git_FIND_VERSION)
- set(_err_msg "Found git version ${Git_VERSION} but this is less then the requested ${Git_FIND_VERSION}")
- if(Git_FIND_REQUIRED)
- message(FATAL_ERROR " ${_err_msg}")
- elseif(NOT Git_FIND_QUIETLY)
- message("${_err_msg}")
- endif()
- set(_git_version_ok FALSE)
- endif()
+find_program(GIT_EXECUTABLE
+ NAMES ${git_names}
+ DOC "git command line client"
+ )
+mark_as_advanced(GIT_EXECUTABLE)
-endif()
-set(Git_FOUND True)
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Git DEFAULT_MSG
- Git_EXECUTABLE
- Git_VERSION
- _git_version_ok)
+# Handle the QUIETLY and REQUIRED arguments and set GIT_FOUND to TRUE if
+# all listed variables are TRUE
-mark_as_advanced(Git_EXECUTABLE Git_VERSION)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Git DEFAULT_MSG GIT_EXECUTABLE)
+++ /dev/null
-# - Try to find the LibXml2 xml processing library
-# Once done this will define
-#
-# LIBXML2_FOUND - System has LibXml2
-# LIBXML2_INCLUDE_DIR - The LibXml2 include directory
-# LIBXML2_LIBRARIES - The libraries needed to use LibXml2
-# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
-# LIBXML2_XMLLINT_EXECUTABLE - The XML checking tool xmllint coming with LibXml2
-
-#=============================================================================
-# Copyright 2006-2009 Kitware, Inc.
-# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distributed this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# use pkg-config to get the directories and then use these values
-# in the FIND_PATH() and FIND_LIBRARY() calls
-FIND_PACKAGE(PkgConfig)
-PKG_CHECK_MODULES(PC_LIBXML libxml-2.0)
-SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
-
-FIND_PATH(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
- HINTS
- ${PC_LIBXML_INCLUDEDIR}
- ${PC_LIBXML_INCLUDE_DIRS}
- PATH_SUFFIXES libxml2
- )
-
-FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2
- HINTS
- ${PC_LIBXML_LIBDIR}
- ${PC_LIBXML_LIBRARY_DIRS}
- )
-
-FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint)
-# for backwards compat. with KDE 4.0.x:
-SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}")
-
-# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
-# all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
-
-MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE)
-
+++ /dev/null
-# - Message Passing Interface (MPI) module.
-#
-# The Message Passing Interface (MPI) is a library used to write
-# high-performance parallel applications that use message passing, and
-# is typically deployed on a cluster. MPI is a standard interface
-# (defined by the MPI forum) for which many implementations are
-# available. All of these implementations have somewhat different
-# compilation approaches (different include paths, libraries to link
-# against, etc.), and this module tries to smooth out those differences.
-#
-# This module will set the following variables:
-# MPI_FOUND TRUE if we have found MPI
-# MPI_COMPILE_FLAGS Compilation flags for MPI programs
-# MPI_INCLUDE_PATH Include path(s) for MPI header
-# MPI_LINK_FLAGS Linking flags for MPI programs
-# MPI_LIBRARY First MPI library to link against (cached)
-# MPI_EXTRA_LIBRARY Extra MPI libraries to link against (cached)
-# MPI_LIBRARIES All libraries to link MPI programs against
-# MPIEXEC Executable for running MPI programs
-# MPIEXEC_NUMPROC_FLAG Flag to pass to MPIEXEC before giving it the
-# number of processors to run on
-# MPIEXEC_PREFLAGS Flags to pass to MPIEXEC directly before the
-# executable to run.
-# MPIEXEC_POSTFLAGS Flags to pass to MPIEXEC after all other flags.
-#
-# This module will attempt to auto-detect these settings, first by
-# looking for a MPI compiler, which many MPI implementations provide
-# as a pass-through to the native compiler to simplify the compilation
-# of MPI programs. The MPI compiler is stored in the cache variable
-# MPI_COMPILER, and will attempt to look for commonly-named drivers
-# mpic++, mpicxx, mpiCC, or mpicc. If the compiler driver is found and
-# recognized, it will be used to set all of the module variables. To
-# skip this auto-detection, set MPI_LIBRARY and MPI_INCLUDE_PATH in
-# the CMake cache.
-#
-# If no compiler driver is found or the compiler driver is not
-# recognized, this module will then search for common include paths
-# and library names to try to detect MPI.
-#
-# If CMake initially finds a different MPI than was intended, and you
-# want to use the MPI compiler auto-detection for a different MPI
-# implementation, set MPI_COMPILER to the MPI compiler driver you want
-# to use (e.g., mpicxx) and then set MPI_LIBRARY to the string
-# MPI_LIBRARY-NOTFOUND. When you re-configure, auto-detection of MPI
-# will run again with the newly-specified MPI_COMPILER.
-#
-# When using MPIEXEC to execute MPI applications, you should typically
-# use all of the MPIEXEC flags as follows:
-# ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} PROCS ${MPIEXEC_PREFLAGS} EXECUTABLE
-# ${MPIEXEC_POSTFLAGS} ARGS
-# where PROCS is the number of processors on which to execute the program,
-# EXECUTABLE is the MPI program, and ARGS are the arguments to pass to the
-# MPI program.
-
-#=============================================================================
-# Copyright 2001-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distributed this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# This module is maintained by David Partyka <dave.partyka@kitware.com>.
-
-# A set of directories to search through in addition to the standard system paths
-# that find_program will search through.
-# Microsoft HPC SDK is automatically added to the system path
-# Argonne National Labs MPICH2 sets a registry key that we can use.
-
-TRY_COMPILE(MPI_FOUND ${CMAKE_BINARY_DIR}
- "${CMAKE_SOURCE_DIR}/cmake/TestMPI.c"
- COMPILE_DEFINITIONS )
-
-if(MPI_FOUND)
- return()
-endif()
-
-set(_MPI_PACKAGE_DIR
- mpi
- mpich
- openmpi
- lib/mpi
- lib/mpich
- lib/openmpi
- "MPICH/SDK"
- "Microsoft Compute Cluster Pack"
- )
-
-set(_MPI_PREFIX_PATH)
-if(WIN32)
- list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/..")
- list(APPEND _MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH2;Path]")
-endif()
-
-foreach(SystemPrefixDir ${CMAKE_SYSTEM_PREFIX_PATH})
- foreach(MpiPackageDir ${_MPI_PREFIX_PATH})
- if(EXISTS ${SystemPrefixDir}/${MpiPackageDir})
- list(APPEND _MPI_PREFIX_PATH "${SystemPrefixDir}/${MpiPackageDir}")
- endif()
- endforeach(MpiPackageDir)
-endforeach(SystemPrefixDir)
-
-# Most mpi distros have some form of mpiexec which gives us something we can reliably look for.
-find_program(MPIEXEC
- NAMES mpiexec mpirun lamexec
- PATHS ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES bin
- DOC "Executable for running MPI programs."
- )
-
-# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin).
-# This gives us a fairly reliable base directory to search for /bin /lib and /include from.
-get_filename_component(_MPI_BASE_DIR "${MPIEXEC}" PATH)
-get_filename_component(_MPI_BASE_DIR "${_MPI_BASE_DIR}" PATH)
-
-# If there is an mpi compiler find it and interogate (farther below) it for the include
-# and lib dirs otherwise we will continue to search from ${_MPI_BASE_DIR}.
-find_program(MPI_COMPILER
- NAMES mpic++ mpicxx mpiCC mpicc
- HINTS "${_MPI_BASE_DIR}"
- PATH_SUFFIXES bin
- DOC "MPI compiler. Used only to detect MPI compilation flags.")
-mark_as_advanced(MPI_COMPILER)
-
-set(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC; the next option will be the number of processes.")
-set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by MPIEXEC.")
-set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will come after all flags given to MPIEXEC.")
-set(MPIEXEC_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run MPI applications.")
-mark_as_advanced(MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS
- MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS)
-
-if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
- # Do nothing: we already have MPI_INCLUDE_PATH and MPI_LIBRARY in
- # the cache, and we don't want to override those settings.
-elseif (MPI_COMPILER)
- # Check whether the -showme:compile option works. This indicates
- # that we have either Open MPI or a newer version of LAM-MPI, and
- # implies that -showme:link will also work.
- # Note that Windows distros do not have an mpi compiler to interogate.
- exec_program(${MPI_COMPILER}
- ARGS -showme:compile
- OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
- RETURN_VALUE MPI_COMPILER_RETURN)
-
- if (MPI_COMPILER_RETURN EQUAL 0)
- # If we appear to have -showme:compile, then we should also have
- # -showme:link. Try it.
- exec_program(${MPI_COMPILER}
- ARGS -showme:link
- OUTPUT_VARIABLE MPI_LINK_CMDLINE
- RETURN_VALUE MPI_COMPILER_RETURN)
-
- # Note that we probably have -showme:incdirs and -showme:libdirs
- # as well.
- set(MPI_COMPILER_MAY_HAVE_INCLIBDIRS TRUE)
- endif (MPI_COMPILER_RETURN EQUAL 0)
-
- if (MPI_COMPILER_RETURN EQUAL 0)
- # Do nothing: we have our command lines now
- else (MPI_COMPILER_RETURN EQUAL 0)
- # Older versions of LAM-MPI have "-showme". Try it.
- exec_program(${MPI_COMPILER}
- ARGS -showme
- OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
- RETURN_VALUE MPI_COMPILER_RETURN)
- endif (MPI_COMPILER_RETURN EQUAL 0)
-
- if (MPI_COMPILER_RETURN EQUAL 0)
- # Do nothing: we have our command lines now
- else (MPI_COMPILER_RETURN EQUAL 0)
- # MPICH uses "-show". Try it.
- exec_program(${MPI_COMPILER}
- ARGS -show
- OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
- RETURN_VALUE MPI_COMPILER_RETURN)
- endif (MPI_COMPILER_RETURN EQUAL 0)
-
- if (MPI_COMPILER_RETURN EQUAL 0)
- # We have our command lines, but we might need to copy
- # MPI_COMPILE_CMDLINE into MPI_LINK_CMDLINE, if the underlying
- if (NOT MPI_LINK_CMDLINE)
- SET(MPI_LINK_CMDLINE ${MPI_COMPILE_CMDLINE})
- endif (NOT MPI_LINK_CMDLINE)
- else (MPI_COMPILER_RETURN EQUAL 0)
- message(STATUS "Unable to determine MPI from MPI driver ${MPI_COMPILER}")
- endif (MPI_COMPILER_RETURN EQUAL 0)
-endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
-
-if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
- # Do nothing: we already have MPI_INCLUDE_PATH and MPI_LIBRARY in
- # the cache, and we don't want to override those settings.
-elseif (MPI_COMPILE_CMDLINE)
- # Extract compile flags from the compile command line.
- string(REGEX MATCHALL "-D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}")
- set(MPI_COMPILE_FLAGS_WORK)
- foreach(FLAG ${MPI_ALL_COMPILE_FLAGS})
- if (MPI_COMPILE_FLAGS_WORK)
- set(MPI_COMPILE_FLAGS_WORK "${MPI_COMPILE_FLAGS_WORK} ${FLAG}")
- else(MPI_COMPILE_FLAGS_WORK)
- set(MPI_COMPILE_FLAGS_WORK ${FLAG})
- endif(MPI_COMPILE_FLAGS_WORK)
- endforeach(FLAG)
-
- # Extract include paths from compile command line
- string(REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
- set(MPI_INCLUDE_PATH_WORK)
- foreach(IPATH ${MPI_ALL_INCLUDE_PATHS})
- string(REGEX REPLACE "^-I" "" IPATH ${IPATH})
- string(REGEX REPLACE "//" "/" IPATH ${IPATH})
- list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
- endforeach(IPATH)
-
- if (NOT MPI_INCLUDE_PATH_WORK)
- if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
- # The compile command line didn't have any include paths on it,
- # but we may have -showme:incdirs. Use it.
- exec_program(${MPI_COMPILER}
- ARGS -showme:incdirs
- OUTPUT_VARIABLE MPI_INCLUDE_PATH_WORK
- RETURN_VALUE MPI_COMPILER_RETURN)
- separate_arguments(MPI_INCLUDE_PATH_WORK)
- endif (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
- endif (NOT MPI_INCLUDE_PATH_WORK)
-
- if (NOT MPI_INCLUDE_PATH_WORK)
- # If all else fails, just search for mpi.h in the normal include
- # paths.
- find_path(MPI_INCLUDE_PATH mpi.h
- HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES include
- )
- set(MPI_INCLUDE_PATH_WORK ${MPI_INCLUDE_PATH})
- endif (NOT MPI_INCLUDE_PATH_WORK)
-
- # Extract linker paths from the link command line
- string(REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}")
- set(MPI_LINK_PATH)
- foreach(LPATH ${MPI_ALL_LINK_PATHS})
- string(REGEX REPLACE "^-L" "" LPATH ${LPATH})
- string(REGEX REPLACE "//" "/" LPATH ${LPATH})
- list(APPEND MPI_LINK_PATH ${LPATH})
- endforeach(LPATH)
-
- if (NOT MPI_LINK_PATH)
- if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
- # The compile command line didn't have any linking paths on it,
- # but we may have -showme:libdirs. Use it.
- exec_program(${MPI_COMPILER}
- ARGS -showme:libdirs
- OUTPUT_VARIABLE MPI_LINK_PATH
- RETURN_VALUE MPI_COMPILER_RETURN)
- separate_arguments(MPI_LINK_PATH)
- endif (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
- endif (NOT MPI_LINK_PATH)
-
- # Extract linker flags from the link command line
- string(REGEX MATCHALL "-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
- set(MPI_LINK_FLAGS_WORK)
- foreach(FLAG ${MPI_ALL_LINK_FLAGS})
- if (MPI_LINK_FLAGS_WORK)
- set(MPI_LINK_FLAGS_WORK "${MPI_LINK_FLAGS_WORK} ${FLAG}")
- else(MPI_LINK_FLAGS_WORK)
- set(MPI_LINK_FLAGS_WORK ${FLAG})
- endif(MPI_LINK_FLAGS_WORK)
- endforeach(FLAG)
-
- # Extract the set of libraries to link against from the link command
- # line
- string(REGEX MATCHALL "-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
-
- # Determine full path names for all of the libraries that one needs
- # to link against in an MPI program
- set(MPI_LIBRARIES)
- foreach(LIB ${MPI_LIBNAMES})
- string(REGEX REPLACE "^-l" "" LIB ${LIB})
- set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
- find_library(MPI_LIB ${LIB} HINTS ${MPI_LINK_PATH})
- if (MPI_LIB)
- list(APPEND MPI_LIBRARIES ${MPI_LIB})
- else (MPI_LIB)
- message(SEND_ERROR "Unable to find MPI library ${LIB}")
- endif (MPI_LIB)
- endforeach(LIB)
- set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI detection" FORCE)
-
- # Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and
- # MPI_EXTRA_LIBRARY.
- list(LENGTH MPI_LIBRARIES MPI_NUMLIBS)
- list(LENGTH MPI_LIBNAMES MPI_NUMLIBS_EXPECTED)
- if (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
- list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK)
- set(MPI_LIBRARY ${MPI_LIBRARY_WORK} CACHE FILEPATH "MPI library to link against" FORCE)
- else (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
- set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND" CACHE FILEPATH "MPI library to link against" FORCE)
- endif (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
- if (MPI_NUMLIBS GREATER 1)
- set(MPI_EXTRA_LIBRARY_WORK ${MPI_LIBRARIES})
- list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0)
- set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY_WORK} CACHE STRING "Extra MPI libraries to link against" FORCE)
- else (MPI_NUMLIBS GREATER 1)
- set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND" CACHE STRING "Extra MPI libraries to link against" FORCE)
- endif (MPI_NUMLIBS GREATER 1)
-
- # Set up all of the appropriate cache entries
- set(MPI_COMPILE_FLAGS ${MPI_COMPILE_FLAGS_WORK} CACHE STRING "MPI compilation flags" FORCE)
- set(MPI_INCLUDE_PATH ${MPI_INCLUDE_PATH_WORK} CACHE STRING "MPI include path" FORCE)
- set(MPI_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI linking flags" FORCE)
-else (MPI_COMPILE_CMDLINE)
-# No MPI compiler to interogate so attempt to find everything with find functions.
- find_path(MPI_INCLUDE_PATH mpi.h
- HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES include
- )
-
- # Decide between 32-bit and 64-bit libraries for Microsoft's MPI
- if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
- set(MS_MPI_ARCH_DIR amd64)
- else()
- set(MS_MPI_ARCH_DIR i386)
- endif()
-
- find_library(MPI_LIBRARY
- NAMES mpi mpich msmpi
- HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR}
- )
-
- find_library(MPI_EXTRA_LIBRARY
- NAMES mpi++
- HINTS ${_MPI_BASE_DIR} ${_MPI_PREFIX_PATH}
- PATH_SUFFIXES lib
- DOC "Extra MPI libraries to link against.")
-
- set(MPI_COMPILE_FLAGS "" CACHE STRING "MPI compilation flags")
- set(MPI_LINK_FLAGS "" CACHE STRING "MPI linking flags")
-endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
-
-# on BlueGene/L the MPI lib is named libmpich.rts.a, there also these additional libs are required
-if("${MPI_LIBRARY}" MATCHES "mpich.rts")
- set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY} msglayer.rts devices.rts rts.rts devices.rts)
- set(MPI_LIBRARY ${MPI_LIBRARY} msglayer.rts devices.rts rts.rts devices.rts)
-endif("${MPI_LIBRARY}" MATCHES "mpich.rts")
-
-# Set up extra variables to conform to
-if (MPI_EXTRA_LIBRARY)
- set(MPI_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
-else (MPI_EXTRA_LIBRARY)
- set(MPI_LIBRARIES ${MPI_LIBRARY})
-endif (MPI_EXTRA_LIBRARY)
-
-if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
- set(MPI_FOUND TRUE)
-else (MPI_INCLUDE_PATH AND MPI_LIBRARY)
- set(MPI_FOUND FALSE)
-endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
-
-include(FindPackageHandleStandardArgs)
-# handle the QUIETLY and REQUIRED arguments
-find_package_handle_standard_args(MPI DEFAULT_MSG MPI_LIBRARY MPI_INCLUDE_PATH)
-
-mark_as_advanced(MPI_INCLUDE_PATH MPI_COMPILE_FLAGS MPI_LINK_FLAGS MPI_LIBRARY
- MPI_EXTRA_LIBRARY)
-
-# unset to cleanup namespace
-unset(_MPI_PACKAGE_DIR)
-unset(_MPI_PREFIX_PATH)
-unset(_MPI_BASE_DIR)
--- /dev/null
+# This file is part of Gromacs Copyright (c) 1991-2008
+# David van der Spoel, Erik Lindahl, Berk Hess, University of Groningen.
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# To help us fund GROMACS development, we humbly ask that you cite
+# the research papers on the package. Check out http://www.gromacs.org
+
+# ================================================================
+
+# This file is adapted from FindGit.cmake from CMake 2.8.5
+# That file is copyright and redistribution outside
+# CMake requires the following license statement.
+
+# ================================================================
+
+# CMake - Cross Platform Makefile Generator
+# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+# All rights reserved.
+
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+
+# * Neither the names of Kitware, Inc., the Insight Software Consortium,
+# nor the names of their contributors may be used to endorse or promote
+# products derived from this software without specific prior written
+# permission.
+
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# ------------------------------------------------------------------------------
+
+# The above copyright and license notice applies to distributions of
+# CMake in source and binary form. Some source files contain additional
+# notices of original copyright by their contributors; see each source
+# for details. Third-party software packages supplied with CMake under
+# compatible licenses provide their own copyright notices documented in
+# corresponding subdirectories.
+
+# ------------------------------------------------------------------------------
+
+# CMake was initially developed by Kitware with the following sponsorship:
+
+# * National Library of Medicine at the National Institutes of Health
+# as part of the Insight Segmentation and Registration Toolkit (ITK).
+
+# * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
+# Visualization Initiative.
+
+# * National Alliance for Medical Image Computing (NAMIC) is funded by the
+# National Institutes of Health through the NIH Roadmap for Medical Research,
+# Grant U54 EB005149.
+
+# * Kitware, Inc.
+
+# ================================================================
+
+# The module defines the following variables:
+# VMD_EXECUTABLE - path to vmd command
+# VMD_FOUND - true if the command was found
+# Example usage:
+# find_package(VMD)
+# if(VMD_FOUND)
+# message("vmd found: ${VMD_EXECUTABLE}")
+# endif()
+
+set(vmd_names vmd)
+
+find_program(VMD_EXECUTABLE
+ NAMES ${vmd_names}
+ PATHS ENV VMDDIR
+ PATH_SUFFIXES bin # I guess this allows for OS-independence
+ DOC "VMD command"
+ )
+mark_as_advanced(VMD_EXECUTABLE)
+
+# Handle the QUIETLY and REQUIRED arguments and set VMD_FOUND to TRUE if
+# all listed variables are TRUE
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(VMD DEFAULT_MSG VMD_EXECUTABLE)
# gcc
if(CMAKE_COMPILER_IS_GNUCC)
- GMX_TEST_CFLAG(CFLAGS_WARN "-Wall -Wno-unused" GMXC_CFLAGS)
+ #flags are added in reverse order and -Wno* need to appear after -Wall
+ if(NOT GMX_OPENMP)
+ GMX_TEST_CFLAG(CFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CFLAGS)
+ endif()
+ GMX_TEST_CFLAG(CFLAGS_WARN "-Wall -Wno-unused -Wunused-value" GMXC_CFLAGS)
+ GMX_TEST_CFLAG(CFLAGS_WARN "-Wextra -Wno-missing-field-initializers -Wno-sign-compare" GMXC_CFLAGS)
# new in gcc 4.5
GMX_TEST_CFLAG(CFLAGS_EXCESS_PREC "-fexcess-precision=fast" GMXC_CFLAGS)
GMX_TEST_CFLAG(CFLAGS_COPT "-fomit-frame-pointer -finline-functions -funroll-all-loops"
endif()
# g++
if(CMAKE_COMPILER_IS_GNUCXX)
- GMX_TEST_CXXFLAG(CXXFLAGS_WARN "-Wall -Wno-unused" GMXC_CXXFLAGS)
+ if(NOT GMX_OPENMP)
+ GMX_TEST_CFLAG(CXXFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CXXFLAGS)
+ endif()
+ GMX_TEST_CXXFLAG(CXXFLAGS_WARN "-Wall -Wno-unused -Wunused-value" GMXC_CXXFLAGS)
+ GMX_TEST_CXXFLAG(CXXFLAGS_WARN "-Wextra -Wno-missing-field-initializers -Wno-sign-compare" GMXC_CXXFLAGS)
# new in gcc 4.5
GMX_TEST_CXXFLAG(CXXFLAGS_EXCESS_PREC "-fexcess-precision=fast"
GMXC_CXXFLAGS)
GMX_TEST_CFLAG(CFLAGS_SSE2 "-msse2" GMXC_CFLAGS_RELEASE)
GMX_TEST_CFLAG(CFLAGS_X86 "-mtune=core2" GMXC_CFLAGS_RELEASE)
GMX_TEST_CFLAG(CFLAGS_IA64 "-mtune=itanium2" GMXC_CFLAGS_RELEASE)
+ if(NOT GMX_OPENMP)
+ GMX_TEST_CFLAG(CFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CFLAGS)
+ endif()
else()
GMX_TEST_CFLAG(CFLAGS_SSE2 "/arch:SSE2" GMXC_CFLAGS_RELEASE)
GMX_TEST_CFLAG(CFLAGS_X86 "/Qip" GMXC_CFLAGS_RELEASE)
GMX_TEST_CXXFLAG(CXXFLAGS_X86 "-mtune=core2" GMXC_CXXFLAGS_RELEASE)
GMX_TEST_CXXFLAG(CXXFLAGS_IA64 "-mtune=itanium2"
GMXC_CXXFLAGS_RELEASE)
+ if(NOT GMX_OPENMP)
+ GMX_TEST_CFLAG(CXXFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CXXFLAGS)
+ endif()
else()
GMX_TEST_CXXFLAG(CXXFLAGS_SSE2 "/arch:SSE2" GMXC_CXXFLAGS_RELEASE)
GMX_TEST_CXXFLAG(CXXFLAGS_X86 "/Qip" GMXC_CXXFLAGS_RELEASE)
if(NOT GMX_OPENMP)
GMX_TEST_CFLAG(CFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CFLAGS)
endif()
- GMX_TEST_CFLAG(CFLAGS_WARN "-Wall -Wno-unused" GMXC_CFLAGS)
+ GMX_TEST_CFLAG(CFLAGS_WARN "-Wall -Wno-unused -Wunused-value" GMXC_CFLAGS)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(NOT GMX_OPENMP)
GMX_TEST_CXXFLAG(CXXFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CXXFLAGS)
endif()
- GMX_TEST_CXXFLAG(CXXFLAGS_WARN "-Wall -Wno-unused" GMXC_CXXFLAGS)
+ GMX_TEST_CXXFLAG(CXXFLAGS_WARN "-Wall -Wno-unused -Wunused-value" GMXC_CXXFLAGS)
endif()
# now actually set the flags:
# GEN_VERSION_INFO_INTERNAL has to be set ON.
#
# The following variables have to be previously defined:
-# Git_EXECUTABLE - path to git binary
-# Git_VERSION - git version (if not defined it's assumed that >=1.5.3)
+# GIT_EXECUTABLE - path to git binary
+# GIT_VERSION - git version (if not defined it's assumed that >=1.5.3)
# PROJECT_VERSION - hard-coded version string, should have the following structure:
# VERSION[-dev-SUFFIX] where the VERSION can have any form and the suffix
# is optional but should start with -dev
# if git executable xists and it's compatible version
# build the development version string
# this should at some point become VERSION_LESS
-if(EXISTS ${Git_EXECUTABLE} AND NOT Git_VERSION STRLESS "1.5.1")
+if(EXISTS ${GIT_EXECUTABLE} AND NOT ${GIT_VERSION} STRLESS "1.5.1")
# refresh git index
- execute_process(COMMAND ${Git_EXECUTABLE} update-index -q --refresh
+ execute_process(COMMAND ${GIT_EXECUTABLE} update-index -q --refresh
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
TIMEOUT 5
OUTPUT_QUIET
)
# get the full hash of the current HEAD
- execute_process(COMMAND ${Git_EXECUTABLE} rev-parse HEAD
+ execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GMX_GIT_HEAD_HASH
ERROR_VARIABLE EXEC_ERR
string(SUBSTRING ${GMX_GIT_HEAD_HASH} 0 5 HEAD_HASH_SHORT)
# if there are local uncommitted changes, the build gets labeled "dirty"
- execute_process(COMMAND ${Git_EXECUTABLE} diff-index --name-only HEAD
+ execute_process(COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE SRC_LOCAL_CHANGES
ERROR_VARIABLE EXEC_ERR
# if git is older then 1.5.3 we need to extract the RFC2822 style date
# and massage it, otherwise the ISO 8601 format is more trusworthy
# this should at some point become VERSION_LESS
- if (NOT Git_VERSION STREQUAL "" AND Git_VERSION STRLESS "1.5.3")
- execute_process(COMMAND ${Git_EXECUTABLE} rev-list -n1 "--pretty=format:%cD" HEAD
+ if (NOT GIT_VERSION STREQUAL "" AND GIT_VERSION STRLESS "1.5.3")
+ execute_process(COMMAND ${GIT_EXECUTABLE} rev-list -n1 "--pretty=format:%cD" HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE HEAD_DATE
ERROR_VARIABLE EXEC_ERR
string(REGEX REPLACE "DEC" "12" HEAD_DATE ${HEAD_DATE})
else()
# get the date of the HEAD commit
- execute_process(COMMAND ${Git_EXECUTABLE} rev-list -n1 "--pretty=format:%ci" HEAD
+ execute_process(COMMAND ${GIT_EXECUTABLE} rev-list -n1 "--pretty=format:%ci" HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE HEAD_DATE
ERROR_VARIABLE EXEC_ERR
set(VERSION_STR_SUFFIX "${HEAD_DATE}-${HEAD_HASH_SHORT}${DIRTY_STR}")
# find the name of the remote which is located on the official gromacs git server
- execute_process(COMMAND ${Git_EXECUTABLE} config --get-regexp
+ execute_process(COMMAND ${GIT_EXECUTABLE} config --get-regexp
"remote\\..*\\.url" "git\\.gromacs\\.org[:|/]gromacs"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GMX_REMOTE
# find the first ancestor in the list provided by rev-list (not
# necessarily the last though) which is in GMX_REMOTE, extract the
# hash and the number of commits HEAD is ahead with
- execute_process(COMMAND ${Git_EXECUTABLE} rev-list --max-count=100 HEAD
+ execute_process(COMMAND ${GIT_EXECUTABLE} rev-list --max-count=100 HEAD
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE ANCESTOR_LIST
)
set(AHEAD 0)
set(GMX_GIT_REMOTE_HASH "")
foreach(OBJ ${ANCESTOR_LIST})
- execute_process(COMMAND ${Git_EXECUTABLE} name-rev --refs=refs/remotes/${GMX_REMOTE}/* ${OBJ}
+ execute_process(COMMAND ${GIT_EXECUTABLE} name-rev --refs=refs/remotes/${GMX_REMOTE}/* ${OBJ}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE HASH_AND_REVNAME
OUTPUT_STRIP_TRAILING_WHITESPACE
--- /dev/null
+# Manage the MPI setup, assuming that CMAKE_C_COMPILER is an MPI
+# (wrapper) compiler.
+if(GMX_MPI)
+ if(GMX_THREAD_MPI)
+ message(STATUS "MPI is not compatible with thread-MPI. Disabling thread-MPI.")
+ set(GMX_THREAD_MPI OFF CACHE BOOL
+ "Build a thread-MPI-based multithreaded version of GROMACS (not compatible with MPI)" FORCE)
+ endif(GMX_THREAD_MPI)
+
+ # Test the CMAKE_C_COMPILER for being an MPI (wrapper) compiler
+ TRY_COMPILE(MPI_FOUND ${CMAKE_BINARY_DIR}
+ "${CMAKE_SOURCE_DIR}/cmake/TestMPI.c"
+ COMPILE_DEFINITIONS )
+
+ if(MPI_FOUND)
+ if(GMX_FAHCORE)
+ add_definitions( -DMPI ) #for FAHCORE
+ endif()
+ include(gmxTestMPI_IN_PLACE)
+ if (GMX_MPI_IN_PLACE)
+ gmx_test_mpi_in_place(MPI_IN_PLACE_EXISTS)
+ endif()
+
+ # Test for and warn about unsuitable MPI versions
+ exec_program(ompi_info
+ ARGS -v ompi full
+ OUTPUT_VARIABLE OPENMPI_TYPE
+ RETURN_VALUE OPENMPI_EXEC_RETURN)
+ if(OPENMPI_EXEC_RETURN EQUAL 0)
+ string(REGEX REPLACE ".*Open MPI: \([0-9]+\\.[0-9]*\\.?[0-9]*\).*" "\\1" OPENMPI_VERSION ${OPENMPI_TYPE})
+ if(OPENMPI_VERSION VERSION_LESS "1.4.1")
+ MESSAGE(WARNING "
+ CMake found OpenMPI version ${OPENMPI_VERSION} on your system.
+ There are known problems with GROMACS and OpenMPI version < 1.4.1.
+ Please consider updating your OpenMPI if your MPI wrapper compilers
+ are using the above OpenMPI version.")
+ endif()
+ unset(OPENMPI_VERSION)
+ unset(OPENMPI_TYPE)
+ unset(OPENMPI_EXEC_RETURN)
+ endif()
+ exec_program(mpiname
+ ARGS -n -v
+ OUTPUT_VARIABLE MVAPICH2_TYPE
+ RETURN_VALUE MVAPICH2_EXEC_RETURN)
+ if(MVAPICH2_EXEC_RETURN EQUAL 0)
+ string(REGEX MATCH "MVAPICH2" MVAPICH2_NAME ${MVAPICH2_TYPE})
+ # Want to check for MVAPICH2 in case some other library supplies mpiname
+ string(REGEX REPLACE "MVAPICH2 \([0-9]+\\.[0-9]*[a-z]?\\.?[0-9]*\)" "\\1" MVAPICH2_VERSION ${MVAPICH2_TYPE})
+ if(${MVAPICH2_NAME} STREQUAL "MVAPICH2" AND MVAPICH2_VERSION VERSION_LESS "1.5")
+ # This test works correctly even with 1.5a1
+ MESSAGE(WARNING "
+ CMake found MVAPICH2 version ${MVAPICH2_VERSION} on your system.
+ There are known problems with GROMACS and MVAPICH2 version < 1.5.
+ Please consider updating your MVAPICH2 if your MPI wrapper compilers
+ are using the above MVAPICH2 version.")
+ endif()
+ unset(MVAPICH2_VERSION)
+ unset(MVAPICH2_NAME)
+ unset(MVAPICH2_TYPE)
+ unset(MVAPICH2_EXEC_RETURN)
+ endif()
+
+ else(MPI_FOUND)
+ message(FATAL_ERROR "MPI support requested, but no MPI compiler found.")
+ endif(MPI_FOUND)
+
+ include(gmxTestCatamount)
+ gmx_test_catamount(GMX_CRAY_XT3)
+ if(GMX_CRAY_XT3)
+ set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_CRAY_XT3")
+ set(GMX_NO_SYSTEM 1)
+ set(GMX_NO_NICE 1)
+ endif(GMX_CRAY_XT3)
+
+ set(GMX_LIB_MPI 1)
+ set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_LIB_MPI")
+endif(GMX_MPI)
#
MACRO(gmx_test_isfinite VARIABLE)
+ if(NOT DEFINED isfinite_compile_ok)
MESSAGE(STATUS "Checking for isfinite")
set(CMAKE_REQUIRED_INCLUDES "math.h")
else(isfinite_compile_ok)
MESSAGE(STATUS "Checking for isfinite - no")
endif(isfinite_compile_ok)
+ set(isfinite_compile_ok "${isfinite_compile_ok}" CACHE INTERNAL "Result of isfinite check")
+ endif(NOT DEFINED isfinite_compile_ok)
ENDMACRO(gmx_test_isfinite VARIABLE)
MACRO(gmx_test__isfinite VARIABLE)
+ if(NOT DEFINED _isfinite_compile_ok)
MESSAGE(STATUS "Checking for _isfinite")
set(CMAKE_REQUIRED_INCLUDES "math.h")
else(_isfinite_compile_ok)
MESSAGE(STATUS "Checking for _isfinite - no")
endif(_isfinite_compile_ok)
+ set(_isfinite_compile_ok "${_isfinite_compile_ok}" CACHE INTERNAL "Result of _isfinite check")
+ endif(NOT DEFINED _isfinite_compile_ok)
ENDMACRO(gmx_test__isfinite VARIABLE)
# Necessary for MSVC
MACRO(gmx_test__finite VARIABLE)
+ if(NOT DEFINED _finite_compile_ok)
MESSAGE(STATUS "Checking for _finite")
set(CMAKE_REQUIRED_INCLUDES "float.h")
else(_finite_compile_ok)
MESSAGE(STATUS "Checking for _finite - no")
endif(_finite_compile_ok)
+ set(_finite_compile_ok "${_finite_compile_ok}" CACHE INTERNAL "Result of _finite check")
+ endif(NOT DEFINED _finite_compile_ok)
ENDMACRO(gmx_test__finite VARIABLE)
# _LARGE_FILES
# _LARGEFILE_SOURCE
# _FILE_OFFSET_BITS 64
-# HAVE_FSEEKO
#
# However, it is YOUR job to make sure these defines are set in a cmakedefine so they
# end up in a config.h file that is included in your source if necessary!
if(FSEEKO_COMPILE_OK)
SET(${VARIABLE} 1 CACHE INTERNAL "Result of test for large file support" FORCE)
- set(HAVE_FSEEKO 1)
else(FSEEKO_COMPILE_OK)
if (HAVE__FSEEKI64)
SET(${VARIABLE} 1 CACHE INTERNAL "Result of test for large file support" FORCE)
# VARIABLE will be set to true if MPI_IN_PLACE exists
#
+include(CheckCSourceCompiles)
MACRO(GMX_TEST_MPI_IN_PLACE VARIABLE)
MESSAGE(STATUS "Checking for MPI_IN_PLACE")
+++ /dev/null
-# - Define macro to check return type of signals (int/void)
-#
-# GMX_TEST_RETSIGTYPE(VARIABLE)
-#
-# VARIABLE will be set to the return type of signals - "int" or "void"
-#
-# Remember to have a cmakedefine for it too...
-
-MACRO(GMX_TEST_RETSIGTYPE VARIABLE)
- IF(NOT DEFINED ${VARIABLE})
-
- MESSAGE(STATUS "Checking for return type of signals")
-
- # First check without any special flags
- TRY_COMPILE(RETSIGTYPE_INT_OK "${CMAKE_BINARY_DIR}"
- "${CMAKE_SOURCE_DIR}/cmake/TestRetSigType.c")
-
- if(RETSIGTYPE_INT_OK)
- MESSAGE(STATUS "Checking for return type of signals - int")
- set(${VARIABLE} "int" CACHE INTERNAL "Result of test for signal return type" FORCE)
- else(RETSIGTYPE_INT_OK)
- MESSAGE(STATUS "Checking for return type of signals - void")
- set(${VARIABLE} "void" CACHE INTERNAL "Result of test for signal return type" FORCE)
- endif(RETSIGTYPE_INT_OK)
-
- ENDIF(NOT DEFINED ${VARIABLE})
-ENDMACRO(GMX_TEST_RETSIGTYPE VARIABLE)
-
-
-
-# - Define macro to check return type of signals (int/void)
-#
-# GMX_TEST_RETSIGTYPE(VARIABLE)
-#
-# VARIABLE will be set to the return type of signals - "int" or "void"
-#
-# Remember to have a cmakedefine for it too...
-
-MACRO(GMX_TEST_RETSIGTYPE VARIABLE)
- IF(NOT DEFINED ${VARIABLE})
-
- MESSAGE(STATUS "Checking for return type of signals")
-
- # First check without any special flags
- TRY_COMPILE(RETSIGTYPE_INT_OK "${CMAKE_BINARY_DIR}"
- "${CMAKE_SOURCE_DIR}/cmake/TestRetSigType.c")
-
- if(RETSIGTYPE_INT_OK)
- MESSAGE(STATUS "Checking for return type of signals - int")
- set(${VARIABLE} "int" CACHE INTERNAL "Result of test for signal return type" FORCE)
- else(RETSIGTYPE_INT_OK)
- MESSAGE(STATUS "Checking for return type of signals - void")
- set(${VARIABLE} "void" CACHE INTERNAL "Result of test for signal return type" FORCE)
- endif(RETSIGTYPE_INT_OK)
-
- ENDIF(NOT DEFINED ${VARIABLE})
-ENDMACRO(GMX_TEST_RETSIGTYPE VARIABLE)
-
-
-
# - Define macro to check if SIGUSR1 is defined
#
# GMX_TEST_SIGUSR1(VARIABLE)
--- /dev/null
+# - Define macro to check if DLOPEN is defined
+#
+# GMX_TEST_DLOPEN(VARIABLE)
+#
+# VARIABLE will be set if dlopen is present in dlfcn.h
+#
+
+MACRO(GMX_TEST_DLOPEN VARIABLE)
+ IF(NOT DEFINED ${VARIABLE})
+ MESSAGE(STATUS "Checking for dlopen")
+
+ set(CMAKE_REQUIRED_INCLUDES "dlfcn.h")
+ set(CMAKE_REQUIRED_LIBRARIES "dl")
+ check_c_source_compiles(
+ "#include <dlfcn.h>
+int main(void) {
+ dlopen(0,0);
+}" ${VARIABLE})
+
+ IF(${VARIABLE})
+ MESSAGE(STATUS "Checking for dlopen - found")
+ set(${VARIABLE} 1 CACHE INTERNAL "Result of test for dlopen" FORCE)
+ ELSE()
+ MESSAGE(STATUS "Checking for dlopen - not found")
+ set(${VARIABLE} 0 CACHE INTERNAL "Result of test for dlopen" FORCE)
+ ENDIF()
+ ENDIF()
+ENDMACRO()
\ No newline at end of file
+++ /dev/null
-#! /bin/sh
-# Wrapper for compilers which do not understand `-c -o'.
-
-scriptversion=2005-05-14.22
-
-# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
-# Written by Tom Tromey <tromey@cygnus.com>.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# This file is maintained in Automake, please report
-# bugs to <bug-automake@gnu.org> or send patches to
-# <automake-patches@gnu.org>.
-
-case $1 in
- '')
- echo "$0: No command. Try \`$0 --help' for more information." 1>&2
- exit 1;
- ;;
- -h | --h*)
- cat <<\EOF
-Usage: compile [--help] [--version] PROGRAM [ARGS]
-
-Wrapper for compilers which do not understand `-c -o'.
-Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
-arguments, and rename the output as expected.
-
-If you are trying to build a whole package this is not the
-right script to run: please start by reading the file `INSTALL'.
-
-Report bugs to <bug-automake@gnu.org>.
-EOF
- exit $?
- ;;
- -v | --v*)
- echo "compile $scriptversion"
- exit $?
- ;;
-esac
-
-ofile=
-cfile=
-eat=
-
-for arg
-do
- if test -n "$eat"; then
- eat=
- else
- case $1 in
- -o)
- # configure might choose to run compile as `compile cc -o foo foo.c'.
- # So we strip `-o arg' only if arg is an object.
- eat=1
- case $2 in
- *.o | *.obj)
- ofile=$2
- ;;
- *)
- set x "$@" -o "$2"
- shift
- ;;
- esac
- ;;
- *.c)
- cfile=$1
- set x "$@" "$1"
- shift
- ;;
- *)
- set x "$@" "$1"
- shift
- ;;
- esac
- fi
- shift
-done
-
-if test -z "$ofile" || test -z "$cfile"; then
- # If no `-o' option was seen then we might have been invoked from a
- # pattern rule where we don't need one. That is ok -- this is a
- # normal compilation that the losing compiler can handle. If no
- # `.c' file was seen then we are probably linking. That is also
- # ok.
- exec "$@"
-fi
-
-# Name of file we expect compiler to create.
-cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
-
-# Create the lock directory.
-# Note: use `[/.-]' here to ensure that we don't use the same name
-# that we are using for the .o file. Also, base the name on the expected
-# object file name, since that is what matters with a parallel build.
-lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
-while true; do
- if mkdir "$lockdir" >/dev/null 2>&1; then
- break
- fi
- sleep 1
-done
-# FIXME: race condition here if user kills between mkdir and trap.
-trap "rmdir '$lockdir'; exit 1" 1 2 15
-
-# Run the compile.
-"$@"
-ret=$?
-
-if test -f "$cofile"; then
- mv "$cofile" "$ofile"
-elif test -f "${cofile}bj"; then
- mv "${cofile}bj" "$ofile"
-fi
-
-rmdir "$lockdir"
-exit $ret
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
+++ /dev/null
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-# Free Software Foundation, Inc.
-
-timestamp='2010-07-29'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner. Please send patches (context
-# diff format) to <config-patches@gnu.org> and include a ChangeLog
-# entry.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub. If it succeeds, it prints the system name on stdout, and
-# exits with 0. Otherwise, it exits with 1.
-#
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
-Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help" >&2
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-trap 'exit 1' HUP INT TERM
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" HUP INT PIPE TERM ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- *:NetBSD:*:*)
- # NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
- # switched to ELF, *-*-netbsd* would select the old
- # object file format. This provides both forward
- # compatibility and a consistent mechanism for selecting the
- # object file format.
- #
- # Note: NetBSD doesn't particularly care about the vendor
- # portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
- armeb) machine=armeb-unknown ;;
- arm*) machine=arm-unknown ;;
- sh3el) machine=shl-unknown ;;
- sh3eb) machine=sh-unknown ;;
- sh5el) machine=sh5le-unknown ;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
- esac
- # The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
- case "${UNAME_MACHINE_ARCH}" in
- arm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ELF__
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- ;;
- *)
- os=netbsd
- ;;
- esac
- # The OS release
- # Debian GNU/NetBSD machines have a different userland, and
- # thus, need a distinct triplet. However, they do not need
- # kernel version information, so it can be replaced with a
- # suitable tag, in the style of linux-gnu.
- case "${UNAME_VERSION}" in
- Debian*)
- release='-gnu'
- ;;
- *)
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- ;;
- esac
- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
- # contains redundant information, the shorter form:
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}"
- exit ;;
- *:OpenBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
- exit ;;
- *:ekkoBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit ;;
- *:SolidBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
- exit ;;
- macppc:MirBSD:*:*)
- echo powerpc-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- *:MirBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- alpha:OSF1:*:*)
- case $UNAME_RELEASE in
- *4.0)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- ;;
- *5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
- ;;
- esac
- # According to Compaq, /usr/sbin/psrinfo has been available on
- # OSF/1 and Tru64 systems produced since 1995. I hope that
- # covers most systems running today. This code pipes the CPU
- # types through head -n 1, so we only detect the type of CPU 0.
- ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
- "EV4 (21064)")
- UNAME_MACHINE="alpha" ;;
- "EV4.5 (21064)")
- UNAME_MACHINE="alpha" ;;
- "LCA4 (21066/21068)")
- UNAME_MACHINE="alpha" ;;
- "EV5 (21164)")
- UNAME_MACHINE="alphaev5" ;;
- "EV5.6 (21164A)")
- UNAME_MACHINE="alphaev56" ;;
- "EV5.6 (21164PC)")
- UNAME_MACHINE="alphapca56" ;;
- "EV5.7 (21164PC)")
- UNAME_MACHINE="alphapca57" ;;
- "EV6 (21264)")
- UNAME_MACHINE="alphaev6" ;;
- "EV6.7 (21264A)")
- UNAME_MACHINE="alphaev67" ;;
- "EV6.8CB (21264C)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8AL (21264B)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8CX (21264D)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.9A (21264/EV69A)")
- UNAME_MACHINE="alphaev69" ;;
- "EV7 (21364)")
- UNAME_MACHINE="alphaev7" ;;
- "EV7.9 (21364A)")
- UNAME_MACHINE="alphaev79" ;;
- esac
- # A Pn.n version is a patched version.
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- exit ;;
- Alpha\ *:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # Should we change UNAME_MACHINE based on the output of uname instead
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit ;;
- *:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
- exit ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
- *:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
- *:OS400:*:*)
- echo powerpc-ibm-os400
- exit ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit ;;
- arm:riscos:*:*|arm:RISCOS:*:*)
- echo arm-unknown-riscos
- exit ;;
- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
- DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
- DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
- case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
- s390x:SunOS:*:*)
- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
- echo i386-pc-auroraux${UNAME_RELEASE}
- exit ;;
- i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- eval $set_cc_for_build
- SUN_ARCH="i386"
- # If there is a compiler, see if it is configured for 64-bit objects.
- # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
- # This test works for both compilers.
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- SUN_ARCH="x86_64"
- fi
- fi
- echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit ;;
- # The situation for MiNT is a little confusing. The machine name
- # can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
- # to the lowercase version "mint" (or "freemint"). Finally
- # the system name "TOS" denotes a system which is actually not
- # MiNT. But MiNT is downward compatible to TOS, so this should
- # be no problem.
- atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
- m68k:machten:*:*)
- echo m68k-apple-machten${UNAME_RELEASE}
- exit ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c &&
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`$dummy $dummyarg` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos${UNAME_RELEASE}
- exit ;;
- Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
- Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
- AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
- then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
- then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else
- echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
- ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
- then
- echo "$SYSTEM_NAME"
- else
- echo rs6000-ibm-aix3.2.5
- fi
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit ;;
- *:AIX:*:[4567])
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
- 9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
- '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
- fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
-
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
-EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
- test -z "$HP_ARCH" && HP_ARCH=hppa
- fi ;;
- esac
- if [ ${HP_ARCH} = "hppa2.0w" ]
- then
- eval $set_cc_for_build
-
- # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
- # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
- # generating 64-bit code. GNU and HP use different nomenclature:
- #
- # $ CC_FOR_BUILD=cc ./config.guess
- # => hppa2.0w-hp-hpux11.23
- # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
- # => hppa64-hp-hpux11.23
-
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep -q __LP64__
- then
- HP_ARCH="hppa2.0w"
- else
- HP_ARCH="hppa64"
- fi
- fi
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit ;;
- ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit ;;
- 3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
- *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
- i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
- -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- *:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- 5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:FreeBSD:*:*)
- case ${UNAME_MACHINE} in
- pc98)
- echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- amd64)
- echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- *)
- echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- esac
- exit ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit ;;
- *:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit ;;
- *:Interix*:*)
- case ${UNAME_MACHINE} in
- x86)
- echo i586-pc-interix${UNAME_RELEASE}
- exit ;;
- authenticamd | genuineintel | EM64T)
- echo x86_64-unknown-interix${UNAME_RELEASE}
- exit ;;
- IA64)
- echo ia64-unknown-interix${UNAME_RELEASE}
- exit ;;
- esac ;;
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- echo i${UNAME_MACHINE}-pc-mks
- exit ;;
- 8664:Windows_NT:*)
- echo x86_64-pc-mks
- exit ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i586-pc-interix
- exit ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit ;;
- amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-unknown-cygwin
- exit ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- *:GNU:*:*)
- # the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit ;;
- *:GNU/*:*:*)
- # other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
- exit ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
- exit ;;
- arm*:Linux:*:*)
- eval $set_cc_for_build
- if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_EABI__
- then
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- else
- echo ${UNAME_MACHINE}-unknown-linux-gnueabi
- fi
- exit ;;
- avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- cris:Linux:*:*)
- echo cris-axis-linux-gnu
- exit ;;
- crisv32:Linux:*:*)
- echo crisv32-axis-linux-gnu
- exit ;;
- frv:Linux:*:*)
- echo frv-unknown-linux-gnu
- exit ;;
- i*86:Linux:*:*)
- LIBC=gnu
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #ifdef __dietlibc__
- LIBC=dietlibc
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
- echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
- exit ;;
- ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- mips:Linux:*:* | mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef ${UNAME_MACHINE}
- #undef ${UNAME_MACHINE}el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=${UNAME_MACHINE}el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=${UNAME_MACHINE}
- #else
- CPU=
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
- ;;
- or32:Linux:*:*)
- echo or32-unknown-linux-gnu
- exit ;;
- padre:Linux:*:*)
- echo sparc-unknown-linux-gnu
- exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-gnu
- exit ;;
- parisc:Linux:*:* | hppa:Linux:*:*)
- # Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-gnu ;;
- PA8*) echo hppa2.0-unknown-linux-gnu ;;
- *) echo hppa-unknown-linux-gnu ;;
- esac
- exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-gnu
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-gnu
- exit ;;
- s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux
- exit ;;
- sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-gnu
- exit ;;
- x86_64:Linux:*:*)
- echo x86_64-unknown-linux-gnu
- exit ;;
- xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-gnu
- exit ;;
- i*86:DYNIX/ptx:4*:*)
- # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
- # earlier versions are messed up and put the nodename in both
- # sysname and nodename.
- echo i386-sequent-sysv4
- exit ;;
- i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit ;;
- i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit ;;
- i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit ;;
- i*86:syllable:*:*)
- echo ${UNAME_MACHINE}-pc-syllable
- exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- fi
- exit ;;
- i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
- case `/bin/uname -X | grep "^Machine"` in
- *486*) UNAME_MACHINE=i486 ;;
- *Pentium) UNAME_MACHINE=i586 ;;
- *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
- esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit ;;
- i*86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
- (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit ;;
- pc:*:*:*)
- # Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i586.
- # Note: whatever this is, it MUST be the same as what config.sub
- # prints for the "djgpp" host, or else GDB configury will decide that
- # this is a cross-build.
- echo i586-pc-msdosdjgpp
- exit ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit ;;
- mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
- M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
- M68*:*:R3V[5678]*:*)
- test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4; exit; } ;;
- NCR*:*:4.2:* | MPRAS*:*:4.2:*)
- OS_REL='.3'
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
- i*86:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo ${UNAME_MACHINE}-stratus-vos
- exit ;;
- *:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
- BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
- echo i586-pc-haiku
- exit ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-7:SUPER-UX:*:*)
- echo sx7-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8:SUPER-UX:*:*)
- echo sx8-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8R:SUPER-UX:*:*)
- echo sx8r-nec-superux${UNAME_RELEASE}
- exit ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- case $UNAME_PROCESSOR in
- i386)
- eval $set_cc_for_build
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- UNAME_PROCESSOR="x86_64"
- fi
- fi ;;
- unknown) UNAME_PROCESSOR=powerpc ;;
- esac
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = "x86"; then
- UNAME_PROCESSOR=i386
- UNAME_MACHINE=pc
- fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
- NSE-?:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit ;;
- *:Plan9:*:*)
- # "uname -m" is not consistent, so use $cputype instead. 386
- # is converted to i386 for consistency with other x86
- # operating systems.
- if test "$cputype" = "386"; then
- UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
- fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit ;;
- *:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
- *:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
- *:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
- *:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
- SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
- exit ;;
- *:DragonFly:*:*)
- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit ;;
- *:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- case "${UNAME_MACHINE}" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
- esac ;;
- *:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
- i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
- exit ;;
- i*86:rdos:*:*)
- echo ${UNAME_MACHINE}-pc-rdos
- exit ;;
- i*86:AROS:*:*)
- echo ${UNAME_MACHINE}-pc-aros
- exit ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
- /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
- I don't know.... */
- printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
- printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
- "4"
-#else
- ""
-#endif
- ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
- printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
- printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
- int version;
- version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
- if (version < 4)
- printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
- else
- printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
- exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
- printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
- printf ("ns32k-encore-mach\n"); exit (0);
-#else
- printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
- printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
- printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
- printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
- struct utsname un;
-
- uname(&un);
-
- if (strncmp(un.version, "V2", 2) == 0) {
- printf ("i386-sequent-ptx2\n"); exit (0);
- }
- if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
- printf ("i386-sequent-ptx1\n"); exit (0);
- }
- printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-# include <sys/param.h>
-# if defined (BSD)
-# if BSD == 43
- printf ("vax-dec-bsd4.3\n"); exit (0);
-# else
-# if BSD == 199006
- printf ("vax-dec-bsd4.3reno\n"); exit (0);
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# endif
-# else
- printf ("vax-dec-bsd\n"); exit (0);
-# endif
-# else
- printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
- printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
- exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
- case `getsysinfo -f cpu_type` in
- c1*)
- echo c1-convex-bsd
- exit ;;
- c2*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- c34*)
- echo c34-convex-bsd
- exit ;;
- c38*)
- echo c38-convex-bsd
- exit ;;
- c4*)
- echo c4-convex-bsd
- exit ;;
- esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-and
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
+++ /dev/null
-#! /bin/sh
-# Configuration validation subroutine script.
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-# Free Software Foundation, Inc.
-
-timestamp='2010-05-21'
-
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine. It does not imply ALL GNU software can.
-#
-# This file is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted GNU ChangeLog entry.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free
-Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit ;;
-
- * )
- break ;;
- esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
- exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
- exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
- linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
- knetbsd*-gnu* | netbsd*-gnu* | \
- kopensolaris*-gnu* | \
- storm-chaos* | os2-emx* | rtmk-nova*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze)
- os=
- basic_machine=$1
- ;;
- -bluegene*)
- os=-cnk
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -chorusos*)
- os=-chorusos
- basic_machine=$1
- ;;
- -chorusrdb)
- os=-chorusrdb
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco6)
- os=-sco5v6
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5v6*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
- | am33_2.0 \
- | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
- | bfin \
- | c4x | clipper \
- | d10v | d30v | dlx | dsp16xx \
- | fido | fr30 | frv \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | i370 | i860 | i960 | ia64 \
- | ip2k | iq2000 \
- | lm32 \
- | m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | mcore | mep | metag \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64octeon | mips64octeonel \
- | mips64orion | mips64orionel \
- | mips64r5900 | mips64r5900el \
- | mips64vr | mips64vrel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mips64vr5900 | mips64vr5900el \
- | mipsisa32 | mipsisa32el \
- | mipsisa32r2 | mipsisa32r2el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64r2 | mipsisa64r2el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | moxie \
- | mt \
- | msp430 \
- | nios | nios2 \
- | ns16k | ns32k \
- | or32 \
- | pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
- | pyramid \
- | rx \
- | score \
- | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
- | sh64 | sh64le \
- | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
- | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
- | spu | strongarm \
- | tahoe | thumb | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
- | ubicom32 \
- | v850 | v850e \
- | we32k \
- | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
- | z8k | z80)
- basic_machine=$basic_machine-unknown
- ;;
- c54x)
- basic_machine=tic54x-unknown
- ;;
- c55x)
- basic_machine=tic55x-unknown
- ;;
- c6x)
- basic_machine=tic6x-unknown
- ;;
- m6811 | m68hc11 | m6812 | m68hc12 | picochip)
- # Motorola 68HC11/12.
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
- ;;
- ms1)
- basic_machine=mt-unknown
- ;;
-
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
- | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
- | avr-* | avr32-* \
- | bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* \
- | clipper-* | craynv-* | cydra-* \
- | d10v-* | d30v-* | dlx-* \
- | elxsi-* \
- | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
- | h8300-* | h8500-* \
- | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
- | i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* | iq2000-* \
- | lm32-* \
- | m32c-* | m32r-* | m32rle-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64octeon-* | mips64octeonel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64r5900-* | mips64r5900el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mips64vr5900-* | mips64vr5900el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa32r2-* | mipsisa32r2el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64r2-* | mipsisa64r2el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipstx39-* | mipstx39el-* \
- | mmix-* \
- | mt-* \
- | msp430-* \
- | nios-* | nios2-* \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
- | pyramid-* \
- | romp-* | rs6000-* | rx-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
- | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
- | sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
- | tahoe-* | thumb-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tile-* | tilegx-* \
- | tron-* \
- | ubicom32-* \
- | v850-* | v850e-* | vax-* \
- | we32k-* \
- | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
- | xstormy16-* | xtensa*-* \
- | ymp-* \
- | z8k-* | z80-*)
- ;;
- # Recognize the basic CPU types without company name, with glob match.
- xtensa*)
- basic_machine=$basic_machine-unknown
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- abacus)
- basic_machine=abacus-unknown
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amd64)
- basic_machine=x86_64-pc
- ;;
- amd64-*)
- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aros)
- basic_machine=i386-pc
- os=-aros
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- blackfin)
- basic_machine=bfin-unknown
- os=-linux
- ;;
- blackfin-*)
- basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- bluegene*)
- basic_machine=powerpc-ibm
- os=-cnk
- ;;
- c54x-*)
- basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c55x-*)
- basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c6x-*)
- basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c90)
- basic_machine=c90-cray
- os=-unicos
- ;;
- cegcc)
- basic_machine=arm-unknown
- os=-cegcc
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | j90)
- basic_machine=j90-cray
- os=-unicos
- ;;
- craynv)
- basic_machine=craynv-cray
- os=-unicosmp
- ;;
- cr16)
- basic_machine=cr16-unknown
- os=-elf
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- crisv32 | crisv32-* | etraxfs*)
- basic_machine=crisv32-axis
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- crx)
- basic_machine=crx-unknown
- os=-elf
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=-tops10
- ;;
- decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=-tops20
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- dicos)
- basic_machine=i686-pc
- os=-dicos
- ;;
- djgpp)
- basic_machine=i586-pc
- os=-msdosdjgpp
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
- ;;
- hp9k78[0-9] | hp78[0-9])
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- ;;
-# I'm not sure what "Sysv32" means. Should this be sysv3.2?
- i*86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- m68knommu)
- basic_machine=m68k-unknown
- os=-linux
- ;;
- m68knommu-*)
- basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- microblaze)
- basic_machine=microblaze-xilinx
- ;;
- mingw32)
- basic_machine=i386-pc
- os=-mingw32
- ;;
- mingw32ce)
- basic_machine=arm-unknown
- os=-mingw32ce
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- morphos)
- basic_machine=powerpc-unknown
- os=-morphos
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- ms1-*)
- basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- openrisc | openrisc-*)
- basic_machine=or32-unknown
- ;;
- os400)
- basic_machine=powerpc-ibm
- os=-os400
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- parisc)
- basic_machine=hppa-unknown
- os=-linux
- ;;
- parisc-*)
- basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pc98)
- basic_machine=i386-pc
- ;;
- pc98-*)
- basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2 | pentiumiii | pentium3)
- basic_machine=i686-pc
- ;;
- pentium4)
- basic_machine=i786-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium4-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc) basic_machine=powerpc-unknown
- ;;
- ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64) basic_machine=powerpc64-unknown
- ;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
- basic_machine=powerpc64le-unknown
- ;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rdos)
- basic_machine=i386-pc
- os=-rdos
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- s390 | s390-*)
- basic_machine=s390-ibm
- ;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
- ;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
- ;;
- sde)
- basic_machine=mipsisa32-sde
- os=-elf
- ;;
- sei)
- basic_machine=mips-sei
- os=-seiux
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sh5el)
- basic_machine=sh5le-unknown
- ;;
- sh64)
- basic_machine=sh64-unknown
- ;;
- sparclite-wrs | simso-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- st2000)
- basic_machine=m68k-tandem
- ;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- t3e)
- basic_machine=alphaev5-cray
- os=-unicos
- ;;
- t90)
- basic_machine=t90-cray
- os=-unicos
- ;;
- # This must be matched before tile*.
- tilegx*)
- basic_machine=tilegx-unknown
- os=-linux-gnu
- ;;
- tile*)
- basic_machine=tile-unknown
- os=-linux-gnu
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- toad1)
- basic_machine=pdp10-xkl
- os=-tops20
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- tpf)
- basic_machine=s390x-ibm
- os=-tpf
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- w65*)
- basic_machine=w65-wdc
- os=-none
- ;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
- ;;
- xbox)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- z80-*-coff)
- basic_machine=z80-unknown
- os=-sim
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
- ;;
- op50n)
- basic_machine=hppa1.1-oki
- ;;
- op60c)
- basic_machine=hppa1.1-oki
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- mmix)
- basic_machine=mmix-knuth
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
- basic_machine=sh-unknown
- ;;
- sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
- ;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
- ;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -auroraux)
- os=-auroraux
- ;;
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* | -aros* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -openbsd* | -solidbsd* \
- | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
- | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* | -cegcc* \
- | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-uclibc* \
- | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto-qnx*)
- ;;
- -nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- -linux-dietlibc)
- os=-linux-dietlibc
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -opened*)
- os=-openedition
- ;;
- -os400*)
- os=-os400
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -atheos*)
- os=-atheos
- ;;
- -syllable*)
- os=-syllable
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -nova*)
- os=-rtmk-nova
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -tpf*)
- os=-tpf
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -ose*)
- os=-ose
- ;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
- ;;
- -aros*)
- os=-aros
- ;;
- -kaos*)
- os=-kaos
- ;;
- -zvmoe)
- os=-zvmoe
- ;;
- -dicos*)
- os=-dicos
- ;;
- -nacl*)
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- score-*)
- os=-elf
- ;;
- spu-*)
- os=-elf
- ;;
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
- tic54x-*)
- os=-coff
- ;;
- tic55x-*)
- os=-coff
- ;;
- tic6x-*)
- os=-coff
- ;;
- # This must come before the *-dec entry.
- pdp10-*)
- os=-tops20
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- # This also exists in the configure program, but was not the
- # default.
- # os=-sunos4
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mep-*)
- os=-elf
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- or32-*)
- os=-coff
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-haiku)
- os=-haiku
- ;;
- *-ibm)
- os=-aix
- ;;
- *-knuth)
- os=-mmixware
- ;;
- *-wec)
- os=-proelf
- ;;
- *-winbond)
- os=-proelf
- ;;
- *-oki)
- os=-proelf
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
- ;;
- *-rom68k)
- os=-coff
- ;;
- *-*bug)
- os=-coff
- ;;
- *-apple)
- os=-macos
- ;;
- *-atari*)
- os=-mint
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -cnk*|-aix*)
- vendor=ibm
- ;;
- -beos*)
- vendor=be
- ;;
- -hpux*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs* | -opened*)
- vendor=ibm
- ;;
- -os400*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -tpf*)
- vendor=ibm
- ;;
- -vxsim* | -vxworks* | -windiss*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- vendor=atari
- ;;
- -vos*)
- vendor=stratus
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
+++ /dev/null
-#! /bin/sh
-# depcomp - compile a program generating dependencies as side-effects
-
-scriptversion=2007-03-29.01
-
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
-# Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
-
-case $1 in
- '')
- echo "$0: No command. Try \`$0 --help' for more information." 1>&2
- exit 1;
- ;;
- -h | --h*)
- cat <<\EOF
-Usage: depcomp [--help] [--version] PROGRAM [ARGS]
-
-Run PROGRAMS ARGS to compile a file, generating dependencies
-as side-effects.
-
-Environment variables:
- depmode Dependency tracking mode.
- source Source file read by `PROGRAMS ARGS'.
- object Object file output by `PROGRAMS ARGS'.
- DEPDIR directory where to store dependencies.
- depfile Dependency file to output.
- tmpdepfile Temporary file to use when outputing dependencies.
- libtool Whether libtool is used (yes/no).
-
-Report bugs to <bug-automake@gnu.org>.
-EOF
- exit $?
- ;;
- -v | --v*)
- echo "depcomp $scriptversion"
- exit $?
- ;;
-esac
-
-if test -z "$depmode" || test -z "$source" || test -z "$object"; then
- echo "depcomp: Variables source, object and depmode must be set" 1>&2
- exit 1
-fi
-
-# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
-depfile=${depfile-`echo "$object" |
- sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
-tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
-
-rm -f "$tmpdepfile"
-
-# Some modes work just like other modes, but use different flags. We
-# parameterize here, but still list the modes in the big case below,
-# to make depend.m4 easier to write. Note that we *cannot* use a case
-# here, because this file can only contain one case statement.
-if test "$depmode" = hp; then
- # HP compiler uses -M and no extra arg.
- gccflag=-M
- depmode=gcc
-fi
-
-if test "$depmode" = dashXmstdout; then
- # This is just like dashmstdout with a different argument.
- dashmflag=-xM
- depmode=dashmstdout
-fi
-
-case "$depmode" in
-gcc3)
-## gcc 3 implements dependency tracking that does exactly what
-## we want. Yay! Note: for some reason libtool 1.4 doesn't like
-## it if -MD -MP comes after the -MF stuff. Hmm.
-## Unfortunately, FreeBSD c89 acceptance of flags depends upon
-## the command line argument order; so add the flags where they
-## appear in depend2.am. Note that the slowdown incurred here
-## affects only configure: in makefiles, %FASTDEP% shortcuts this.
- for arg
- do
- case $arg in
- -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
- *) set fnord "$@" "$arg" ;;
- esac
- shift # fnord
- shift # $arg
- done
- "$@"
- stat=$?
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile"
- exit $stat
- fi
- mv "$tmpdepfile" "$depfile"
- ;;
-
-gcc)
-## There are various ways to get dependency output from gcc. Here's
-## why we pick this rather obscure method:
-## - Don't want to use -MD because we'd like the dependencies to end
-## up in a subdir. Having to rename by hand is ugly.
-## (We might end up doing this anyway to support other compilers.)
-## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-## -MM, not -M (despite what the docs say).
-## - Using -M directly means running the compiler twice (even worse
-## than renaming).
- if test -z "$gccflag"; then
- gccflag=-MD,
- fi
- "$@" -Wp,"$gccflag$tmpdepfile"
- stat=$?
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile"
- exit $stat
- fi
- rm -f "$depfile"
- echo "$object : \\" > "$depfile"
- alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-## The second -e expression handles DOS-style file names with drive letters.
- sed -e 's/^[^:]*: / /' \
- -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
-## The problem is that when a header file which appears in a .P file
-## is deleted, the dependency causes make to die (because there is
-## typically no way to rebuild the header). We avoid this by adding
-## dummy dependencies for each header file. Too bad gcc doesn't do
-## this for us directly.
- tr ' ' '
-' < "$tmpdepfile" |
-## Some versions of gcc put a space before the `:'. On the theory
-## that the space means something, we add a space to the output as
-## well.
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly. Breaking it into two sed invocations is a workaround.
- sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
- rm -f "$tmpdepfile"
- ;;
-
-hp)
- # This case exists only to let depend.m4 do its work. It works by
- # looking at the text of this script. This case will never be run,
- # since it is checked for above.
- exit 1
- ;;
-
-sgi)
- if test "$libtool" = yes; then
- "$@" "-Wp,-MDupdate,$tmpdepfile"
- else
- "$@" -MDupdate "$tmpdepfile"
- fi
- stat=$?
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile"
- exit $stat
- fi
- rm -f "$depfile"
-
- if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
- echo "$object : \\" > "$depfile"
-
- # Clip off the initial element (the dependent). Don't try to be
- # clever and replace this with sed code, as IRIX sed won't handle
- # lines with more than a fixed number of characters (4096 in
- # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
- # the IRIX cc adds comments like `#:fec' to the end of the
- # dependency line.
- tr ' ' '
-' < "$tmpdepfile" \
- | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
- tr '
-' ' ' >> $depfile
- echo >> $depfile
-
- # The second pass generates a dummy entry for each header file.
- tr ' ' '
-' < "$tmpdepfile" \
- | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
- >> $depfile
- else
- # The sourcefile does not contain any dependencies, so just
- # store a dummy comment line, to avoid errors with the Makefile
- # "include basename.Plo" scheme.
- echo "#dummy" > "$depfile"
- fi
- rm -f "$tmpdepfile"
- ;;
-
-aix)
- # The C for AIX Compiler uses -M and outputs the dependencies
- # in a .u file. In older versions, this file always lives in the
- # current directory. Also, the AIX compiler puts `$object:' at the
- # start of each line; $object doesn't have directory information.
- # Version 6 uses the directory in both cases.
- dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
- test "x$dir" = "x$object" && dir=
- base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
- if test "$libtool" = yes; then
- tmpdepfile1=$dir$base.u
- tmpdepfile2=$base.u
- tmpdepfile3=$dir.libs/$base.u
- "$@" -Wc,-M
- else
- tmpdepfile1=$dir$base.u
- tmpdepfile2=$dir$base.u
- tmpdepfile3=$dir$base.u
- "$@" -M
- fi
- stat=$?
-
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
- exit $stat
- fi
-
- for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
- do
- test -f "$tmpdepfile" && break
- done
- if test -f "$tmpdepfile"; then
- # Each line is of the form `foo.o: dependent.h'.
- # Do two passes, one to just change these to
- # `$object: dependent.h' and one to simply `dependent.h:'.
- sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
- # That's a tab and a space in the [].
- sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
- else
- # The sourcefile does not contain any dependencies, so just
- # store a dummy comment line, to avoid errors with the Makefile
- # "include basename.Plo" scheme.
- echo "#dummy" > "$depfile"
- fi
- rm -f "$tmpdepfile"
- ;;
-
-icc)
- # Intel's C compiler understands `-MD -MF file'. However on
- # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
- # ICC 7.0 will fill foo.d with something like
- # foo.o: sub/foo.c
- # foo.o: sub/foo.h
- # which is wrong. We want:
- # sub/foo.o: sub/foo.c
- # sub/foo.o: sub/foo.h
- # sub/foo.c:
- # sub/foo.h:
- # ICC 7.1 will output
- # foo.o: sub/foo.c sub/foo.h
- # and will wrap long lines using \ :
- # foo.o: sub/foo.c ... \
- # sub/foo.h ... \
- # ...
-
- "$@" -MD -MF "$tmpdepfile"
- stat=$?
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile"
- exit $stat
- fi
- rm -f "$depfile"
- # Each line is of the form `foo.o: dependent.h',
- # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
- # Do two passes, one to just change these to
- # `$object: dependent.h' and one to simply `dependent.h:'.
- sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
- # Some versions of the HPUX 10.20 sed can't process this invocation
- # correctly. Breaking it into two sed invocations is a workaround.
- sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
- sed -e 's/$/ :/' >> "$depfile"
- rm -f "$tmpdepfile"
- ;;
-
-hp2)
- # The "hp" stanza above does not work with aCC (C++) and HP's ia64
- # compilers, which have integrated preprocessors. The correct option
- # to use with these is +Maked; it writes dependencies to a file named
- # 'foo.d', which lands next to the object file, wherever that
- # happens to be.
- # Much of this is similar to the tru64 case; see comments there.
- dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
- test "x$dir" = "x$object" && dir=
- base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
- if test "$libtool" = yes; then
- tmpdepfile1=$dir$base.d
- tmpdepfile2=$dir.libs/$base.d
- "$@" -Wc,+Maked
- else
- tmpdepfile1=$dir$base.d
- tmpdepfile2=$dir$base.d
- "$@" +Maked
- fi
- stat=$?
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile1" "$tmpdepfile2"
- exit $stat
- fi
-
- for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
- do
- test -f "$tmpdepfile" && break
- done
- if test -f "$tmpdepfile"; then
- sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
- # Add `dependent.h:' lines.
- sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
- else
- echo "#dummy" > "$depfile"
- fi
- rm -f "$tmpdepfile" "$tmpdepfile2"
- ;;
-
-tru64)
- # The Tru64 compiler uses -MD to generate dependencies as a side
- # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
- # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
- # dependencies in `foo.d' instead, so we check for that too.
- # Subdirectories are respected.
- dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
- test "x$dir" = "x$object" && dir=
- base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-
- if test "$libtool" = yes; then
- # With Tru64 cc, shared objects can also be used to make a
- # static library. This mechanism is used in libtool 1.4 series to
- # handle both shared and static libraries in a single compilation.
- # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
- #
- # With libtool 1.5 this exception was removed, and libtool now
- # generates 2 separate objects for the 2 libraries. These two
- # compilations output dependencies in $dir.libs/$base.o.d and
- # in $dir$base.o.d. We have to check for both files, because
- # one of the two compilations can be disabled. We should prefer
- # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
- # automatically cleaned when .libs/ is deleted, while ignoring
- # the former would cause a distcleancheck panic.
- tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
- tmpdepfile2=$dir$base.o.d # libtool 1.5
- tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
- tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
- "$@" -Wc,-MD
- else
- tmpdepfile1=$dir$base.o.d
- tmpdepfile2=$dir$base.d
- tmpdepfile3=$dir$base.d
- tmpdepfile4=$dir$base.d
- "$@" -MD
- fi
-
- stat=$?
- if test $stat -eq 0; then :
- else
- rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
- exit $stat
- fi
-
- for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
- do
- test -f "$tmpdepfile" && break
- done
- if test -f "$tmpdepfile"; then
- sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
- # That's a tab and a space in the [].
- sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
- else
- echo "#dummy" > "$depfile"
- fi
- rm -f "$tmpdepfile"
- ;;
-
-#nosideeffect)
- # This comment above is used by automake to tell side-effect
- # dependency tracking mechanisms from slower ones.
-
-dashmstdout)
- # Important note: in order to support this mode, a compiler *must*
- # always write the preprocessed file to stdout, regardless of -o.
- "$@" || exit $?
-
- # Remove the call to Libtool.
- if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
- shift
- done
- shift
- fi
-
- # Remove `-o $object'.
- IFS=" "
- for arg
- do
- case $arg in
- -o)
- shift
- ;;
- $object)
- shift
- ;;
- *)
- set fnord "$@" "$arg"
- shift # fnord
- shift # $arg
- ;;
- esac
- done
-
- test -z "$dashmflag" && dashmflag=-M
- # Require at least two characters before searching for `:'
- # in the target name. This is to cope with DOS-style filenames:
- # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
- "$@" $dashmflag |
- sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
- rm -f "$depfile"
- cat < "$tmpdepfile" > "$depfile"
- tr ' ' '
-' < "$tmpdepfile" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly. Breaking it into two sed invocations is a workaround.
- sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
- rm -f "$tmpdepfile"
- ;;
-
-dashXmstdout)
- # This case only exists to satisfy depend.m4. It is never actually
- # run, as this mode is specially recognized in the preamble.
- exit 1
- ;;
-
-makedepend)
- "$@" || exit $?
- # Remove any Libtool call
- if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
- shift
- done
- shift
- fi
- # X makedepend
- shift
- cleared=no
- for arg in "$@"; do
- case $cleared in
- no)
- set ""; shift
- cleared=yes ;;
- esac
- case "$arg" in
- -D*|-I*)
- set fnord "$@" "$arg"; shift ;;
- # Strip any option that makedepend may not understand. Remove
- # the object too, otherwise makedepend will parse it as a source file.
- -*|$object)
- ;;
- *)
- set fnord "$@" "$arg"; shift ;;
- esac
- done
- obj_suffix="`echo $object | sed 's/^.*\././'`"
- touch "$tmpdepfile"
- ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
- rm -f "$depfile"
- cat < "$tmpdepfile" > "$depfile"
- sed '1,2d' "$tmpdepfile" | tr ' ' '
-' | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly. Breaking it into two sed invocations is a workaround.
- sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
- rm -f "$tmpdepfile" "$tmpdepfile".bak
- ;;
-
-cpp)
- # Important note: in order to support this mode, a compiler *must*
- # always write the preprocessed file to stdout.
- "$@" || exit $?
-
- # Remove the call to Libtool.
- if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
- shift
- done
- shift
- fi
-
- # Remove `-o $object'.
- IFS=" "
- for arg
- do
- case $arg in
- -o)
- shift
- ;;
- $object)
- shift
- ;;
- *)
- set fnord "$@" "$arg"
- shift # fnord
- shift # $arg
- ;;
- esac
- done
-
- "$@" -E |
- sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
- -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
- sed '$ s: \\$::' > "$tmpdepfile"
- rm -f "$depfile"
- echo "$object : \\" > "$depfile"
- cat < "$tmpdepfile" >> "$depfile"
- sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
- rm -f "$tmpdepfile"
- ;;
-
-msvisualcpp)
- # Important note: in order to support this mode, a compiler *must*
- # always write the preprocessed file to stdout, regardless of -o,
- # because we must use -o when running libtool.
- "$@" || exit $?
- IFS=" "
- for arg
- do
- case "$arg" in
- "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
- set fnord "$@"
- shift
- shift
- ;;
- *)
- set fnord "$@" "$arg"
- shift
- shift
- ;;
- esac
- done
- "$@" -E |
- sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
- rm -f "$depfile"
- echo "$object : \\" > "$depfile"
- . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
- echo " " >> "$depfile"
- . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
- rm -f "$tmpdepfile"
- ;;
-
-none)
- exec "$@"
- ;;
-
-*)
- echo "Unknown depmode $depmode" 1>&2
- exit 1
- ;;
-esac
-
-exit 0
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
+++ /dev/null
-#!/bin/sh
-# install - install a program, script, or datafile
-
-scriptversion=2005-05-14.22
-
-# This originates from X11R5 (mit/util/scripts/install.sh), which was
-# later released in X11R6 (xc/config/util/install.sh) with the
-# following copyright and license.
-#
-# Copyright (C) 1994 X Consortium
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
-# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Except as contained in this notice, the name of the X Consortium shall not
-# be used in advertising or otherwise to promote the sale, use or other deal-
-# ings in this Software without prior written authorization from the X Consor-
-# tium.
-#
-#
-# FSF changes to this file are in the public domain.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-chmodcmd="$chmodprog 0755"
-chowncmd=
-chgrpcmd=
-stripcmd=
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=
-dst=
-dir_arg=
-dstarg=
-no_target_directory=
-
-usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
- or: $0 [OPTION]... SRCFILES... DIRECTORY
- or: $0 [OPTION]... -t DIRECTORY SRCFILES...
- or: $0 [OPTION]... -d DIRECTORIES...
-
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
-
-Options:
--c (ignored)
--d create directories instead of installing files.
--g GROUP $chgrpprog installed files to GROUP.
--m MODE $chmodprog installed files to MODE.
--o USER $chownprog installed files to USER.
--s $stripprog installed files.
--t DIRECTORY install into DIRECTORY.
--T report an error if DSTFILE is a directory.
---help display this help and exit.
---version display version info and exit.
-
-Environment variables override the default commands:
- CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
-"
-
-while test -n "$1"; do
- case $1 in
- -c) shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- --help) echo "$usage"; exit $?;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd=$stripprog
- shift
- continue;;
-
- -t) dstarg=$2
- shift
- shift
- continue;;
-
- -T) no_target_directory=true
- shift
- continue;;
-
- --version) echo "$0 $scriptversion"; exit $?;;
-
- *) # When -d is used, all remaining arguments are directories to create.
- # When -t is used, the destination is already specified.
- test -n "$dir_arg$dstarg" && break
- # Otherwise, the last argument is the destination. Remove it from $@.
- for arg
- do
- if test -n "$dstarg"; then
- # $@ is not empty: it contains at least $arg.
- set fnord "$@" "$dstarg"
- shift # fnord
- fi
- shift # arg
- dstarg=$arg
- done
- break;;
- esac
-done
-
-if test -z "$1"; then
- if test -z "$dir_arg"; then
- echo "$0: no input file specified." >&2
- exit 1
- fi
- # It's OK to call `install-sh -d' without argument.
- # This can happen when creating conditional directories.
- exit 0
-fi
-
-for src
-do
- # Protect names starting with `-'.
- case $src in
- -*) src=./$src ;;
- esac
-
- if test -n "$dir_arg"; then
- dst=$src
- src=
-
- if test -d "$dst"; then
- mkdircmd=:
- chmodcmd=
- else
- mkdircmd=$mkdirprog
- fi
- else
- # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
- # might cause directories to be created, which would be especially bad
- # if $src (and thus $dsttmp) contains '*'.
- if test ! -f "$src" && test ! -d "$src"; then
- echo "$0: $src does not exist." >&2
- exit 1
- fi
-
- if test -z "$dstarg"; then
- echo "$0: no destination specified." >&2
- exit 1
- fi
-
- dst=$dstarg
- # Protect names starting with `-'.
- case $dst in
- -*) dst=./$dst ;;
- esac
-
- # If destination is a directory, append the input filename; won't work
- # if double slashes aren't ignored.
- if test -d "$dst"; then
- if test -n "$no_target_directory"; then
- echo "$0: $dstarg: Is a directory" >&2
- exit 1
- fi
- dst=$dst/`basename "$src"`
- fi
- fi
-
- # This sed command emulates the dirname command.
- dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
-
- # Make sure that the destination directory exists.
-
- # Skip lots of stat calls in the usual case.
- if test ! -d "$dstdir"; then
- defaultIFS='
- '
- IFS="${IFS-$defaultIFS}"
-
- oIFS=$IFS
- # Some sh's can't handle IFS=/ for some reason.
- IFS='%'
- set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
- shift
- IFS=$oIFS
-
- pathcomp=
-
- while test $# -ne 0 ; do
- pathcomp=$pathcomp$1
- shift
- if test ! -d "$pathcomp"; then
- $mkdirprog "$pathcomp"
- # mkdir can fail with a `File exist' error in case several
- # install-sh are creating the directory concurrently. This
- # is OK.
- test -d "$pathcomp" || exit
- fi
- pathcomp=$pathcomp/
- done
- fi
-
- if test -n "$dir_arg"; then
- $doit $mkdircmd "$dst" \
- && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
- && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
- && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
- && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
-
- else
- dstfile=`basename "$dst"`
-
- # Make a couple of temp file names in the proper directory.
- dsttmp=$dstdir/_inst.$$_
- rmtmp=$dstdir/_rm.$$_
-
- # Trap to clean up those temp files at exit.
- trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
- trap '(exit $?); exit' 1 2 13 15
-
- # Copy the file name to the temp name.
- $doit $cpprog "$src" "$dsttmp" &&
-
- # and set any options; do chmod last to preserve setuid bits.
- #
- # If any of these fail, we abort the whole thing. If we want to
- # ignore errors from any of these, just make sure not to ignore
- # errors from the above "$doit $cpprog $src $dsttmp" command.
- #
- { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
- && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
- && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
- && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
-
- # Now rename the file to the real destination.
- { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
- || {
- # The rename failed, perhaps because mv can't rename something else
- # to itself, or perhaps because mv is so ancient that it does not
- # support -f.
-
- # Now remove or move aside any old file at destination location.
- # We try this two ways since rm can't unlink itself on some
- # systems and the destination file might be busy for other
- # reasons. In this case, the final cleanup might fail but the new
- # file should still install successfully.
- {
- if test -f "$dstdir/$dstfile"; then
- $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
- || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
- || {
- echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
- (exit 1); exit 1
- }
- else
- :
- fi
- } &&
-
- # Now rename the file to the real destination.
- $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
- }
- }
- fi || { (exit 1); exit 1; }
-done
-
-# The final little trick to "correctly" pass the exit status to the exit trap.
-{
- (exit 0); exit 0
-}
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
+++ /dev/null
-# ltmain.sh - Provide generalized library-building support services.
-# NOTE: Changing this file will not affect anything until you rerun configure.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-# 2007, 2008 Free Software Foundation, Inc.
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-basename="s,^.*/,,g"
-
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
-
-# The name of this program:
-progname=`echo "$progpath" | $SED $basename`
-modename="$progname"
-
-# Global variables:
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION=1.5.26
-TIMESTAMP=" (1.1220.2.492 2008/01/30 06:40:56)"
-
-# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Check that we have a working $echo.
-if test "X$1" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
-elif test "X$1" = X--fallback-echo; then
- # Avoid inline document here, it may be left over
- :
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
- # Yippee, $echo works!
- :
-else
- # Restart under the correct shell, and then maybe $echo will work.
- exec $SHELL "$progpath" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
- # used as fallback echo
- shift
- cat <<EOF
-$*
-EOF
- exit $EXIT_SUCCESS
-fi
-
-default_mode=
-help="Try \`$progname --help' for more information."
-magic="%%%MAGIC variable%%%"
-mkdir="mkdir"
-mv="mv -f"
-rm="rm -f"
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed="${SED}"' -e 1s/^X//'
-sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
-# test EBCDIC or ASCII
-case `echo X|tr X '\101'` in
- A) # ASCII based system
- # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
- SP2NL='tr \040 \012'
- NL2SP='tr \015\012 \040\040'
- ;;
- *) # EBCDIC based system
- SP2NL='tr \100 \n'
- NL2SP='tr \r\n \100\100'
- ;;
-esac
-
-# NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-# We save the old values to restore during execute mode.
-lt_env=
-for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
-do
- eval "if test \"\${$lt_var+set}\" = set; then
- save_$lt_var=\$$lt_var
- lt_env=\"$lt_var=\$$lt_var \$lt_env\"
- $lt_var=C
- export $lt_var
- fi"
-done
-
-if test -n "$lt_env"; then
- lt_env="env $lt_env"
-fi
-
-# Make sure IFS has a sensible default
-lt_nl='
-'
-IFS=" $lt_nl"
-
-if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
- $echo "$modename: not configured to build any kind of library" 1>&2
- $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit $EXIT_FAILURE
-fi
-
-# Global variables.
-mode=$default_mode
-nonopt=
-prev=
-prevopt=
-run=
-show="$echo"
-show_help=
-execute_dlfiles=
-duplicate_deps=no
-preserve_args=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-extracted_archives=
-extracted_serial=0
-
-#####################################
-# Shell function definitions:
-# This seems to be the best place for them
-
-# func_mktempdir [string]
-# Make a temporary directory that won't clash with other running
-# libtool processes, and avoids race conditions if possible. If
-# given, STRING is the basename for that directory.
-func_mktempdir ()
-{
- my_template="${TMPDIR-/tmp}/${1-$progname}"
-
- if test "$run" = ":"; then
- # Return a directory name, but don't create it in dry-run mode
- my_tmpdir="${my_template}-$$"
- else
-
- # If mktemp works, use that first and foremost
- my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
-
- if test ! -d "$my_tmpdir"; then
- # Failing that, at least try and use $RANDOM to avoid a race
- my_tmpdir="${my_template}-${RANDOM-0}$$"
-
- save_mktempdir_umask=`umask`
- umask 0077
- $mkdir "$my_tmpdir"
- umask $save_mktempdir_umask
- fi
-
- # If we're not in dry-run mode, bomb out on failure
- test -d "$my_tmpdir" || {
- $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
- exit $EXIT_FAILURE
- }
- fi
-
- $echo "X$my_tmpdir" | $Xsed
-}
-
-
-# func_win32_libid arg
-# return the library type of file 'arg'
-#
-# Need a lot of goo to handle *both* DLLs and import libs
-# Has to be a shell function in order to 'eat' the argument
-# that is supplied when $file_magic_command is called.
-func_win32_libid ()
-{
- win32_libid_type="unknown"
- win32_fileres=`file -L $1 2>/dev/null`
- case $win32_fileres in
- *ar\ archive\ import\ library*) # definitely import
- win32_libid_type="x86 archive import"
- ;;
- *ar\ archive*) # could be an import, or static
- if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
- $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
- win32_nmres=`eval $NM -f posix -A $1 | \
- $SED -n -e '1,100{
- / I /{
- s,.*,import,
- p
- q
- }
- }'`
- case $win32_nmres in
- import*) win32_libid_type="x86 archive import";;
- *) win32_libid_type="x86 archive static";;
- esac
- fi
- ;;
- *DLL*)
- win32_libid_type="x86 DLL"
- ;;
- *executable*) # but shell scripts are "executable" too...
- case $win32_fileres in
- *MS\ Windows\ PE\ Intel*)
- win32_libid_type="x86 DLL"
- ;;
- esac
- ;;
- esac
- $echo $win32_libid_type
-}
-
-
-# func_infer_tag arg
-# Infer tagged configuration to use if any are available and
-# if one wasn't chosen via the "--tag" command line option.
-# Only attempt this if the compiler in the base compile
-# command doesn't match the default compiler.
-# arg is usually of the form 'gcc ...'
-func_infer_tag ()
-{
- if test -n "$available_tags" && test -z "$tagname"; then
- CC_quoted=
- for arg in $CC; do
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- CC_quoted="$CC_quoted $arg"
- done
- case $@ in
- # Blanks in the command may have been stripped by the calling shell,
- # but not from the CC environment variable when configure was run.
- " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
- # Blanks at the start of $base_compile will cause this to fail
- # if we don't check for them as well.
- *)
- for z in $available_tags; do
- if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
- # Evaluate the configuration.
- eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
- CC_quoted=
- for arg in $CC; do
- # Double-quote args containing other shell metacharacters.
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- CC_quoted="$CC_quoted $arg"
- done
- case "$@ " in
- " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
- # The compiler in the base compile command matches
- # the one in the tagged configuration.
- # Assume this is the tagged configuration we want.
- tagname=$z
- break
- ;;
- esac
- fi
- done
- # If $tagname still isn't set, then no tagged configuration
- # was found and let the user know that the "--tag" command
- # line option must be used.
- if test -z "$tagname"; then
- $echo "$modename: unable to infer tagged configuration"
- $echo "$modename: specify a tag with \`--tag'" 1>&2
- exit $EXIT_FAILURE
-# else
-# $echo "$modename: using $tagname tagged configuration"
- fi
- ;;
- esac
- fi
-}
-
-
-# func_extract_an_archive dir oldlib
-func_extract_an_archive ()
-{
- f_ex_an_ar_dir="$1"; shift
- f_ex_an_ar_oldlib="$1"
-
- $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
- $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
- if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
- exit $EXIT_FAILURE
- fi
-}
-
-# func_extract_archives gentop oldlib ...
-func_extract_archives ()
-{
- my_gentop="$1"; shift
- my_oldlibs=${1+"$@"}
- my_oldobjs=""
- my_xlib=""
- my_xabs=""
- my_xdir=""
- my_status=""
-
- $show "${rm}r $my_gentop"
- $run ${rm}r "$my_gentop"
- $show "$mkdir $my_gentop"
- $run $mkdir "$my_gentop"
- my_status=$?
- if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
- exit $my_status
- fi
-
- for my_xlib in $my_oldlibs; do
- # Extract the objects.
- case $my_xlib in
- [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
- *) my_xabs=`pwd`"/$my_xlib" ;;
- esac
- my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
- my_xlib_u=$my_xlib
- while :; do
- case " $extracted_archives " in
- *" $my_xlib_u "*)
- extracted_serial=`expr $extracted_serial + 1`
- my_xlib_u=lt$extracted_serial-$my_xlib ;;
- *) break ;;
- esac
- done
- extracted_archives="$extracted_archives $my_xlib_u"
- my_xdir="$my_gentop/$my_xlib_u"
-
- $show "${rm}r $my_xdir"
- $run ${rm}r "$my_xdir"
- $show "$mkdir $my_xdir"
- $run $mkdir "$my_xdir"
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
- exit $exit_status
- fi
- case $host in
- *-darwin*)
- $show "Extracting $my_xabs"
- # Do not bother doing anything if just a dry run
- if test -z "$run"; then
- darwin_orig_dir=`pwd`
- cd $my_xdir || exit $?
- darwin_archive=$my_xabs
- darwin_curdir=`pwd`
- darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
- darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
- if test -n "$darwin_arches"; then
- darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
- darwin_arch=
- $show "$darwin_base_archive has multiple architectures $darwin_arches"
- for darwin_arch in $darwin_arches ; do
- mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
- lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
- cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
- func_extract_an_archive "`pwd`" "${darwin_base_archive}"
- cd "$darwin_curdir"
- $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
- done # $darwin_arches
- ## Okay now we have a bunch of thin objects, gotta fatten them up :)
- darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
- darwin_file=
- darwin_files=
- for darwin_file in $darwin_filelist; do
- darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
- lipo -create -output "$darwin_file" $darwin_files
- done # $darwin_filelist
- ${rm}r unfat-$$
- cd "$darwin_orig_dir"
- else
- cd "$darwin_orig_dir"
- func_extract_an_archive "$my_xdir" "$my_xabs"
- fi # $darwin_arches
- fi # $run
- ;;
- *)
- func_extract_an_archive "$my_xdir" "$my_xabs"
- ;;
- esac
- my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
- done
- func_extract_archives_result="$my_oldobjs"
-}
-# End of Shell function definitions
-#####################################
-
-# Darwin sucks
-eval std_shrext=\"$shrext_cmds\"
-
-disable_libs=no
-
-# Parse our command line options once, thoroughly.
-while test "$#" -gt 0
-do
- arg="$1"
- shift
-
- case $arg in
- -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case $prev in
- execute_dlfiles)
- execute_dlfiles="$execute_dlfiles $arg"
- ;;
- tag)
- tagname="$arg"
- preserve_args="${preserve_args}=$arg"
-
- # Check whether tagname contains only valid characters
- case $tagname in
- *[!-_A-Za-z0-9,/]*)
- $echo "$progname: invalid tag name: $tagname" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- case $tagname in
- CC)
- # Don't test for the "default" C tag, as we know, it's there, but
- # not specially marked.
- ;;
- *)
- if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
- taglist="$taglist $tagname"
- # Evaluate the configuration.
- eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
- else
- $echo "$progname: ignoring unknown tag $tagname" 1>&2
- fi
- ;;
- esac
- ;;
- *)
- eval "$prev=\$arg"
- ;;
- esac
-
- prev=
- prevopt=
- continue
- fi
-
- # Have we seen a non-optional argument yet?
- case $arg in
- --help)
- show_help=yes
- ;;
-
- --version)
- echo "\
-$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
-
-Copyright (C) 2008 Free Software Foundation, Inc.
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
- exit $?
- ;;
-
- --config)
- ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
- # Now print the configurations for the tags.
- for tagname in $taglist; do
- ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
- done
- exit $?
- ;;
-
- --debug)
- $echo "$progname: enabling shell trace mode"
- set -x
- preserve_args="$preserve_args $arg"
- ;;
-
- --dry-run | -n)
- run=:
- ;;
-
- --features)
- $echo "host: $host"
- if test "$build_libtool_libs" = yes; then
- $echo "enable shared libraries"
- else
- $echo "disable shared libraries"
- fi
- if test "$build_old_libs" = yes; then
- $echo "enable static libraries"
- else
- $echo "disable static libraries"
- fi
- exit $?
- ;;
-
- --finish) mode="finish" ;;
-
- --mode) prevopt="--mode" prev=mode ;;
- --mode=*) mode="$optarg" ;;
-
- --preserve-dup-deps) duplicate_deps="yes" ;;
-
- --quiet | --silent)
- show=:
- preserve_args="$preserve_args $arg"
- ;;
-
- --tag)
- prevopt="--tag"
- prev=tag
- preserve_args="$preserve_args --tag"
- ;;
- --tag=*)
- set tag "$optarg" ${1+"$@"}
- shift
- prev=tag
- preserve_args="$preserve_args --tag"
- ;;
-
- -dlopen)
- prevopt="-dlopen"
- prev=execute_dlfiles
- ;;
-
- -*)
- $echo "$modename: unrecognized option \`$arg'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- ;;
-
- *)
- nonopt="$arg"
- break
- ;;
- esac
-done
-
-if test -n "$prevopt"; then
- $echo "$modename: option \`$prevopt' requires an argument" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
-fi
-
-case $disable_libs in
-no)
- ;;
-shared)
- build_libtool_libs=no
- build_old_libs=yes
- ;;
-static)
- build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
- ;;
-esac
-
-# If this variable is set in any of the actions, the command in it
-# will be execed at the end. This prevents here-documents from being
-# left over by shells.
-exec_cmd=
-
-if test -z "$show_help"; then
-
- # Infer the operation mode.
- if test -z "$mode"; then
- $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
- $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
- case $nonopt in
- *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
- mode=link
- for arg
- do
- case $arg in
- -c)
- mode=compile
- break
- ;;
- esac
- done
- ;;
- *db | *dbx | *strace | *truss)
- mode=execute
- ;;
- *install*|cp|mv)
- mode=install
- ;;
- *rm)
- mode=uninstall
- ;;
- *)
- # If we have no mode, but dlfiles were specified, then do execute mode.
- test -n "$execute_dlfiles" && mode=execute
-
- # Just use the default operation mode.
- if test -z "$mode"; then
- if test -n "$nonopt"; then
- $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
- else
- $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
- fi
- fi
- ;;
- esac
- fi
-
- # Only execute mode is allowed to have -dlopen flags.
- if test -n "$execute_dlfiles" && test "$mode" != execute; then
- $echo "$modename: unrecognized option \`-dlopen'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Change the help message to a mode-specific one.
- generic_help="$help"
- help="Try \`$modename --help --mode=$mode' for more information."
-
- # These modes are in order of execution frequency so that they run quickly.
- case $mode in
- # libtool compile mode
- compile)
- modename="$modename: compile"
- # Get the compilation command and the source file.
- base_compile=
- srcfile="$nonopt" # always keep a non-empty value in "srcfile"
- suppress_opt=yes
- suppress_output=
- arg_mode=normal
- libobj=
- later=
-
- for arg
- do
- case $arg_mode in
- arg )
- # do not "continue". Instead, add this to base_compile
- lastarg="$arg"
- arg_mode=normal
- ;;
-
- target )
- libobj="$arg"
- arg_mode=normal
- continue
- ;;
-
- normal )
- # Accept any command-line options.
- case $arg in
- -o)
- if test -n "$libobj" ; then
- $echo "$modename: you cannot specify \`-o' more than once" 1>&2
- exit $EXIT_FAILURE
- fi
- arg_mode=target
- continue
- ;;
-
- -static | -prefer-pic | -prefer-non-pic)
- later="$later $arg"
- continue
- ;;
-
- -no-suppress)
- suppress_opt=no
- continue
- ;;
-
- -Xcompiler)
- arg_mode=arg # the next one goes into the "base_compile" arg list
- continue # The current "srcfile" will either be retained or
- ;; # replaced later. I would guess that would be a bug.
-
- -Wc,*)
- args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
- lastarg=
- save_ifs="$IFS"; IFS=','
- for arg in $args; do
- IFS="$save_ifs"
-
- # Double-quote args containing other shell metacharacters.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- lastarg="$lastarg $arg"
- done
- IFS="$save_ifs"
- lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
-
- # Add the arguments to base_compile.
- base_compile="$base_compile $lastarg"
- continue
- ;;
-
- * )
- # Accept the current argument as the source file.
- # The previous "srcfile" becomes the current argument.
- #
- lastarg="$srcfile"
- srcfile="$arg"
- ;;
- esac # case $arg
- ;;
- esac # case $arg_mode
-
- # Aesthetically quote the previous argument.
- lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
-
- case $lastarg in
- # Double-quote args containing other shell metacharacters.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, and some SunOS ksh mistreat backslash-escaping
- # in scan sets (worked around with variable expansion),
- # and furthermore cannot handle '|' '&' '(' ')' in scan sets
- # at all, so we specify them separately.
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- lastarg="\"$lastarg\""
- ;;
- esac
-
- base_compile="$base_compile $lastarg"
- done # for arg
-
- case $arg_mode in
- arg)
- $echo "$modename: you must specify an argument for -Xcompile"
- exit $EXIT_FAILURE
- ;;
- target)
- $echo "$modename: you must specify a target with \`-o'" 1>&2
- exit $EXIT_FAILURE
- ;;
- *)
- # Get the name of the library object.
- [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
- ;;
- esac
-
- # Recognize several different file suffixes.
- # If the user specifies -o file.o, it is replaced with file.lo
- xform='[cCFSifmso]'
- case $libobj in
- *.ada) xform=ada ;;
- *.adb) xform=adb ;;
- *.ads) xform=ads ;;
- *.asm) xform=asm ;;
- *.c++) xform=c++ ;;
- *.cc) xform=cc ;;
- *.ii) xform=ii ;;
- *.class) xform=class ;;
- *.cpp) xform=cpp ;;
- *.cxx) xform=cxx ;;
- *.[fF][09]?) xform=[fF][09]. ;;
- *.for) xform=for ;;
- *.java) xform=java ;;
- *.obj) xform=obj ;;
- *.sx) xform=sx ;;
- esac
-
- libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
-
- case $libobj in
- *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
- *)
- $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- func_infer_tag $base_compile
-
- for arg in $later; do
- case $arg in
- -static)
- build_old_libs=yes
- continue
- ;;
-
- -prefer-pic)
- pic_mode=yes
- continue
- ;;
-
- -prefer-non-pic)
- pic_mode=no
- continue
- ;;
- esac
- done
-
- qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
- case $qlibobj in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- qlibobj="\"$qlibobj\"" ;;
- esac
- test "X$libobj" != "X$qlibobj" \
- && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
- && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
- objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
- xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$obj"; then
- xdir=
- else
- xdir=$xdir/
- fi
- lobj=${xdir}$objdir/$objname
-
- if test -z "$base_compile"; then
- $echo "$modename: you must specify a compilation command" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Delete any leftover library objects.
- if test "$build_old_libs" = yes; then
- removelist="$obj $lobj $libobj ${libobj}T"
- else
- removelist="$lobj $libobj ${libobj}T"
- fi
-
- $run $rm $removelist
- trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
-
- # On Cygwin there's no "real" PIC flag so we must build both object types
- case $host_os in
- cygwin* | mingw* | pw32* | os2*)
- pic_mode=default
- ;;
- esac
- if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
- # non-PIC code in shared libraries is not supported
- pic_mode=default
- fi
-
- # Calculate the filename of the output object if compiler does
- # not support -o with -c
- if test "$compiler_c_o" = no; then
- output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
- lockfile="$output_obj.lock"
- removelist="$removelist $output_obj $lockfile"
- trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
- else
- output_obj=
- need_locks=no
- lockfile=
- fi
-
- # Lock this critical section if it is needed
- # We use this script file to make the link, it avoids creating a new file
- if test "$need_locks" = yes; then
- until $run ln "$progpath" "$lockfile" 2>/dev/null; do
- $show "Waiting for $lockfile to be removed"
- sleep 2
- done
- elif test "$need_locks" = warn; then
- if test -f "$lockfile"; then
- $echo "\
-*** ERROR, $lockfile exists and contains:
-`cat $lockfile 2>/dev/null`
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit $EXIT_FAILURE
- fi
- $echo "$srcfile" > "$lockfile"
- fi
-
- if test -n "$fix_srcfile_path"; then
- eval srcfile=\"$fix_srcfile_path\"
- fi
- qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
- case $qsrcfile in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- qsrcfile="\"$qsrcfile\"" ;;
- esac
-
- $run $rm "$libobj" "${libobj}T"
-
- # Create a libtool object file (analogous to a ".la" file),
- # but don't create it if we're doing a dry run.
- test -z "$run" && cat > ${libobj}T <<EOF
-# $libobj - a libtool object file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-EOF
-
- # Only build a PIC object if we are building libtool libraries.
- if test "$build_libtool_libs" = yes; then
- # Without this assignment, base_compile gets emptied.
- fbsd_hideous_sh_bug=$base_compile
-
- if test "$pic_mode" != no; then
- command="$base_compile $qsrcfile $pic_flag"
- else
- # Don't build PIC code
- command="$base_compile $qsrcfile"
- fi
-
- if test ! -d "${xdir}$objdir"; then
- $show "$mkdir ${xdir}$objdir"
- $run $mkdir ${xdir}$objdir
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
- exit $exit_status
- fi
- fi
-
- if test -z "$output_obj"; then
- # Place PIC objects in $objdir
- command="$command -o $lobj"
- fi
-
- $run $rm "$lobj" "$output_obj"
-
- $show "$command"
- if $run eval $lt_env "$command"; then :
- else
- test -n "$output_obj" && $run $rm $removelist
- exit $EXIT_FAILURE
- fi
-
- if test "$need_locks" = warn &&
- test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
- $echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit $EXIT_FAILURE
- fi
-
- # Just move the object if needed, then go on to compile the next one
- if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
- $show "$mv $output_obj $lobj"
- if $run $mv $output_obj $lobj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
-
- # Append the name of the PIC object to the libtool object file.
- test -z "$run" && cat >> ${libobj}T <<EOF
-pic_object='$objdir/$objname'
-
-EOF
-
- # Allow error messages only from the first compilation.
- if test "$suppress_opt" = yes; then
- suppress_output=' >/dev/null 2>&1'
- fi
- else
- # No PIC object so indicate it doesn't exist in the libtool
- # object file.
- test -z "$run" && cat >> ${libobj}T <<EOF
-pic_object=none
-
-EOF
- fi
-
- # Only build a position-dependent object if we build old libraries.
- if test "$build_old_libs" = yes; then
- if test "$pic_mode" != yes; then
- # Don't build PIC code
- command="$base_compile $qsrcfile"
- else
- command="$base_compile $qsrcfile $pic_flag"
- fi
- if test "$compiler_c_o" = yes; then
- command="$command -o $obj"
- fi
-
- # Suppress compiler output if we already did a PIC compilation.
- command="$command$suppress_output"
- $run $rm "$obj" "$output_obj"
- $show "$command"
- if $run eval $lt_env "$command"; then :
- else
- $run $rm $removelist
- exit $EXIT_FAILURE
- fi
-
- if test "$need_locks" = warn &&
- test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
- $echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together. If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
- $run $rm $removelist
- exit $EXIT_FAILURE
- fi
-
- # Just move the object if needed
- if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
- $show "$mv $output_obj $obj"
- if $run $mv $output_obj $obj; then :
- else
- error=$?
- $run $rm $removelist
- exit $error
- fi
- fi
-
- # Append the name of the non-PIC object the libtool object file.
- # Only append if the libtool object file exists.
- test -z "$run" && cat >> ${libobj}T <<EOF
-# Name of the non-PIC object.
-non_pic_object='$objname'
-
-EOF
- else
- # Append the name of the non-PIC object the libtool object file.
- # Only append if the libtool object file exists.
- test -z "$run" && cat >> ${libobj}T <<EOF
-# Name of the non-PIC object.
-non_pic_object=none
-
-EOF
- fi
-
- $run $mv "${libobj}T" "${libobj}"
-
- # Unlock the critical section if it was locked
- if test "$need_locks" != no; then
- $run $rm "$lockfile"
- fi
-
- exit $EXIT_SUCCESS
- ;;
-
- # libtool link mode
- link | relink)
- modename="$modename: link"
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- # It is impossible to link a dll without this setting, and
- # we shouldn't force the makefile maintainer to figure out
- # which system we are compiling for in order to pass an extra
- # flag for every libtool invocation.
- # allow_undefined=no
-
- # FIXME: Unfortunately, there are problems with the above when trying
- # to make a dll which has undefined symbols, in which case not
- # even a static library is built. For now, we need to specify
- # -no-undefined on the libtool link line when we can be certain
- # that all symbols are satisfied, otherwise we get a static library.
- allow_undefined=yes
- ;;
- *)
- allow_undefined=yes
- ;;
- esac
- libtool_args="$nonopt"
- base_compile="$nonopt $@"
- compile_command="$nonopt"
- finalize_command="$nonopt"
-
- compile_rpath=
- finalize_rpath=
- compile_shlibpath=
- finalize_shlibpath=
- convenience=
- old_convenience=
- deplibs=
- old_deplibs=
- compiler_flags=
- linker_flags=
- dllsearchpath=
- lib_search_path=`pwd`
- inst_prefix_dir=
-
- avoid_version=no
- dlfiles=
- dlprefiles=
- dlself=no
- export_dynamic=no
- export_symbols=
- export_symbols_regex=
- generated=
- libobjs=
- ltlibs=
- module=no
- no_install=no
- objs=
- non_pic_objects=
- notinst_path= # paths that contain not-installed libtool libraries
- precious_files_regex=
- prefer_static_libs=no
- preload=no
- prev=
- prevarg=
- release=
- rpath=
- xrpath=
- perm_rpath=
- temp_rpath=
- thread_safe=no
- vinfo=
- vinfo_number=no
- single_module="${wl}-single_module"
-
- func_infer_tag $base_compile
-
- # We need to know -static, to get the right output filenames.
- for arg
- do
- case $arg in
- -all-static | -static | -static-libtool-libs)
- case $arg in
- -all-static)
- if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
- $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
- fi
- if test -n "$link_static_flag"; then
- dlopen_self=$dlopen_self_static
- fi
- prefer_static_libs=yes
- ;;
- -static)
- if test -z "$pic_flag" && test -n "$link_static_flag"; then
- dlopen_self=$dlopen_self_static
- fi
- prefer_static_libs=built
- ;;
- -static-libtool-libs)
- if test -z "$pic_flag" && test -n "$link_static_flag"; then
- dlopen_self=$dlopen_self_static
- fi
- prefer_static_libs=yes
- ;;
- esac
- build_libtool_libs=no
- build_old_libs=yes
- break
- ;;
- esac
- done
-
- # See if our shared archives depend on static archives.
- test -n "$old_archive_from_new_cmds" && build_old_libs=yes
-
- # Go through the arguments, transforming them on the way.
- while test "$#" -gt 0; do
- arg="$1"
- shift
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
- ;;
- *) qarg=$arg ;;
- esac
- libtool_args="$libtool_args $qarg"
-
- # If the previous option needs an argument, assign it.
- if test -n "$prev"; then
- case $prev in
- output)
- compile_command="$compile_command @OUTPUT@"
- finalize_command="$finalize_command @OUTPUT@"
- ;;
- esac
-
- case $prev in
- dlfiles|dlprefiles)
- if test "$preload" = no; then
- # Add the symbol object into the linking commands.
- compile_command="$compile_command @SYMFILE@"
- finalize_command="$finalize_command @SYMFILE@"
- preload=yes
- fi
- case $arg in
- *.la | *.lo) ;; # We handle these cases below.
- force)
- if test "$dlself" = no; then
- dlself=needless
- export_dynamic=yes
- fi
- prev=
- continue
- ;;
- self)
- if test "$prev" = dlprefiles; then
- dlself=yes
- elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
- dlself=yes
- else
- dlself=needless
- export_dynamic=yes
- fi
- prev=
- continue
- ;;
- *)
- if test "$prev" = dlfiles; then
- dlfiles="$dlfiles $arg"
- else
- dlprefiles="$dlprefiles $arg"
- fi
- prev=
- continue
- ;;
- esac
- ;;
- expsyms)
- export_symbols="$arg"
- if test ! -f "$arg"; then
- $echo "$modename: symbol file \`$arg' does not exist"
- exit $EXIT_FAILURE
- fi
- prev=
- continue
- ;;
- expsyms_regex)
- export_symbols_regex="$arg"
- prev=
- continue
- ;;
- inst_prefix)
- inst_prefix_dir="$arg"
- prev=
- continue
- ;;
- precious_regex)
- precious_files_regex="$arg"
- prev=
- continue
- ;;
- release)
- release="-$arg"
- prev=
- continue
- ;;
- objectlist)
- if test -f "$arg"; then
- save_arg=$arg
- moreargs=
- for fil in `cat $save_arg`
- do
-# moreargs="$moreargs $fil"
- arg=$fil
- # A libtool-controlled object.
-
- # Check to see that this really is a libtool object.
- if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- pic_object=
- non_pic_object=
-
- # Read the .lo file
- # If there is no directory component, then add one.
- case $arg in
- */* | *\\*) . $arg ;;
- *) . ./$arg ;;
- esac
-
- if test -z "$pic_object" || \
- test -z "$non_pic_object" ||
- test "$pic_object" = none && \
- test "$non_pic_object" = none; then
- $echo "$modename: cannot find name of object for \`$arg'" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Extract subdirectory from the argument.
- xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$arg"; then
- xdir=
- else
- xdir="$xdir/"
- fi
-
- if test "$pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- pic_object="$xdir$pic_object"
-
- if test "$prev" = dlfiles; then
- if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
- dlfiles="$dlfiles $pic_object"
- prev=
- continue
- else
- # If libtool objects are unsupported, then we need to preload.
- prev=dlprefiles
- fi
- fi
-
- # CHECK ME: I think I busted this. -Ossama
- if test "$prev" = dlprefiles; then
- # Preload the old-style object.
- dlprefiles="$dlprefiles $pic_object"
- prev=
- fi
-
- # A PIC object.
- libobjs="$libobjs $pic_object"
- arg="$pic_object"
- fi
-
- # Non-PIC object.
- if test "$non_pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- non_pic_object="$xdir$non_pic_object"
-
- # A standard non-PIC object
- non_pic_objects="$non_pic_objects $non_pic_object"
- if test -z "$pic_object" || test "$pic_object" = none ; then
- arg="$non_pic_object"
- fi
- else
- # If the PIC object exists, use it instead.
- # $xdir was prepended to $pic_object above.
- non_pic_object="$pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
- fi
- else
- # Only an error if not doing a dry-run.
- if test -z "$run"; then
- $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
- exit $EXIT_FAILURE
- else
- # Dry-run case.
-
- # Extract subdirectory from the argument.
- xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$arg"; then
- xdir=
- else
- xdir="$xdir/"
- fi
-
- pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
- non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
- libobjs="$libobjs $pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
- fi
- fi
- done
- else
- $echo "$modename: link input file \`$save_arg' does not exist"
- exit $EXIT_FAILURE
- fi
- arg=$save_arg
- prev=
- continue
- ;;
- rpath | xrpath)
- # We need an absolute path.
- case $arg in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- $echo "$modename: only absolute run-paths are allowed" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- if test "$prev" = rpath; then
- case "$rpath " in
- *" $arg "*) ;;
- *) rpath="$rpath $arg" ;;
- esac
- else
- case "$xrpath " in
- *" $arg "*) ;;
- *) xrpath="$xrpath $arg" ;;
- esac
- fi
- prev=
- continue
- ;;
- xcompiler)
- compiler_flags="$compiler_flags $qarg"
- prev=
- compile_command="$compile_command $qarg"
- finalize_command="$finalize_command $qarg"
- continue
- ;;
- xlinker)
- linker_flags="$linker_flags $qarg"
- compiler_flags="$compiler_flags $wl$qarg"
- prev=
- compile_command="$compile_command $wl$qarg"
- finalize_command="$finalize_command $wl$qarg"
- continue
- ;;
- xcclinker)
- linker_flags="$linker_flags $qarg"
- compiler_flags="$compiler_flags $qarg"
- prev=
- compile_command="$compile_command $qarg"
- finalize_command="$finalize_command $qarg"
- continue
- ;;
- shrext)
- shrext_cmds="$arg"
- prev=
- continue
- ;;
- darwin_framework|darwin_framework_skip)
- test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- prev=
- continue
- ;;
- *)
- eval "$prev=\"\$arg\""
- prev=
- continue
- ;;
- esac
- fi # test -n "$prev"
-
- prevarg="$arg"
-
- case $arg in
- -all-static)
- if test -n "$link_static_flag"; then
- compile_command="$compile_command $link_static_flag"
- finalize_command="$finalize_command $link_static_flag"
- fi
- continue
- ;;
-
- -allow-undefined)
- # FIXME: remove this flag sometime in the future.
- $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
- continue
- ;;
-
- -avoid-version)
- avoid_version=yes
- continue
- ;;
-
- -dlopen)
- prev=dlfiles
- continue
- ;;
-
- -dlpreopen)
- prev=dlprefiles
- continue
- ;;
-
- -export-dynamic)
- export_dynamic=yes
- continue
- ;;
-
- -export-symbols | -export-symbols-regex)
- if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
- $echo "$modename: more than one -exported-symbols argument is not allowed"
- exit $EXIT_FAILURE
- fi
- if test "X$arg" = "X-export-symbols"; then
- prev=expsyms
- else
- prev=expsyms_regex
- fi
- continue
- ;;
-
- -framework|-arch|-isysroot)
- case " $CC " in
- *" ${arg} ${1} "* | *" ${arg} ${1} "*)
- prev=darwin_framework_skip ;;
- *) compiler_flags="$compiler_flags $arg"
- prev=darwin_framework ;;
- esac
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- continue
- ;;
-
- -inst-prefix-dir)
- prev=inst_prefix
- continue
- ;;
-
- # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
- # so, if we see these flags be careful not to treat them like -L
- -L[A-Z][A-Z]*:*)
- case $with_gcc/$host in
- no/*-*-irix* | /*-*-irix*)
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- ;;
- esac
- continue
- ;;
-
- -L*)
- dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- absdir=`cd "$dir" && pwd`
- if test -z "$absdir"; then
- $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
- absdir="$dir"
- notinst_path="$notinst_path $dir"
- fi
- dir="$absdir"
- ;;
- esac
- case "$deplibs " in
- *" -L$dir "*) ;;
- *)
- deplibs="$deplibs -L$dir"
- lib_search_path="$lib_search_path $dir"
- ;;
- esac
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
- case :$dllsearchpath: in
- *":$dir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$dir";;
- esac
- case :$dllsearchpath: in
- *":$testbindir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$testbindir";;
- esac
- ;;
- esac
- continue
- ;;
-
- -l*)
- if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
- # These systems don't actually have a C or math library (as such)
- continue
- ;;
- *-*-os2*)
- # These systems don't actually have a C library (as such)
- test "X$arg" = "X-lc" && continue
- ;;
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
- # Do not include libc due to us having libc/libc_r.
- test "X$arg" = "X-lc" && continue
- ;;
- *-*-rhapsody* | *-*-darwin1.[012])
- # Rhapsody C and math libraries are in the System framework
- deplibs="$deplibs -framework System"
- continue
- ;;
- *-*-sco3.2v5* | *-*-sco5v6*)
- # Causes problems with __ctype
- test "X$arg" = "X-lc" && continue
- ;;
- *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
- # Compiler inserts libc in the correct place for threads to work
- test "X$arg" = "X-lc" && continue
- ;;
- esac
- elif test "X$arg" = "X-lc_r"; then
- case $host in
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
- # Do not include libc_r directly, use -pthread flag.
- continue
- ;;
- esac
- fi
- deplibs="$deplibs $arg"
- continue
- ;;
-
- # Tru64 UNIX uses -model [arg] to determine the layout of C++
- # classes, name mangling, and exception handling.
- -model)
- compile_command="$compile_command $arg"
- compiler_flags="$compiler_flags $arg"
- finalize_command="$finalize_command $arg"
- prev=xcompiler
- continue
- ;;
-
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
- compiler_flags="$compiler_flags $arg"
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- continue
- ;;
-
- -multi_module)
- single_module="${wl}-multi_module"
- continue
- ;;
-
- -module)
- module=yes
- continue
- ;;
-
- # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
- # -r[0-9][0-9]* specifies the processor on the SGI compiler
- # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
- # +DA*, +DD* enable 64-bit mode on the HP compiler
- # -q* pass through compiler args for the IBM compiler
- # -m* pass through architecture-specific compiler args for GCC
- # -m*, -t[45]*, -txscale* pass through architecture-specific
- # compiler args for GCC
- # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
- # -F/path gives path to uninstalled frameworks, gcc on darwin
- # @file GCC response files
- -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
- -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
-
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- compiler_flags="$compiler_flags $arg"
- continue
- ;;
-
- -shrext)
- prev=shrext
- continue
- ;;
-
- -no-fast-install)
- fast_install=no
- continue
- ;;
-
- -no-install)
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
- # The PATH hackery in wrapper scripts is required on Windows
- # and Darwin in order for the loader to find any dlls it needs.
- $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
- $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
- fast_install=no
- ;;
- *) no_install=yes ;;
- esac
- continue
- ;;
-
- -no-undefined)
- allow_undefined=no
- continue
- ;;
-
- -objectlist)
- prev=objectlist
- continue
- ;;
-
- -o) prev=output ;;
-
- -precious-files-regex)
- prev=precious_regex
- continue
- ;;
-
- -release)
- prev=release
- continue
- ;;
-
- -rpath)
- prev=rpath
- continue
- ;;
-
- -R)
- prev=xrpath
- continue
- ;;
-
- -R*)
- dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- $echo "$modename: only absolute run-paths are allowed" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- case "$xrpath " in
- *" $dir "*) ;;
- *) xrpath="$xrpath $dir" ;;
- esac
- continue
- ;;
-
- -static | -static-libtool-libs)
- # The effects of -static are defined in a previous loop.
- # We used to do the same as -all-static on platforms that
- # didn't have a PIC flag, but the assumption that the effects
- # would be equivalent was wrong. It would break on at least
- # Digital Unix and AIX.
- continue
- ;;
-
- -thread-safe)
- thread_safe=yes
- continue
- ;;
-
- -version-info)
- prev=vinfo
- continue
- ;;
- -version-number)
- prev=vinfo
- vinfo_number=yes
- continue
- ;;
-
- -Wc,*)
- args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
- arg=
- save_ifs="$IFS"; IFS=','
- for flag in $args; do
- IFS="$save_ifs"
- case $flag in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- flag="\"$flag\""
- ;;
- esac
- arg="$arg $wl$flag"
- compiler_flags="$compiler_flags $flag"
- done
- IFS="$save_ifs"
- arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
- ;;
-
- -Wl,*)
- args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
- arg=
- save_ifs="$IFS"; IFS=','
- for flag in $args; do
- IFS="$save_ifs"
- case $flag in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- flag="\"$flag\""
- ;;
- esac
- arg="$arg $wl$flag"
- compiler_flags="$compiler_flags $wl$flag"
- linker_flags="$linker_flags $flag"
- done
- IFS="$save_ifs"
- arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
- ;;
-
- -Xcompiler)
- prev=xcompiler
- continue
- ;;
-
- -Xlinker)
- prev=xlinker
- continue
- ;;
-
- -XCClinker)
- prev=xcclinker
- continue
- ;;
-
- # Some other compiler flag.
- -* | +*)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- ;;
-
- *.$objext)
- # A standard object.
- objs="$objs $arg"
- ;;
-
- *.lo)
- # A libtool-controlled object.
-
- # Check to see that this really is a libtool object.
- if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- pic_object=
- non_pic_object=
-
- # Read the .lo file
- # If there is no directory component, then add one.
- case $arg in
- */* | *\\*) . $arg ;;
- *) . ./$arg ;;
- esac
-
- if test -z "$pic_object" || \
- test -z "$non_pic_object" ||
- test "$pic_object" = none && \
- test "$non_pic_object" = none; then
- $echo "$modename: cannot find name of object for \`$arg'" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Extract subdirectory from the argument.
- xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$arg"; then
- xdir=
- else
- xdir="$xdir/"
- fi
-
- if test "$pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- pic_object="$xdir$pic_object"
-
- if test "$prev" = dlfiles; then
- if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
- dlfiles="$dlfiles $pic_object"
- prev=
- continue
- else
- # If libtool objects are unsupported, then we need to preload.
- prev=dlprefiles
- fi
- fi
-
- # CHECK ME: I think I busted this. -Ossama
- if test "$prev" = dlprefiles; then
- # Preload the old-style object.
- dlprefiles="$dlprefiles $pic_object"
- prev=
- fi
-
- # A PIC object.
- libobjs="$libobjs $pic_object"
- arg="$pic_object"
- fi
-
- # Non-PIC object.
- if test "$non_pic_object" != none; then
- # Prepend the subdirectory the object is found in.
- non_pic_object="$xdir$non_pic_object"
-
- # A standard non-PIC object
- non_pic_objects="$non_pic_objects $non_pic_object"
- if test -z "$pic_object" || test "$pic_object" = none ; then
- arg="$non_pic_object"
- fi
- else
- # If the PIC object exists, use it instead.
- # $xdir was prepended to $pic_object above.
- non_pic_object="$pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
- fi
- else
- # Only an error if not doing a dry-run.
- if test -z "$run"; then
- $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
- exit $EXIT_FAILURE
- else
- # Dry-run case.
-
- # Extract subdirectory from the argument.
- xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$xdir" = "X$arg"; then
- xdir=
- else
- xdir="$xdir/"
- fi
-
- pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
- non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
- libobjs="$libobjs $pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
- fi
- fi
- ;;
-
- *.$libext)
- # An archive.
- deplibs="$deplibs $arg"
- old_deplibs="$old_deplibs $arg"
- continue
- ;;
-
- *.la)
- # A libtool-controlled library.
-
- if test "$prev" = dlfiles; then
- # This library was specified with -dlopen.
- dlfiles="$dlfiles $arg"
- prev=
- elif test "$prev" = dlprefiles; then
- # The library was specified with -dlpreopen.
- dlprefiles="$dlprefiles $arg"
- prev=
- else
- deplibs="$deplibs $arg"
- fi
- continue
- ;;
-
- # Some other compiler argument.
- *)
- # Unknown arguments in both finalize_command and compile_command need
- # to be aesthetically quoted because they are evaled later.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- ;;
- esac # arg
-
- # Now actually substitute the argument into the commands.
- if test -n "$arg"; then
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- fi
- done # argument parsing loop
-
- if test -n "$prev"; then
- $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
- eval arg=\"$export_dynamic_flag_spec\"
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
- fi
-
- oldlibs=
- # calculate the name of the file, without its directory
- outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
- libobjs_save="$libobjs"
-
- if test -n "$shlibpath_var"; then
- # get the directories listed in $shlibpath_var
- eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
- else
- shlib_search_path=
- fi
- eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
- eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
-
- output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$output_objdir" = "X$output"; then
- output_objdir="$objdir"
- else
- output_objdir="$output_objdir/$objdir"
- fi
- # Create the object directory.
- if test ! -d "$output_objdir"; then
- $show "$mkdir $output_objdir"
- $run $mkdir $output_objdir
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
- exit $exit_status
- fi
- fi
-
- # Determine the type of output
- case $output in
- "")
- $echo "$modename: you must specify an output file" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- ;;
- *.$libext) linkmode=oldlib ;;
- *.lo | *.$objext) linkmode=obj ;;
- *.la) linkmode=lib ;;
- *) linkmode=prog ;; # Anything else should be a program.
- esac
-
- case $host in
- *cygwin* | *mingw* | *pw32*)
- # don't eliminate duplications in $postdeps and $predeps
- duplicate_compiler_generated_deps=yes
- ;;
- *)
- duplicate_compiler_generated_deps=$duplicate_deps
- ;;
- esac
- specialdeplibs=
-
- libs=
- # Find all interdependent deplibs by searching for libraries
- # that are linked more than once (e.g. -la -lb -la)
- for deplib in $deplibs; do
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- libs="$libs $deplib"
- done
-
- if test "$linkmode" = lib; then
- libs="$predeps $libs $compiler_lib_search_path $postdeps"
-
- # Compute libraries that are listed more than once in $predeps
- # $postdeps and mark them as special (i.e., whose duplicates are
- # not to be eliminated).
- pre_post_deps=
- if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
- for pre_post_dep in $predeps $postdeps; do
- case "$pre_post_deps " in
- *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
- esac
- pre_post_deps="$pre_post_deps $pre_post_dep"
- done
- fi
- pre_post_deps=
- fi
-
- deplibs=
- newdependency_libs=
- newlib_search_path=
- need_relink=no # whether we're linking any uninstalled libtool libraries
- notinst_deplibs= # not-installed libtool libraries
- case $linkmode in
- lib)
- passes="conv link"
- for file in $dlfiles $dlprefiles; do
- case $file in
- *.la) ;;
- *)
- $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- done
- ;;
- prog)
- compile_deplibs=
- finalize_deplibs=
- alldeplibs=no
- newdlfiles=
- newdlprefiles=
- passes="conv scan dlopen dlpreopen link"
- ;;
- *) passes="conv"
- ;;
- esac
- for pass in $passes; do
- if test "$linkmode,$pass" = "lib,link" ||
- test "$linkmode,$pass" = "prog,scan"; then
- libs="$deplibs"
- deplibs=
- fi
- if test "$linkmode" = prog; then
- case $pass in
- dlopen) libs="$dlfiles" ;;
- dlpreopen) libs="$dlprefiles" ;;
- link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
- esac
- fi
- if test "$pass" = dlopen; then
- # Collect dlpreopened libraries
- save_deplibs="$deplibs"
- deplibs=
- fi
- for deplib in $libs; do
- lib=
- found=no
- case $deplib in
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- compiler_flags="$compiler_flags $deplib"
- fi
- continue
- ;;
- -l*)
- if test "$linkmode" != lib && test "$linkmode" != prog; then
- $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
- continue
- fi
- name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
- if test "$linkmode" = lib; then
- searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
- else
- searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
- fi
- for searchdir in $searchdirs; do
- for search_ext in .la $std_shrext .so .a; do
- # Search the libtool library
- lib="$searchdir/lib${name}${search_ext}"
- if test -f "$lib"; then
- if test "$search_ext" = ".la"; then
- found=yes
- else
- found=no
- fi
- break 2
- fi
- done
- done
- if test "$found" != yes; then
- # deplib doesn't seem to be a libtool library
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- deplibs="$deplib $deplibs"
- test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
- fi
- continue
- else # deplib is a libtool library
- # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
- # We need to do some special things here, and not later.
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $deplib "*)
- if (${SED} -e '2q' $lib |
- grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- library_names=
- old_library=
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
- for l in $old_library $library_names; do
- ll="$l"
- done
- if test "X$ll" = "X$old_library" ; then # only static version available
- found=no
- ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$ladir" = "X$lib" && ladir="."
- lib=$ladir/$old_library
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- deplibs="$deplib $deplibs"
- test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
- fi
- continue
- fi
- fi
- ;;
- *) ;;
- esac
- fi
- fi
- ;; # -l
- -L*)
- case $linkmode in
- lib)
- deplibs="$deplib $deplibs"
- test "$pass" = conv && continue
- newdependency_libs="$deplib $newdependency_libs"
- newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
- ;;
- prog)
- if test "$pass" = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
- if test "$pass" = scan; then
- deplibs="$deplib $deplibs"
- else
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- fi
- newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
- ;;
- *)
- $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
- ;;
- esac # linkmode
- continue
- ;; # -L
- -R*)
- if test "$pass" = link; then
- dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
- # Make sure the xrpath contains only unique directories.
- case "$xrpath " in
- *" $dir "*) ;;
- *) xrpath="$xrpath $dir" ;;
- esac
- fi
- deplibs="$deplib $deplibs"
- continue
- ;;
- *.la) lib="$deplib" ;;
- *.$libext)
- if test "$pass" = conv; then
- deplibs="$deplib $deplibs"
- continue
- fi
- case $linkmode in
- lib)
- valid_a_lib=no
- case $deplibs_check_method in
- match_pattern*)
- set dummy $deplibs_check_method
- match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
- if eval $echo \"$deplib\" 2>/dev/null \
- | $SED 10q \
- | $EGREP "$match_pattern_regex" > /dev/null; then
- valid_a_lib=yes
- fi
- ;;
- pass_all)
- valid_a_lib=yes
- ;;
- esac
- if test "$valid_a_lib" != yes; then
- $echo
- $echo "*** Warning: Trying to link with static lib archive $deplib."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which you do not appear to have"
- $echo "*** because the file extensions .$libext of this argument makes me believe"
- $echo "*** that it is just a static archive that I should not used here."
- else
- $echo
- $echo "*** Warning: Linking the shared library $output against the"
- $echo "*** static library $deplib is not portable!"
- deplibs="$deplib $deplibs"
- fi
- continue
- ;;
- prog)
- if test "$pass" != link; then
- deplibs="$deplib $deplibs"
- else
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- fi
- continue
- ;;
- esac # linkmode
- ;; # *.$libext
- *.lo | *.$objext)
- if test "$pass" = conv; then
- deplibs="$deplib $deplibs"
- elif test "$linkmode" = prog; then
- if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
- # If there is no dlopen support or we're linking statically,
- # we need to preload.
- newdlprefiles="$newdlprefiles $deplib"
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- newdlfiles="$newdlfiles $deplib"
- fi
- fi
- continue
- ;;
- %DEPLIBS%)
- alldeplibs=yes
- continue
- ;;
- esac # case $deplib
- if test "$found" = yes || test -f "$lib"; then :
- else
- $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Check to see that this really is a libtool archive.
- if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- exit $EXIT_FAILURE
- fi
-
- ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$ladir" = "X$lib" && ladir="."
-
- dlname=
- dlopen=
- dlpreopen=
- libdir=
- library_names=
- old_library=
- # If the library was installed with an old release of libtool,
- # it will not redefine variables installed, or shouldnotlink
- installed=yes
- shouldnotlink=no
- avoidtemprpath=
-
-
- # Read the .la file
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
-
- if test "$linkmode,$pass" = "lib,link" ||
- test "$linkmode,$pass" = "prog,scan" ||
- { test "$linkmode" != prog && test "$linkmode" != lib; }; then
- test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
- test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
- fi
-
- if test "$pass" = conv; then
- # Only check for convenience libraries
- deplibs="$lib $deplibs"
- if test -z "$libdir"; then
- if test -z "$old_library"; then
- $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
- exit $EXIT_FAILURE
- fi
- # It is a libtool convenience library, so add in its objects.
- convenience="$convenience $ladir/$objdir/$old_library"
- old_convenience="$old_convenience $ladir/$objdir/$old_library"
- tmp_libs=
- for deplib in $dependency_libs; do
- deplibs="$deplib $deplibs"
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done
- elif test "$linkmode" != prog && test "$linkmode" != lib; then
- $echo "$modename: \`$lib' is not a convenience library" 1>&2
- exit $EXIT_FAILURE
- fi
- continue
- fi # $pass = conv
-
-
- # Get the name of the library we link against.
- linklib=
- for l in $old_library $library_names; do
- linklib="$l"
- done
- if test -z "$linklib"; then
- $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # This library was specified with -dlopen.
- if test "$pass" = dlopen; then
- if test -z "$libdir"; then
- $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
- exit $EXIT_FAILURE
- fi
- if test -z "$dlname" ||
- test "$dlopen_support" != yes ||
- test "$build_libtool_libs" = no; then
- # If there is no dlname, no dlopen support or we're linking
- # statically, we need to preload. We also need to preload any
- # dependent libraries so libltdl's deplib preloader doesn't
- # bomb out in the load deplibs phase.
- dlprefiles="$dlprefiles $lib $dependency_libs"
- else
- newdlfiles="$newdlfiles $lib"
- fi
- continue
- fi # $pass = dlopen
-
- # We need an absolute path.
- case $ladir in
- [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
- *)
- abs_ladir=`cd "$ladir" && pwd`
- if test -z "$abs_ladir"; then
- $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
- $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
- abs_ladir="$ladir"
- fi
- ;;
- esac
- laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
-
- # Find the relevant object directory and library name.
- if test "X$installed" = Xyes; then
- if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
- $echo "$modename: warning: library \`$lib' was moved." 1>&2
- dir="$ladir"
- absdir="$abs_ladir"
- libdir="$abs_ladir"
- else
- dir="$libdir"
- absdir="$libdir"
- fi
- test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
- else
- if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
- dir="$ladir"
- absdir="$abs_ladir"
- # Remove this search path later
- notinst_path="$notinst_path $abs_ladir"
- else
- dir="$ladir/$objdir"
- absdir="$abs_ladir/$objdir"
- # Remove this search path later
- notinst_path="$notinst_path $abs_ladir"
- fi
- fi # $installed = yes
- name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
-
- # This library was specified with -dlpreopen.
- if test "$pass" = dlpreopen; then
- if test -z "$libdir"; then
- $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
- exit $EXIT_FAILURE
- fi
- # Prefer using a static library (so that no silly _DYNAMIC symbols
- # are required to link).
- if test -n "$old_library"; then
- newdlprefiles="$newdlprefiles $dir/$old_library"
- # Otherwise, use the dlname, so that lt_dlopen finds it.
- elif test -n "$dlname"; then
- newdlprefiles="$newdlprefiles $dir/$dlname"
- else
- newdlprefiles="$newdlprefiles $dir/$linklib"
- fi
- fi # $pass = dlpreopen
-
- if test -z "$libdir"; then
- # Link the convenience library
- if test "$linkmode" = lib; then
- deplibs="$dir/$old_library $deplibs"
- elif test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$dir/$old_library $compile_deplibs"
- finalize_deplibs="$dir/$old_library $finalize_deplibs"
- else
- deplibs="$lib $deplibs" # used for prog,scan pass
- fi
- continue
- fi
-
-
- if test "$linkmode" = prog && test "$pass" != link; then
- newlib_search_path="$newlib_search_path $ladir"
- deplibs="$lib $deplibs"
-
- linkalldeplibs=no
- if test "$link_all_deplibs" != no || test -z "$library_names" ||
- test "$build_libtool_libs" = no; then
- linkalldeplibs=yes
- fi
-
- tmp_libs=
- for deplib in $dependency_libs; do
- case $deplib in
- -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
- esac
- # Need to link against all dependency_libs?
- if test "$linkalldeplibs" = yes; then
- deplibs="$deplib $deplibs"
- else
- # Need to hardcode shared library paths
- # or/and link against static libraries
- newdependency_libs="$deplib $newdependency_libs"
- fi
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done # for deplib
- continue
- fi # $linkmode = prog...
-
- if test "$linkmode,$pass" = "prog,link"; then
- if test -n "$library_names" &&
- { { test "$prefer_static_libs" = no ||
- test "$prefer_static_libs,$installed" = "built,yes"; } ||
- test -z "$old_library"; }; then
- # We need to hardcode the library path
- if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
- # Make sure the rpath contains only unique directories.
- case "$temp_rpath " in
- *" $dir "*) ;;
- *" $absdir "*) ;;
- *) temp_rpath="$temp_rpath $absdir" ;;
- esac
- fi
-
- # Hardcode the library path.
- # Skip directories that are in the system default run-time
- # search path.
- case " $sys_lib_dlsearch_path " in
- *" $absdir "*) ;;
- *)
- case "$compile_rpath " in
- *" $absdir "*) ;;
- *) compile_rpath="$compile_rpath $absdir"
- esac
- ;;
- esac
- case " $sys_lib_dlsearch_path " in
- *" $libdir "*) ;;
- *)
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir"
- esac
- ;;
- esac
- fi # $linkmode,$pass = prog,link...
-
- if test "$alldeplibs" = yes &&
- { test "$deplibs_check_method" = pass_all ||
- { test "$build_libtool_libs" = yes &&
- test -n "$library_names"; }; }; then
- # We only need to search for static libraries
- continue
- fi
- fi
-
- link_static=no # Whether the deplib will be linked statically
- use_static_libs=$prefer_static_libs
- if test "$use_static_libs" = built && test "$installed" = yes ; then
- use_static_libs=no
- fi
- if test -n "$library_names" &&
- { test "$use_static_libs" = no || test -z "$old_library"; }; then
- if test "$installed" = no; then
- notinst_deplibs="$notinst_deplibs $lib"
- need_relink=yes
- fi
- # This is a shared library
-
- # Warn about portability, can't link against -module's on
- # some systems (darwin)
- if test "$shouldnotlink" = yes && test "$pass" = link ; then
- $echo
- if test "$linkmode" = prog; then
- $echo "*** Warning: Linking the executable $output against the loadable module"
- else
- $echo "*** Warning: Linking the shared library $output against the loadable module"
- fi
- $echo "*** $linklib is not portable!"
- fi
- if test "$linkmode" = lib &&
- test "$hardcode_into_libs" = yes; then
- # Hardcode the library path.
- # Skip directories that are in the system default run-time
- # search path.
- case " $sys_lib_dlsearch_path " in
- *" $absdir "*) ;;
- *)
- case "$compile_rpath " in
- *" $absdir "*) ;;
- *) compile_rpath="$compile_rpath $absdir"
- esac
- ;;
- esac
- case " $sys_lib_dlsearch_path " in
- *" $libdir "*) ;;
- *)
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir"
- esac
- ;;
- esac
- fi
-
- if test -n "$old_archive_from_expsyms_cmds"; then
- # figure out the soname
- set dummy $library_names
- realname="$2"
- shift; shift
- libname=`eval \\$echo \"$libname_spec\"`
- # use dlname if we got it. it's perfectly good, no?
- if test -n "$dlname"; then
- soname="$dlname"
- elif test -n "$soname_spec"; then
- # bleh windows
- case $host in
- *cygwin* | mingw*)
- major=`expr $current - $age`
- versuffix="-$major"
- ;;
- esac
- eval soname=\"$soname_spec\"
- else
- soname="$realname"
- fi
-
- # Make a new name for the extract_expsyms_cmds to use
- soroot="$soname"
- soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
- newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
-
- # If the library has no export list, then create one now
- if test -f "$output_objdir/$soname-def"; then :
- else
- $show "extracting exported symbol list from \`$soname'"
- save_ifs="$IFS"; IFS='~'
- cmds=$extract_expsyms_cmds
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- # Create $newlib
- if test -f "$output_objdir/$newlib"; then :; else
- $show "generating import library for \`$soname'"
- save_ifs="$IFS"; IFS='~'
- cmds=$old_archive_from_expsyms_cmds
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
- # make sure the library variables are pointing to the new library
- dir=$output_objdir
- linklib=$newlib
- fi # test -n "$old_archive_from_expsyms_cmds"
-
- if test "$linkmode" = prog || test "$mode" != relink; then
- add_shlibpath=
- add_dir=
- add=
- lib_linked=yes
- case $hardcode_action in
- immediate | unsupported)
- if test "$hardcode_direct" = no; then
- add="$dir/$linklib"
- case $host in
- *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
- *-*-sysv4*uw2*) add_dir="-L$dir" ;;
- *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
- *-*-unixware7*) add_dir="-L$dir" ;;
- *-*-darwin* )
- # if the lib is a module then we can not link against
- # it, someone is ignoring the new warnings I added
- if /usr/bin/file -L $add 2> /dev/null |
- $EGREP ": [^:]* bundle" >/dev/null ; then
- $echo "** Warning, lib $linklib is a module, not a shared library"
- if test -z "$old_library" ; then
- $echo
- $echo "** And there doesn't seem to be a static archive available"
- $echo "** The link will probably fail, sorry"
- else
- add="$dir/$old_library"
- fi
- fi
- esac
- elif test "$hardcode_minus_L" = no; then
- case $host in
- *-*-sunos*) add_shlibpath="$dir" ;;
- esac
- add_dir="-L$dir"
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = no; then
- add_shlibpath="$dir"
- add="-l$name"
- else
- lib_linked=no
- fi
- ;;
- relink)
- if test "$hardcode_direct" = yes; then
- add="$dir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- add_dir="-L$dir"
- # Try looking first in the location we're being installed to.
- if test -n "$inst_prefix_dir"; then
- case $libdir in
- [\\/]*)
- add_dir="$add_dir -L$inst_prefix_dir$libdir"
- ;;
- esac
- fi
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- add_shlibpath="$dir"
- add="-l$name"
- else
- lib_linked=no
- fi
- ;;
- *) lib_linked=no ;;
- esac
-
- if test "$lib_linked" != yes; then
- $echo "$modename: configuration error: unsupported hardcode properties"
- exit $EXIT_FAILURE
- fi
-
- if test -n "$add_shlibpath"; then
- case :$compile_shlibpath: in
- *":$add_shlibpath:"*) ;;
- *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
- esac
- fi
- if test "$linkmode" = prog; then
- test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
- test -n "$add" && compile_deplibs="$add $compile_deplibs"
- else
- test -n "$add_dir" && deplibs="$add_dir $deplibs"
- test -n "$add" && deplibs="$add $deplibs"
- if test "$hardcode_direct" != yes && \
- test "$hardcode_minus_L" != yes && \
- test "$hardcode_shlibpath_var" = yes; then
- case :$finalize_shlibpath: in
- *":$libdir:"*) ;;
- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
- esac
- fi
- fi
- fi
-
- if test "$linkmode" = prog || test "$mode" = relink; then
- add_shlibpath=
- add_dir=
- add=
- # Finalize command for both is simple: just hardcode it.
- if test "$hardcode_direct" = yes; then
- add="$libdir/$linklib"
- elif test "$hardcode_minus_L" = yes; then
- add_dir="-L$libdir"
- add="-l$name"
- elif test "$hardcode_shlibpath_var" = yes; then
- case :$finalize_shlibpath: in
- *":$libdir:"*) ;;
- *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
- esac
- add="-l$name"
- elif test "$hardcode_automatic" = yes; then
- if test -n "$inst_prefix_dir" &&
- test -f "$inst_prefix_dir$libdir/$linklib" ; then
- add="$inst_prefix_dir$libdir/$linklib"
- else
- add="$libdir/$linklib"
- fi
- else
- # We cannot seem to hardcode it, guess we'll fake it.
- add_dir="-L$libdir"
- # Try looking first in the location we're being installed to.
- if test -n "$inst_prefix_dir"; then
- case $libdir in
- [\\/]*)
- add_dir="$add_dir -L$inst_prefix_dir$libdir"
- ;;
- esac
- fi
- add="-l$name"
- fi
-
- if test "$linkmode" = prog; then
- test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
- test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
- else
- test -n "$add_dir" && deplibs="$add_dir $deplibs"
- test -n "$add" && deplibs="$add $deplibs"
- fi
- fi
- elif test "$linkmode" = prog; then
- # Here we assume that one of hardcode_direct or hardcode_minus_L
- # is not unsupported. This is valid on all known static and
- # shared platforms.
- if test "$hardcode_direct" != unsupported; then
- test -n "$old_library" && linklib="$old_library"
- compile_deplibs="$dir/$linklib $compile_deplibs"
- finalize_deplibs="$dir/$linklib $finalize_deplibs"
- else
- compile_deplibs="-l$name -L$dir $compile_deplibs"
- finalize_deplibs="-l$name -L$dir $finalize_deplibs"
- fi
- elif test "$build_libtool_libs" = yes; then
- # Not a shared library
- if test "$deplibs_check_method" != pass_all; then
- # We're trying link a shared library against a static one
- # but the system doesn't support it.
-
- # Just print a warning and add the library to dependency_libs so
- # that the program can be linked against the static library.
- $echo
- $echo "*** Warning: This system can not link to static lib archive $lib."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which you do not appear to have."
- if test "$module" = yes; then
- $echo "*** But as you try to build a module library, libtool will still create "
- $echo "*** a static module, that should work as long as the dlopening application"
- $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
- if test -z "$global_symbol_pipe"; then
- $echo
- $echo "*** However, this would only work if libtool was able to extract symbol"
- $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
- $echo "*** not find such a program. So, this module is probably useless."
- $echo "*** \`nm' from GNU binutils and a full rebuild may help."
- fi
- if test "$build_old_libs" = no; then
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- fi
- else
- deplibs="$dir/$old_library $deplibs"
- link_static=yes
- fi
- fi # link shared/static library?
-
- if test "$linkmode" = lib; then
- if test -n "$dependency_libs" &&
- { test "$hardcode_into_libs" != yes ||
- test "$build_old_libs" = yes ||
- test "$link_static" = yes; }; then
- # Extract -R from dependency_libs
- temp_deplibs=
- for libdir in $dependency_libs; do
- case $libdir in
- -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
- case " $xrpath " in
- *" $temp_xrpath "*) ;;
- *) xrpath="$xrpath $temp_xrpath";;
- esac;;
- *) temp_deplibs="$temp_deplibs $libdir";;
- esac
- done
- dependency_libs="$temp_deplibs"
- fi
-
- newlib_search_path="$newlib_search_path $absdir"
- # Link against this library
- test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
- # ... and its dependency_libs
- tmp_libs=
- for deplib in $dependency_libs; do
- newdependency_libs="$deplib $newdependency_libs"
- if test "X$duplicate_deps" = "Xyes" ; then
- case "$tmp_libs " in
- *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
- esac
- fi
- tmp_libs="$tmp_libs $deplib"
- done
-
- if test "$link_all_deplibs" != no; then
- # Add the search paths of all dependency libraries
- for deplib in $dependency_libs; do
- case $deplib in
- -L*) path="$deplib" ;;
- *.la)
- dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$deplib" && dir="."
- # We need an absolute path.
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
- *)
- absdir=`cd "$dir" && pwd`
- if test -z "$absdir"; then
- $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
- absdir="$dir"
- fi
- ;;
- esac
- if grep "^installed=no" $deplib > /dev/null; then
- path="$absdir/$objdir"
- else
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
- if test -z "$libdir"; then
- $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
- exit $EXIT_FAILURE
- fi
- if test "$absdir" != "$libdir"; then
- $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
- fi
- path="$absdir"
- fi
- depdepl=
- case $host in
- *-*-darwin*)
- # we do not want to link against static libs,
- # but need to link against shared
- eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
- eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
- if test -n "$deplibrary_names" ; then
- for tmp in $deplibrary_names ; do
- depdepl=$tmp
- done
- if test -f "$deplibdir/$depdepl" ; then
- depdepl="$deplibdir/$depdepl"
- elif test -f "$path/$depdepl" ; then
- depdepl="$path/$depdepl"
- else
- # Can't find it, oh well...
- depdepl=
- fi
- # do not add paths which are already there
- case " $newlib_search_path " in
- *" $path "*) ;;
- *) newlib_search_path="$newlib_search_path $path";;
- esac
- fi
- path=""
- ;;
- *)
- path="-L$path"
- ;;
- esac
- ;;
- -l*)
- case $host in
- *-*-darwin*)
- # Again, we only want to link against shared libraries
- eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
- for tmp in $newlib_search_path ; do
- if test -f "$tmp/lib$tmp_libs.dylib" ; then
- eval depdepl="$tmp/lib$tmp_libs.dylib"
- break
- fi
- done
- path=""
- ;;
- *) continue ;;
- esac
- ;;
- *) continue ;;
- esac
- case " $deplibs " in
- *" $path "*) ;;
- *) deplibs="$path $deplibs" ;;
- esac
- case " $deplibs " in
- *" $depdepl "*) ;;
- *) deplibs="$depdepl $deplibs" ;;
- esac
- done
- fi # link_all_deplibs != no
- fi # linkmode = lib
- done # for deplib in $libs
- dependency_libs="$newdependency_libs"
- if test "$pass" = dlpreopen; then
- # Link the dlpreopened libraries before other libraries
- for deplib in $save_deplibs; do
- deplibs="$deplib $deplibs"
- done
- fi
- if test "$pass" != dlopen; then
- if test "$pass" != conv; then
- # Make sure lib_search_path contains only unique directories.
- lib_search_path=
- for dir in $newlib_search_path; do
- case "$lib_search_path " in
- *" $dir "*) ;;
- *) lib_search_path="$lib_search_path $dir" ;;
- esac
- done
- newlib_search_path=
- fi
-
- if test "$linkmode,$pass" != "prog,link"; then
- vars="deplibs"
- else
- vars="compile_deplibs finalize_deplibs"
- fi
- for var in $vars dependency_libs; do
- # Add libraries to $var in reverse order
- eval tmp_libs=\"\$$var\"
- new_libs=
- for deplib in $tmp_libs; do
- # FIXME: Pedantically, this is the right thing to do, so
- # that some nasty dependency loop isn't accidentally
- # broken:
- #new_libs="$deplib $new_libs"
- # Pragmatically, this seems to cause very few problems in
- # practice:
- case $deplib in
- -L*) new_libs="$deplib $new_libs" ;;
- -R*) ;;
- *)
- # And here is the reason: when a library appears more
- # than once as an explicit dependence of a library, or
- # is implicitly linked in more than once by the
- # compiler, it is considered special, and multiple
- # occurrences thereof are not removed. Compare this
- # with having the same library being listed as a
- # dependency of multiple other libraries: in this case,
- # we know (pedantically, we assume) the library does not
- # need to be listed more than once, so we keep only the
- # last copy. This is not always right, but it is rare
- # enough that we require users that really mean to play
- # such unportable linking tricks to link the library
- # using -Wl,-lname, so that libtool does not consider it
- # for duplicate removal.
- case " $specialdeplibs " in
- *" $deplib "*) new_libs="$deplib $new_libs" ;;
- *)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$deplib $new_libs" ;;
- esac
- ;;
- esac
- ;;
- esac
- done
- tmp_libs=
- for deplib in $new_libs; do
- case $deplib in
- -L*)
- case " $tmp_libs " in
- *" $deplib "*) ;;
- *) tmp_libs="$tmp_libs $deplib" ;;
- esac
- ;;
- *) tmp_libs="$tmp_libs $deplib" ;;
- esac
- done
- eval $var=\"$tmp_libs\"
- done # for var
- fi
- # Last step: remove runtime libs from dependency_libs
- # (they stay in deplibs)
- tmp_libs=
- for i in $dependency_libs ; do
- case " $predeps $postdeps $compiler_lib_search_path " in
- *" $i "*)
- i=""
- ;;
- esac
- if test -n "$i" ; then
- tmp_libs="$tmp_libs $i"
- fi
- done
- dependency_libs=$tmp_libs
- done # for pass
- if test "$linkmode" = prog; then
- dlfiles="$newdlfiles"
- dlprefiles="$newdlprefiles"
- fi
-
- case $linkmode in
- oldlib)
- case " $deplibs" in
- *\ -l* | *\ -L*)
- $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
- esac
-
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
- fi
-
- if test -n "$rpath"; then
- $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
- fi
-
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
- fi
-
- if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
- $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
- fi
-
- # Now set the variables for building old libraries.
- build_libtool_libs=no
- oldlibs="$output"
- objs="$objs$old_deplibs"
- ;;
-
- lib)
- # Make sure we only generate libraries of the form `libNAME.la'.
- case $outputname in
- lib*)
- name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
- eval shared_ext=\"$shrext_cmds\"
- eval libname=\"$libname_spec\"
- ;;
- *)
- if test "$module" = no; then
- $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
- if test "$need_lib_prefix" != no; then
- # Add the "lib" prefix for modules if required
- name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
- eval shared_ext=\"$shrext_cmds\"
- eval libname=\"$libname_spec\"
- else
- libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
- fi
- ;;
- esac
-
- if test -n "$objs"; then
- if test "$deplibs_check_method" != pass_all; then
- $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
- exit $EXIT_FAILURE
- else
- $echo
- $echo "*** Warning: Linking the shared library $output against the non-libtool"
- $echo "*** objects $objs is not portable!"
- libobjs="$libobjs $objs"
- fi
- fi
-
- if test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
- fi
-
- set dummy $rpath
- if test "$#" -gt 2; then
- $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
- fi
- install_libdir="$2"
-
- oldlibs=
- if test -z "$rpath"; then
- if test "$build_libtool_libs" = yes; then
- # Building a libtool convenience library.
- # Some compilers have problems with a `.al' extension so
- # convenience libraries should have the same extension an
- # archive normally would.
- oldlibs="$output_objdir/$libname.$libext $oldlibs"
- build_libtool_libs=convenience
- build_old_libs=yes
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
- fi
- else
-
- # Parse the version information argument.
- save_ifs="$IFS"; IFS=':'
- set dummy $vinfo 0 0 0
- IFS="$save_ifs"
-
- if test -n "$8"; then
- $echo "$modename: too many parameters to \`-version-info'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # convert absolute version numbers to libtool ages
- # this retains compatibility with .la files and attempts
- # to make the code below a bit more comprehensible
-
- case $vinfo_number in
- yes)
- number_major="$2"
- number_minor="$3"
- number_revision="$4"
- #
- # There are really only two kinds -- those that
- # use the current revision as the major version
- # and those that subtract age and use age as
- # a minor version. But, then there is irix
- # which has an extra 1 added just for fun
- #
- case $version_type in
- darwin|linux|osf|windows|none)
- current=`expr $number_major + $number_minor`
- age="$number_minor"
- revision="$number_revision"
- ;;
- freebsd-aout|freebsd-elf|sunos)
- current="$number_major"
- revision="$number_minor"
- age="0"
- ;;
- irix|nonstopux)
- current=`expr $number_major + $number_minor`
- age="$number_minor"
- revision="$number_minor"
- lt_irix_increment=no
- ;;
- esac
- ;;
- no)
- current="$2"
- revision="$3"
- age="$4"
- ;;
- esac
-
- # Check that each of the things are valid numbers.
- case $current in
- 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
- *)
- $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- case $revision in
- 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
- *)
- $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- case $age in
- 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
- *)
- $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- if test "$age" -gt "$current"; then
- $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Calculate the version variables.
- major=
- versuffix=
- verstring=
- case $version_type in
- none) ;;
-
- darwin)
- # Like Linux, but with the current version available in
- # verstring for coding it into the library header
- major=.`expr $current - $age`
- versuffix="$major.$age.$revision"
- # Darwin ld doesn't like 0 for these options...
- minor_current=`expr $current + 1`
- xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
- verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
- ;;
-
- freebsd-aout)
- major=".$current"
- versuffix=".$current.$revision";
- ;;
-
- freebsd-elf)
- major=".$current"
- versuffix=".$current";
- ;;
-
- irix | nonstopux)
- if test "X$lt_irix_increment" = "Xno"; then
- major=`expr $current - $age`
- else
- major=`expr $current - $age + 1`
- fi
- case $version_type in
- nonstopux) verstring_prefix=nonstopux ;;
- *) verstring_prefix=sgi ;;
- esac
- verstring="$verstring_prefix$major.$revision"
-
- # Add in all the interfaces that we are compatible with.
- loop=$revision
- while test "$loop" -ne 0; do
- iface=`expr $revision - $loop`
- loop=`expr $loop - 1`
- verstring="$verstring_prefix$major.$iface:$verstring"
- done
-
- # Before this point, $major must not contain `.'.
- major=.$major
- versuffix="$major.$revision"
- ;;
-
- linux)
- major=.`expr $current - $age`
- versuffix="$major.$age.$revision"
- ;;
-
- osf)
- major=.`expr $current - $age`
- versuffix=".$current.$age.$revision"
- verstring="$current.$age.$revision"
-
- # Add in all the interfaces that we are compatible with.
- loop=$age
- while test "$loop" -ne 0; do
- iface=`expr $current - $loop`
- loop=`expr $loop - 1`
- verstring="$verstring:${iface}.0"
- done
-
- # Make executables depend on our current version.
- verstring="$verstring:${current}.0"
- ;;
-
- sunos)
- major=".$current"
- versuffix=".$current.$revision"
- ;;
-
- windows)
- # Use '-' rather than '.', since we only want one
- # extension on DOS 8.3 filesystems.
- major=`expr $current - $age`
- versuffix="-$major"
- ;;
-
- *)
- $echo "$modename: unknown library version type \`$version_type'" 1>&2
- $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- # Clear the version info if we defaulted, and they specified a release.
- if test -z "$vinfo" && test -n "$release"; then
- major=
- case $version_type in
- darwin)
- # we can't check for "0.0" in archive_cmds due to quoting
- # problems, so we reset it completely
- verstring=
- ;;
- *)
- verstring="0.0"
- ;;
- esac
- if test "$need_version" = no; then
- versuffix=
- else
- versuffix=".0.0"
- fi
- fi
-
- # Remove version info from name if versioning should be avoided
- if test "$avoid_version" = yes && test "$need_version" = no; then
- major=
- versuffix=
- verstring=""
- fi
-
- # Check to see if the archive will have undefined symbols.
- if test "$allow_undefined" = yes; then
- if test "$allow_undefined_flag" = unsupported; then
- $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
- build_libtool_libs=no
- build_old_libs=yes
- fi
- else
- # Don't allow undefined symbols.
- allow_undefined_flag="$no_undefined_flag"
- fi
- fi
-
- if test "$mode" != relink; then
- # Remove our outputs, but don't remove object files since they
- # may have been created when compiling PIC objects.
- removelist=
- tempremovelist=`$echo "$output_objdir/*"`
- for p in $tempremovelist; do
- case $p in
- *.$objext)
- ;;
- $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
- if test "X$precious_files_regex" != "X"; then
- if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
- then
- continue
- fi
- fi
- removelist="$removelist $p"
- ;;
- *) ;;
- esac
- done
- if test -n "$removelist"; then
- $show "${rm}r $removelist"
- $run ${rm}r $removelist
- fi
- fi
-
- # Now set the variables for building old libraries.
- if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
- oldlibs="$oldlibs $output_objdir/$libname.$libext"
-
- # Transform .lo files to .o files.
- oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
- fi
-
- # Eliminate all temporary directories.
- #for path in $notinst_path; do
- # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
- # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
- # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
- #done
-
- if test -n "$xrpath"; then
- # If the user specified any rpath flags, then add them.
- temp_xrpath=
- for libdir in $xrpath; do
- temp_xrpath="$temp_xrpath -R$libdir"
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir" ;;
- esac
- done
- if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
- dependency_libs="$temp_xrpath $dependency_libs"
- fi
- fi
-
- # Make sure dlfiles contains only unique files that won't be dlpreopened
- old_dlfiles="$dlfiles"
- dlfiles=
- for lib in $old_dlfiles; do
- case " $dlprefiles $dlfiles " in
- *" $lib "*) ;;
- *) dlfiles="$dlfiles $lib" ;;
- esac
- done
-
- # Make sure dlprefiles contains only unique files
- old_dlprefiles="$dlprefiles"
- dlprefiles=
- for lib in $old_dlprefiles; do
- case "$dlprefiles " in
- *" $lib "*) ;;
- *) dlprefiles="$dlprefiles $lib" ;;
- esac
- done
-
- if test "$build_libtool_libs" = yes; then
- if test -n "$rpath"; then
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
- # these systems don't actually have a c library (as such)!
- ;;
- *-*-rhapsody* | *-*-darwin1.[012])
- # Rhapsody C library is in the System framework
- deplibs="$deplibs -framework System"
- ;;
- *-*-netbsd*)
- # Don't link with libc until the a.out ld.so is fixed.
- ;;
- *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
- # Do not include libc due to us having libc/libc_r.
- ;;
- *-*-sco3.2v5* | *-*-sco5v6*)
- # Causes problems with __ctype
- ;;
- *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
- # Compiler inserts libc in the correct place for threads to work
- ;;
- *)
- # Add libc to deplibs on all other systems if necessary.
- if test "$build_libtool_need_lc" = "yes"; then
- deplibs="$deplibs -lc"
- fi
- ;;
- esac
- fi
-
- # Transform deplibs into only deplibs that can be linked in shared.
- name_save=$name
- libname_save=$libname
- release_save=$release
- versuffix_save=$versuffix
- major_save=$major
- # I'm not sure if I'm treating the release correctly. I think
- # release should show up in the -l (ie -lgmp5) so we don't want to
- # add it in twice. Is that correct?
- release=""
- versuffix=""
- major=""
- newdeplibs=
- droppeddeps=no
- case $deplibs_check_method in
- pass_all)
- # Don't check for shared/static. Everything works.
- # This might be a little naive. We might want to check
- # whether the library exists or not. But this is on
- # osf3 & osf4 and I'm not really sure... Just
- # implementing what was already the behavior.
- newdeplibs=$deplibs
- ;;
- test_compile)
- # This code stresses the "libraries are programs" paradigm to its
- # limits. Maybe even breaks it. We compile a program, linking it
- # against the deplibs as a proxy for the library. Then we can check
- # whether they linked in statically or dynamically with ldd.
- $rm conftest.c
- cat > conftest.c <<EOF
- int main() { return 0; }
-EOF
- $rm conftest
- if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
- ldd_output=`ldd conftest`
- for i in $deplibs; do
- name=`expr $i : '-l\(.*\)'`
- # If $name is empty we are operating on a -L argument.
- if test "$name" != "" && test "$name" != "0"; then
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $i "*)
- newdeplibs="$newdeplibs $i"
- i=""
- ;;
- esac
- fi
- if test -n "$i" ; then
- libname=`eval \\$echo \"$libname_spec\"`
- deplib_matches=`eval \\$echo \"$library_names_spec\"`
- set dummy $deplib_matches
- deplib_match=$2
- if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- newdeplibs="$newdeplibs $i"
- else
- droppeddeps=yes
- $echo
- $echo "*** Warning: dynamic linker does not accept needed library $i."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which I believe you do not have"
- $echo "*** because a test_compile did reveal that the linker did not use it for"
- $echo "*** its dynamic dependency list that programs get resolved with at runtime."
- fi
- fi
- else
- newdeplibs="$newdeplibs $i"
- fi
- done
- else
- # Error occurred in the first compile. Let's try to salvage
- # the situation: Compile a separate program for each library.
- for i in $deplibs; do
- name=`expr $i : '-l\(.*\)'`
- # If $name is empty we are operating on a -L argument.
- if test "$name" != "" && test "$name" != "0"; then
- $rm conftest
- if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
- ldd_output=`ldd conftest`
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $i "*)
- newdeplibs="$newdeplibs $i"
- i=""
- ;;
- esac
- fi
- if test -n "$i" ; then
- libname=`eval \\$echo \"$libname_spec\"`
- deplib_matches=`eval \\$echo \"$library_names_spec\"`
- set dummy $deplib_matches
- deplib_match=$2
- if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- newdeplibs="$newdeplibs $i"
- else
- droppeddeps=yes
- $echo
- $echo "*** Warning: dynamic linker does not accept needed library $i."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which you do not appear to have"
- $echo "*** because a test_compile did reveal that the linker did not use this one"
- $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
- fi
- fi
- else
- droppeddeps=yes
- $echo
- $echo "*** Warning! Library $i is needed by this library but I was not able to"
- $echo "*** make it link in! You will probably need to install it or some"
- $echo "*** library that it depends on before this library will be fully"
- $echo "*** functional. Installing it before continuing would be even better."
- fi
- else
- newdeplibs="$newdeplibs $i"
- fi
- done
- fi
- ;;
- file_magic*)
- set dummy $deplibs_check_method
- file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
- for a_deplib in $deplibs; do
- name=`expr $a_deplib : '-l\(.*\)'`
- # If $name is empty we are operating on a -L argument.
- if test "$name" != "" && test "$name" != "0"; then
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $a_deplib "*)
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- ;;
- esac
- fi
- if test -n "$a_deplib" ; then
- libname=`eval \\$echo \"$libname_spec\"`
- for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
- potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
- for potent_lib in $potential_libs; do
- # Follow soft links.
- if ls -lLd "$potent_lib" 2>/dev/null \
- | grep " -> " >/dev/null; then
- continue
- fi
- # The statement above tries to avoid entering an
- # endless loop below, in case of cyclic links.
- # We might still enter an endless loop, since a link
- # loop can be closed while we follow links,
- # but so what?
- potlib="$potent_lib"
- while test -h "$potlib" 2>/dev/null; do
- potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
- case $potliblink in
- [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
- *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
- esac
- done
- if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
- | ${SED} 10q \
- | $EGREP "$file_magic_regex" > /dev/null; then
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- break 2
- fi
- done
- done
- fi
- if test -n "$a_deplib" ; then
- droppeddeps=yes
- $echo
- $echo "*** Warning: linker path does not have real file for library $a_deplib."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which you do not appear to have"
- $echo "*** because I did check the linker path looking for a file starting"
- if test -z "$potlib" ; then
- $echo "*** with $libname but no candidates were found. (...for file magic test)"
- else
- $echo "*** with $libname and none of the candidates passed a file format test"
- $echo "*** using a file magic. Last file checked: $potlib"
- fi
- fi
- else
- # Add a -L argument.
- newdeplibs="$newdeplibs $a_deplib"
- fi
- done # Gone through all deplibs.
- ;;
- match_pattern*)
- set dummy $deplibs_check_method
- match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
- for a_deplib in $deplibs; do
- name=`expr $a_deplib : '-l\(.*\)'`
- # If $name is empty we are operating on a -L argument.
- if test -n "$name" && test "$name" != "0"; then
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- case " $predeps $postdeps " in
- *" $a_deplib "*)
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- ;;
- esac
- fi
- if test -n "$a_deplib" ; then
- libname=`eval \\$echo \"$libname_spec\"`
- for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
- potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
- for potent_lib in $potential_libs; do
- potlib="$potent_lib" # see symlink-check above in file_magic test
- if eval $echo \"$potent_lib\" 2>/dev/null \
- | ${SED} 10q \
- | $EGREP "$match_pattern_regex" > /dev/null; then
- newdeplibs="$newdeplibs $a_deplib"
- a_deplib=""
- break 2
- fi
- done
- done
- fi
- if test -n "$a_deplib" ; then
- droppeddeps=yes
- $echo
- $echo "*** Warning: linker path does not have real file for library $a_deplib."
- $echo "*** I have the capability to make that library automatically link in when"
- $echo "*** you link to this library. But I can only do this if you have a"
- $echo "*** shared version of the library, which you do not appear to have"
- $echo "*** because I did check the linker path looking for a file starting"
- if test -z "$potlib" ; then
- $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
- else
- $echo "*** with $libname and none of the candidates passed a file format test"
- $echo "*** using a regex pattern. Last file checked: $potlib"
- fi
- fi
- else
- # Add a -L argument.
- newdeplibs="$newdeplibs $a_deplib"
- fi
- done # Gone through all deplibs.
- ;;
- none | unknown | *)
- newdeplibs=""
- tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
- -e 's/ -[LR][^ ]*//g'`
- if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
- for i in $predeps $postdeps ; do
- # can't use Xsed below, because $i might contain '/'
- tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
- done
- fi
- if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
- | grep . >/dev/null; then
- $echo
- if test "X$deplibs_check_method" = "Xnone"; then
- $echo "*** Warning: inter-library dependencies are not supported in this platform."
- else
- $echo "*** Warning: inter-library dependencies are not known to be supported."
- fi
- $echo "*** All declared inter-library dependencies are being dropped."
- droppeddeps=yes
- fi
- ;;
- esac
- versuffix=$versuffix_save
- major=$major_save
- release=$release_save
- libname=$libname_save
- name=$name_save
-
- case $host in
- *-*-rhapsody* | *-*-darwin1.[012])
- # On Rhapsody replace the C library is the System framework
- newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
- ;;
- esac
-
- if test "$droppeddeps" = yes; then
- if test "$module" = yes; then
- $echo
- $echo "*** Warning: libtool could not satisfy all declared inter-library"
- $echo "*** dependencies of module $libname. Therefore, libtool will create"
- $echo "*** a static module, that should work as long as the dlopening"
- $echo "*** application is linked with the -dlopen flag."
- if test -z "$global_symbol_pipe"; then
- $echo
- $echo "*** However, this would only work if libtool was able to extract symbol"
- $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
- $echo "*** not find such a program. So, this module is probably useless."
- $echo "*** \`nm' from GNU binutils and a full rebuild may help."
- fi
- if test "$build_old_libs" = no; then
- oldlibs="$output_objdir/$libname.$libext"
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- else
- $echo "*** The inter-library dependencies that have been dropped here will be"
- $echo "*** automatically added whenever a program is linked with this library"
- $echo "*** or is declared to -dlopen it."
-
- if test "$allow_undefined" = no; then
- $echo
- $echo "*** Since this library must not contain undefined symbols,"
- $echo "*** because either the platform does not support them or"
- $echo "*** it was explicitly requested with -no-undefined,"
- $echo "*** libtool will only create a static version of it."
- if test "$build_old_libs" = no; then
- oldlibs="$output_objdir/$libname.$libext"
- build_libtool_libs=module
- build_old_libs=yes
- else
- build_libtool_libs=no
- fi
- fi
- fi
- fi
- # Done checking deplibs!
- deplibs=$newdeplibs
- fi
-
-
- # move library search paths that coincide with paths to not yet
- # installed libraries to the beginning of the library search list
- new_libs=
- for path in $notinst_path; do
- case " $new_libs " in
- *" -L$path/$objdir "*) ;;
- *)
- case " $deplibs " in
- *" -L$path/$objdir "*)
- new_libs="$new_libs -L$path/$objdir" ;;
- esac
- ;;
- esac
- done
- for deplib in $deplibs; do
- case $deplib in
- -L*)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- done
- deplibs="$new_libs"
-
-
- # All the library-specific variables (install_libdir is set above).
- library_names=
- old_library=
- dlname=
-
- # Test again, we may have decided not to build it any more
- if test "$build_libtool_libs" = yes; then
- if test "$hardcode_into_libs" = yes; then
- # Hardcode the library paths
- hardcode_libdirs=
- dep_rpath=
- rpath="$finalize_rpath"
- test "$mode" != relink && rpath="$compile_rpath$rpath"
- for libdir in $rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- dep_rpath="$dep_rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- if test -n "$hardcode_libdir_flag_spec_ld"; then
- case $archive_cmds in
- *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
- *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
- esac
- else
- eval dep_rpath=\"$hardcode_libdir_flag_spec\"
- fi
- fi
- if test -n "$runpath_var" && test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
- fi
- test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
- fi
-
- shlibpath="$finalize_shlibpath"
- test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
- if test -n "$shlibpath"; then
- eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
- fi
-
- # Get the real and link names of the library.
- eval shared_ext=\"$shrext_cmds\"
- eval library_names=\"$library_names_spec\"
- set dummy $library_names
- realname="$2"
- shift; shift
-
- if test -n "$soname_spec"; then
- eval soname=\"$soname_spec\"
- else
- soname="$realname"
- fi
- if test -z "$dlname"; then
- dlname=$soname
- fi
-
- lib="$output_objdir/$realname"
- linknames=
- for link
- do
- linknames="$linknames $link"
- done
-
- # Use standard objects if they are pic
- test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-
- # Prepare the list of exported symbols
- if test -z "$export_symbols"; then
- if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
- $show "generating symbol list for \`$libname.la'"
- export_symbols="$output_objdir/$libname.exp"
- $run $rm $export_symbols
- cmds=$export_symbols_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- if len=`expr "X$cmd" : ".*"` &&
- test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- $show "$cmd"
- $run eval "$cmd" || exit $?
- skipped_export=false
- else
- # The command line is too long to execute in one step.
- $show "using reloadable object file for export list..."
- skipped_export=:
- # Break out early, otherwise skipped_export may be
- # set to false by a later but shorter cmd.
- break
- fi
- done
- IFS="$save_ifs"
- if test -n "$export_symbols_regex"; then
- $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
- $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
- $show "$mv \"${export_symbols}T\" \"$export_symbols\""
- $run eval '$mv "${export_symbols}T" "$export_symbols"'
- fi
- fi
- fi
-
- if test -n "$export_symbols" && test -n "$include_expsyms"; then
- $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
- fi
-
- tmp_deplibs=
- for test_deplib in $deplibs; do
- case " $convenience " in
- *" $test_deplib "*) ;;
- *)
- tmp_deplibs="$tmp_deplibs $test_deplib"
- ;;
- esac
- done
- deplibs="$tmp_deplibs"
-
- if test -n "$convenience"; then
- if test -n "$whole_archive_flag_spec"; then
- save_libobjs=$libobjs
- eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
- else
- gentop="$output_objdir/${outputname}x"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $convenience
- libobjs="$libobjs $func_extract_archives_result"
- fi
- fi
-
- if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
- eval flag=\"$thread_safe_flag_spec\"
- linker_flags="$linker_flags $flag"
- fi
-
- # Make a backup of the uninstalled library when relinking
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
- fi
-
- # Do each of the archive commands.
- if test "$module" = yes && test -n "$module_cmds" ; then
- if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
- eval test_cmds=\"$module_expsym_cmds\"
- cmds=$module_expsym_cmds
- else
- eval test_cmds=\"$module_cmds\"
- cmds=$module_cmds
- fi
- else
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- eval test_cmds=\"$archive_expsym_cmds\"
- cmds=$archive_expsym_cmds
- else
- eval test_cmds=\"$archive_cmds\"
- cmds=$archive_cmds
- fi
- fi
-
- if test "X$skipped_export" != "X:" &&
- len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
- test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- :
- else
- # The command line is too long to link in one step, link piecewise.
- $echo "creating reloadable object files..."
-
- # Save the value of $output and $libobjs because we want to
- # use them later. If we have whole_archive_flag_spec, we
- # want to use save_libobjs as it was before
- # whole_archive_flag_spec was expanded, because we can't
- # assume the linker understands whole_archive_flag_spec.
- # This may have to be revisited, in case too many
- # convenience libraries get linked in and end up exceeding
- # the spec.
- if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
- save_libobjs=$libobjs
- fi
- save_output=$output
- output_la=`$echo "X$output" | $Xsed -e "$basename"`
-
- # Clear the reloadable object creation command queue and
- # initialize k to one.
- test_cmds=
- concat_cmds=
- objlist=
- delfiles=
- last_robj=
- k=1
- output=$output_objdir/$output_la-${k}.$objext
- # Loop over the list of objects to be linked.
- for obj in $save_libobjs
- do
- eval test_cmds=\"$reload_cmds $objlist $last_robj\"
- if test "X$objlist" = X ||
- { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
- test "$len" -le "$max_cmd_len"; }; then
- objlist="$objlist $obj"
- else
- # The command $test_cmds is almost too long, add a
- # command to the queue.
- if test "$k" -eq 1 ; then
- # The first file doesn't have a previous command to add.
- eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
- else
- # All subsequent reloadable object files will link in
- # the last one created.
- eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
- fi
- last_robj=$output_objdir/$output_la-${k}.$objext
- k=`expr $k + 1`
- output=$output_objdir/$output_la-${k}.$objext
- objlist=$obj
- len=1
- fi
- done
- # Handle the remaining objects by creating one last
- # reloadable object file. All subsequent reloadable object
- # files will link in the last one created.
- test -z "$concat_cmds" || concat_cmds=$concat_cmds~
- eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
-
- if ${skipped_export-false}; then
- $show "generating symbol list for \`$libname.la'"
- export_symbols="$output_objdir/$libname.exp"
- $run $rm $export_symbols
- libobjs=$output
- # Append the command to create the export file.
- eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
- fi
-
- # Set up a command to remove the reloadable object files
- # after they are used.
- i=0
- while test "$i" -lt "$k"
- do
- i=`expr $i + 1`
- delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
- done
-
- $echo "creating a temporary reloadable object file: $output"
-
- # Loop through the commands generated above and execute them.
- save_ifs="$IFS"; IFS='~'
- for cmd in $concat_cmds; do
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- libobjs=$output
- # Restore the value of output.
- output=$save_output
-
- if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
- eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
- fi
- # Expand the library linking commands again to reset the
- # value of $libobjs for piecewise linking.
-
- # Do each of the archive commands.
- if test "$module" = yes && test -n "$module_cmds" ; then
- if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
- cmds=$module_expsym_cmds
- else
- cmds=$module_cmds
- fi
- else
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- cmds=$archive_expsym_cmds
- else
- cmds=$archive_cmds
- fi
- fi
-
- # Append the command to remove the reloadable object files
- # to the just-reset $cmds.
- eval cmds=\"\$cmds~\$rm $delfiles\"
- fi
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || {
- lt_exit=$?
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
- fi
-
- exit $lt_exit
- }
- done
- IFS="$save_ifs"
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
-
- if test -n "$convenience"; then
- if test -z "$whole_archive_flag_spec"; then
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- fi
- fi
-
- exit $EXIT_SUCCESS
- fi
-
- # Create links to the real library.
- for linkname in $linknames; do
- if test "$realname" != "$linkname"; then
- $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
- $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
- fi
- done
-
- # If -module or -export-dynamic was specified, set the dlname.
- if test "$module" = yes || test "$export_dynamic" = yes; then
- # On all known operating systems, these are identical.
- dlname="$soname"
- fi
- fi
- ;;
-
- obj)
- case " $deplibs" in
- *\ -l* | *\ -L*)
- $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
- esac
-
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
- fi
-
- if test -n "$rpath"; then
- $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
- fi
-
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
- fi
-
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
- fi
-
- case $output in
- *.lo)
- if test -n "$objs$old_deplibs"; then
- $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
- exit $EXIT_FAILURE
- fi
- libobj="$output"
- obj=`$echo "X$output" | $Xsed -e "$lo2o"`
- ;;
- *)
- libobj=
- obj="$output"
- ;;
- esac
-
- # Delete the old objects.
- $run $rm $obj $libobj
-
- # Objects from convenience libraries. This assumes
- # single-version convenience libraries. Whenever we create
- # different ones for PIC/non-PIC, this we'll have to duplicate
- # the extraction.
- reload_conv_objs=
- gentop=
- # reload_cmds runs $LD directly, so let us get rid of
- # -Wl from whole_archive_flag_spec and hope we can get by with
- # turning comma into space..
- wl=
-
- if test -n "$convenience"; then
- if test -n "$whole_archive_flag_spec"; then
- eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
- reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
- else
- gentop="$output_objdir/${obj}x"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $convenience
- reload_conv_objs="$reload_objs $func_extract_archives_result"
- fi
- fi
-
- # Create the old-style object.
- reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
-
- output="$obj"
- cmds=$reload_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
-
- # Exit if we aren't doing a library object file.
- if test -z "$libobj"; then
- if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
- fi
-
- exit $EXIT_SUCCESS
- fi
-
- if test "$build_libtool_libs" != yes; then
- if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
- fi
-
- # Create an invalid libtool object if no PIC, so that we don't
- # accidentally link it into a program.
- # $show "echo timestamp > $libobj"
- # $run eval "echo timestamp > $libobj" || exit $?
- exit $EXIT_SUCCESS
- fi
-
- if test -n "$pic_flag" || test "$pic_mode" != default; then
- # Only do commands if we really have different PIC objects.
- reload_objs="$libobjs $reload_conv_objs"
- output="$libobj"
- cmds=$reload_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- fi
-
- if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
- fi
-
- exit $EXIT_SUCCESS
- ;;
-
- prog)
- case $host in
- *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
- esac
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
- fi
-
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
- fi
-
- if test "$preload" = yes; then
- if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
- test "$dlopen_self_static" = unknown; then
- $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
- fi
- fi
-
- case $host in
- *-*-rhapsody* | *-*-darwin1.[012])
- # On Rhapsody replace the C library is the System framework
- compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
- finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
- ;;
- esac
-
- case $host in
- *darwin*)
- # Don't allow lazy linking, it breaks C++ global constructors
- if test "$tagname" = CXX ; then
- compile_command="$compile_command ${wl}-bind_at_load"
- finalize_command="$finalize_command ${wl}-bind_at_load"
- fi
- ;;
- esac
-
-
- # move library search paths that coincide with paths to not yet
- # installed libraries to the beginning of the library search list
- new_libs=
- for path in $notinst_path; do
- case " $new_libs " in
- *" -L$path/$objdir "*) ;;
- *)
- case " $compile_deplibs " in
- *" -L$path/$objdir "*)
- new_libs="$new_libs -L$path/$objdir" ;;
- esac
- ;;
- esac
- done
- for deplib in $compile_deplibs; do
- case $deplib in
- -L*)
- case " $new_libs " in
- *" $deplib "*) ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- ;;
- *) new_libs="$new_libs $deplib" ;;
- esac
- done
- compile_deplibs="$new_libs"
-
-
- compile_command="$compile_command $compile_deplibs"
- finalize_command="$finalize_command $finalize_deplibs"
-
- if test -n "$rpath$xrpath"; then
- # If the user specified any rpath flags, then add them.
- for libdir in $rpath $xrpath; do
- # This is the magic to use -rpath.
- case "$finalize_rpath " in
- *" $libdir "*) ;;
- *) finalize_rpath="$finalize_rpath $libdir" ;;
- esac
- done
- fi
-
- # Now hardcode the library paths
- rpath=
- hardcode_libdirs=
- for libdir in $compile_rpath $finalize_rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$perm_rpath " in
- *" $libdir "*) ;;
- *) perm_rpath="$perm_rpath $libdir" ;;
- esac
- fi
- case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
- case :$dllsearchpath: in
- *":$libdir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$libdir";;
- esac
- case :$dllsearchpath: in
- *":$testbindir:"*) ;;
- *) dllsearchpath="$dllsearchpath:$testbindir";;
- esac
- ;;
- esac
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval rpath=\" $hardcode_libdir_flag_spec\"
- fi
- compile_rpath="$rpath"
-
- rpath=
- hardcode_libdirs=
- for libdir in $finalize_rpath; do
- if test -n "$hardcode_libdir_flag_spec"; then
- if test -n "$hardcode_libdir_separator"; then
- if test -z "$hardcode_libdirs"; then
- hardcode_libdirs="$libdir"
- else
- # Just accumulate the unique libdirs.
- case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
- *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
- ;;
- *)
- hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
- ;;
- esac
- fi
- else
- eval flag=\"$hardcode_libdir_flag_spec\"
- rpath="$rpath $flag"
- fi
- elif test -n "$runpath_var"; then
- case "$finalize_perm_rpath " in
- *" $libdir "*) ;;
- *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
- esac
- fi
- done
- # Substitute the hardcoded libdirs into the rpath.
- if test -n "$hardcode_libdir_separator" &&
- test -n "$hardcode_libdirs"; then
- libdir="$hardcode_libdirs"
- eval rpath=\" $hardcode_libdir_flag_spec\"
- fi
- finalize_rpath="$rpath"
-
- if test -n "$libobjs" && test "$build_old_libs" = yes; then
- # Transform all the library objects into standard objects.
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- fi
-
- dlsyms=
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- if test -n "$NM" && test -n "$global_symbol_pipe"; then
- dlsyms="${outputname}S.c"
- else
- $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
- fi
- fi
-
- if test -n "$dlsyms"; then
- case $dlsyms in
- "") ;;
- *.c)
- # Discover the nlist of each of the dlfiles.
- nlist="$output_objdir/${outputname}.nm"
-
- $show "$rm $nlist ${nlist}S ${nlist}T"
- $run $rm "$nlist" "${nlist}S" "${nlist}T"
-
- # Parse the name list into a source file.
- $show "creating $output_objdir/$dlsyms"
-
- test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
-/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
-/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
-
-#ifdef __cplusplus
-extern \"C\" {
-#endif
-
-/* Prevent the only kind of declaration conflicts we can make. */
-#define lt_preloaded_symbols some_other_symbol
-
-/* External symbol declarations for the compiler. */\
-"
-
- if test "$dlself" = yes; then
- $show "generating symbol list for \`$output'"
-
- test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
-
- # Add our own program objects to the symbol list.
- progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
- for arg in $progfiles; do
- $show "extracting global C symbols from \`$arg'"
- $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
- done
-
- if test -n "$exclude_expsyms"; then
- $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
- $run eval '$mv "$nlist"T "$nlist"'
- fi
-
- if test -n "$export_symbols_regex"; then
- $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
- $run eval '$mv "$nlist"T "$nlist"'
- fi
-
- # Prepare the list of exported symbols
- if test -z "$export_symbols"; then
- export_symbols="$output_objdir/$outputname.exp"
- $run $rm $export_symbols
- $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
- case $host in
- *cygwin* | *mingw* )
- $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
- $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
- ;;
- esac
- else
- $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
- $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
- $run eval 'mv "$nlist"T "$nlist"'
- case $host in
- *cygwin* | *mingw* )
- $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
- $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
- ;;
- esac
- fi
- fi
-
- for arg in $dlprefiles; do
- $show "extracting global C symbols from \`$arg'"
- name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
- $run eval '$echo ": $name " >> "$nlist"'
- $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
- done
-
- if test -z "$run"; then
- # Make sure we have at least an empty file.
- test -f "$nlist" || : > "$nlist"
-
- if test -n "$exclude_expsyms"; then
- $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
- $mv "$nlist"T "$nlist"
- fi
-
- # Try sorting and uniquifying the output.
- if grep -v "^: " < "$nlist" |
- if sort -k 3 </dev/null >/dev/null 2>&1; then
- sort -k 3
- else
- sort +2
- fi |
- uniq > "$nlist"S; then
- :
- else
- grep -v "^: " < "$nlist" > "$nlist"S
- fi
-
- if test -f "$nlist"S; then
- eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
- else
- $echo '/* NONE */' >> "$output_objdir/$dlsyms"
- fi
-
- $echo >> "$output_objdir/$dlsyms" "\
-
-#undef lt_preloaded_symbols
-
-#if defined (__STDC__) && __STDC__
-# define lt_ptr void *
-#else
-# define lt_ptr char *
-# define const
-#endif
-
-/* The mapping between symbol names and symbols. */
-"
-
- case $host in
- *cygwin* | *mingw* )
- $echo >> "$output_objdir/$dlsyms" "\
-/* DATA imports from DLLs on WIN32 can't be const, because
- runtime relocations are performed -- see ld's documentation
- on pseudo-relocs */
-struct {
-"
- ;;
- * )
- $echo >> "$output_objdir/$dlsyms" "\
-const struct {
-"
- ;;
- esac
-
-
- $echo >> "$output_objdir/$dlsyms" "\
- const char *name;
- lt_ptr address;
-}
-lt_preloaded_symbols[] =
-{\
-"
-
- eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
-
- $echo >> "$output_objdir/$dlsyms" "\
- {0, (lt_ptr) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
- return lt_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif\
-"
- fi
-
- pic_flag_for_symtable=
- case $host in
- # compiling the symbol table file with pic_flag works around
- # a FreeBSD bug that causes programs to crash when -lm is
- # linked before any other PIC object. But we must not use
- # pic_flag when linking with -static. The problem exists in
- # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
- *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
- case "$compile_command " in
- *" -static "*) ;;
- *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
- esac;;
- *-*-hpux*)
- case "$compile_command " in
- *" -static "*) ;;
- *) pic_flag_for_symtable=" $pic_flag";;
- esac
- esac
-
- # Now compile the dynamic symbol file.
- $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
- $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
-
- # Clean up the generated files.
- $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
- $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
-
- # Transform the symbol file into the correct name.
- case $host in
- *cygwin* | *mingw* )
- if test -f "$output_objdir/${outputname}.def" ; then
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
- else
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
- fi
- ;;
- * )
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
- ;;
- esac
- ;;
- *)
- $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- else
- # We keep going just in case the user didn't refer to
- # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
- # really was required.
-
- # Nullify the symbol file.
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
- fi
-
- if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
- # Replace the output file specification.
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
- link_command="$compile_command$compile_rpath"
-
- # We have no uninstalled library dependencies, so finalize right now.
- $show "$link_command"
- $run eval "$link_command"
- exit_status=$?
-
- # Delete the generated files.
- if test -n "$dlsyms"; then
- $show "$rm $output_objdir/${outputname}S.${objext}"
- $run $rm "$output_objdir/${outputname}S.${objext}"
- fi
-
- exit $exit_status
- fi
-
- if test -n "$shlibpath_var"; then
- # We should set the shlibpath_var
- rpath=
- for dir in $temp_rpath; do
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]*)
- # Absolute path.
- rpath="$rpath$dir:"
- ;;
- *)
- # Relative path: add a thisdir entry.
- rpath="$rpath\$thisdir/$dir:"
- ;;
- esac
- done
- temp_rpath="$rpath"
- fi
-
- if test -n "$compile_shlibpath$finalize_shlibpath"; then
- compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
- fi
- if test -n "$finalize_shlibpath"; then
- finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
- fi
-
- compile_var=
- finalize_var=
- if test -n "$runpath_var"; then
- if test -n "$perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $perm_rpath; do
- rpath="$rpath$dir:"
- done
- compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
- fi
- if test -n "$finalize_perm_rpath"; then
- # We should set the runpath_var.
- rpath=
- for dir in $finalize_perm_rpath; do
- rpath="$rpath$dir:"
- done
- finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
- fi
- fi
-
- if test "$no_install" = yes; then
- # We don't need to create a wrapper script.
- link_command="$compile_var$compile_command$compile_rpath"
- # Replace the output file specification.
- link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
- # Delete the old output file.
- $run $rm $output
- # Link the executable and exit
- $show "$link_command"
- $run eval "$link_command" || exit $?
- exit $EXIT_SUCCESS
- fi
-
- if test "$hardcode_action" = relink; then
- # Fast installation is not supported
- link_command="$compile_var$compile_command$compile_rpath"
- relink_command="$finalize_var$finalize_command$finalize_rpath"
-
- $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
- $echo "$modename: \`$output' will be relinked during installation" 1>&2
- else
- if test "$fast_install" != no; then
- link_command="$finalize_var$compile_command$finalize_rpath"
- if test "$fast_install" = yes; then
- relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
- else
- # fast_install is set to needless
- relink_command=
- fi
- else
- link_command="$compile_var$compile_command$compile_rpath"
- relink_command="$finalize_var$finalize_command$finalize_rpath"
- fi
- fi
-
- # Replace the output file specification.
- link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
-
- # Delete the old output files.
- $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
-
- $show "$link_command"
- $run eval "$link_command" || exit $?
-
- # Now create the wrapper script.
- $show "creating $output"
-
- # Quote the relink command for shipping.
- if test -n "$relink_command"; then
- # Preserve any variables that may affect compiler behavior
- for var in $variables_saved_for_relink; do
- if eval test -z \"\${$var+set}\"; then
- relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
- elif eval var_value=\$$var; test -z "$var_value"; then
- relink_command="$var=; export $var; $relink_command"
- else
- var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
- relink_command="$var=\"$var_value\"; export $var; $relink_command"
- fi
- done
- relink_command="(cd `pwd`; $relink_command)"
- relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
- fi
-
- # Quote $echo for shipping.
- if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
- case $progpath in
- [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
- *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
- esac
- qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
- else
- qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
- fi
-
- # Only actually do things if our run command is non-null.
- if test -z "$run"; then
- # win32 will think the script is a binary if it has
- # a .exe suffix, so we strip it off here.
- case $output in
- *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
- esac
- # test for cygwin because mv fails w/o .exe extensions
- case $host in
- *cygwin*)
- exeext=.exe
- outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
- *) exeext= ;;
- esac
- case $host in
- *cygwin* | *mingw* )
- output_name=`basename $output`
- output_path=`dirname $output`
- cwrappersource="$output_path/$objdir/lt-$output_name.c"
- cwrapper="$output_path/$output_name.exe"
- $rm $cwrappersource $cwrapper
- trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
-
- cat > $cwrappersource <<EOF
-
-/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
- Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-
- The $output program cannot be directly executed until all the libtool
- libraries that it depends on are installed.
-
- This wrapper executable should never be moved out of the build directory.
- If it is, it will not operate correctly.
-
- Currently, it simply execs the wrapper *script* "/bin/sh $output",
- but could eventually absorb all of the scripts functionality and
- exec $objdir/$outputname directly.
-*/
-EOF
- cat >> $cwrappersource<<"EOF"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <malloc.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/stat.h>
-
-#if defined(PATH_MAX)
-# define LT_PATHMAX PATH_MAX
-#elif defined(MAXPATHLEN)
-# define LT_PATHMAX MAXPATHLEN
-#else
-# define LT_PATHMAX 1024
-#endif
-
-#ifndef DIR_SEPARATOR
-# define DIR_SEPARATOR '/'
-# define PATH_SEPARATOR ':'
-#endif
-
-#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
- defined (__OS2__)
-# define HAVE_DOS_BASED_FILE_SYSTEM
-# ifndef DIR_SEPARATOR_2
-# define DIR_SEPARATOR_2 '\\'
-# endif
-# ifndef PATH_SEPARATOR_2
-# define PATH_SEPARATOR_2 ';'
-# endif
-#endif
-
-#ifndef DIR_SEPARATOR_2
-# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
-#else /* DIR_SEPARATOR_2 */
-# define IS_DIR_SEPARATOR(ch) \
- (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
-#endif /* DIR_SEPARATOR_2 */
-
-#ifndef PATH_SEPARATOR_2
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
-#else /* PATH_SEPARATOR_2 */
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
-#endif /* PATH_SEPARATOR_2 */
-
-#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
-#define XFREE(stale) do { \
- if (stale) { free ((void *) stale); stale = 0; } \
-} while (0)
-
-/* -DDEBUG is fairly common in CFLAGS. */
-#undef DEBUG
-#if defined DEBUGWRAPPER
-# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
-#else
-# define DEBUG(format, ...)
-#endif
-
-const char *program_name = NULL;
-
-void * xmalloc (size_t num);
-char * xstrdup (const char *string);
-const char * base_name (const char *name);
-char * find_executable(const char *wrapper);
-int check_executable(const char *path);
-char * strendzap(char *str, const char *pat);
-void lt_fatal (const char *message, ...);
-
-int
-main (int argc, char *argv[])
-{
- char **newargz;
- int i;
-
- program_name = (char *) xstrdup (base_name (argv[0]));
- DEBUG("(main) argv[0] : %s\n",argv[0]);
- DEBUG("(main) program_name : %s\n",program_name);
- newargz = XMALLOC(char *, argc+2);
-EOF
-
- cat >> $cwrappersource <<EOF
- newargz[0] = (char *) xstrdup("$SHELL");
-EOF
-
- cat >> $cwrappersource <<"EOF"
- newargz[1] = find_executable(argv[0]);
- if (newargz[1] == NULL)
- lt_fatal("Couldn't find %s", argv[0]);
- DEBUG("(main) found exe at : %s\n",newargz[1]);
- /* we know the script has the same name, without the .exe */
- /* so make sure newargz[1] doesn't end in .exe */
- strendzap(newargz[1],".exe");
- for (i = 1; i < argc; i++)
- newargz[i+1] = xstrdup(argv[i]);
- newargz[argc+1] = NULL;
-
- for (i=0; i<argc+1; i++)
- {
- DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
- ;
- }
-
-EOF
-
- case $host_os in
- mingw*)
- cat >> $cwrappersource <<EOF
- execv("$SHELL",(char const **)newargz);
-EOF
- ;;
- *)
- cat >> $cwrappersource <<EOF
- execv("$SHELL",newargz);
-EOF
- ;;
- esac
-
- cat >> $cwrappersource <<"EOF"
- return 127;
-}
-
-void *
-xmalloc (size_t num)
-{
- void * p = (void *) malloc (num);
- if (!p)
- lt_fatal ("Memory exhausted");
-
- return p;
-}
-
-char *
-xstrdup (const char *string)
-{
- return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
-;
-}
-
-const char *
-base_name (const char *name)
-{
- const char *base;
-
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- /* Skip over the disk name in MSDOS pathnames. */
- if (isalpha ((unsigned char)name[0]) && name[1] == ':')
- name += 2;
-#endif
-
- for (base = name; *name; name++)
- if (IS_DIR_SEPARATOR (*name))
- base = name + 1;
- return base;
-}
-
-int
-check_executable(const char * path)
-{
- struct stat st;
-
- DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
- if ((!path) || (!*path))
- return 0;
-
- if ((stat (path, &st) >= 0) &&
- (
- /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
-#if defined (S_IXOTH)
- ((st.st_mode & S_IXOTH) == S_IXOTH) ||
-#endif
-#if defined (S_IXGRP)
- ((st.st_mode & S_IXGRP) == S_IXGRP) ||
-#endif
- ((st.st_mode & S_IXUSR) == S_IXUSR))
- )
- return 1;
- else
- return 0;
-}
-
-/* Searches for the full path of the wrapper. Returns
- newly allocated full path name if found, NULL otherwise */
-char *
-find_executable (const char* wrapper)
-{
- int has_slash = 0;
- const char* p;
- const char* p_next;
- /* static buffer for getcwd */
- char tmp[LT_PATHMAX + 1];
- int tmp_len;
- char* concat_name;
-
- DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
-
- if ((wrapper == NULL) || (*wrapper == '\0'))
- return NULL;
-
- /* Absolute path? */
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
- {
- concat_name = xstrdup (wrapper);
- if (check_executable(concat_name))
- return concat_name;
- XFREE(concat_name);
- }
- else
- {
-#endif
- if (IS_DIR_SEPARATOR (wrapper[0]))
- {
- concat_name = xstrdup (wrapper);
- if (check_executable(concat_name))
- return concat_name;
- XFREE(concat_name);
- }
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- }
-#endif
-
- for (p = wrapper; *p; p++)
- if (*p == '/')
- {
- has_slash = 1;
- break;
- }
- if (!has_slash)
- {
- /* no slashes; search PATH */
- const char* path = getenv ("PATH");
- if (path != NULL)
- {
- for (p = path; *p; p = p_next)
- {
- const char* q;
- size_t p_len;
- for (q = p; *q; q++)
- if (IS_PATH_SEPARATOR(*q))
- break;
- p_len = q - p;
- p_next = (*q == '\0' ? q : q + 1);
- if (p_len == 0)
- {
- /* empty path: current directory */
- if (getcwd (tmp, LT_PATHMAX) == NULL)
- lt_fatal ("getcwd failed");
- tmp_len = strlen(tmp);
- concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
- memcpy (concat_name, tmp, tmp_len);
- concat_name[tmp_len] = '/';
- strcpy (concat_name + tmp_len + 1, wrapper);
- }
- else
- {
- concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
- memcpy (concat_name, p, p_len);
- concat_name[p_len] = '/';
- strcpy (concat_name + p_len + 1, wrapper);
- }
- if (check_executable(concat_name))
- return concat_name;
- XFREE(concat_name);
- }
- }
- /* not found in PATH; assume curdir */
- }
- /* Relative path | not found in path: prepend cwd */
- if (getcwd (tmp, LT_PATHMAX) == NULL)
- lt_fatal ("getcwd failed");
- tmp_len = strlen(tmp);
- concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
- memcpy (concat_name, tmp, tmp_len);
- concat_name[tmp_len] = '/';
- strcpy (concat_name + tmp_len + 1, wrapper);
-
- if (check_executable(concat_name))
- return concat_name;
- XFREE(concat_name);
- return NULL;
-}
-
-char *
-strendzap(char *str, const char *pat)
-{
- size_t len, patlen;
-
- assert(str != NULL);
- assert(pat != NULL);
-
- len = strlen(str);
- patlen = strlen(pat);
-
- if (patlen <= len)
- {
- str += len - patlen;
- if (strcmp(str, pat) == 0)
- *str = '\0';
- }
- return str;
-}
-
-static void
-lt_error_core (int exit_status, const char * mode,
- const char * message, va_list ap)
-{
- fprintf (stderr, "%s: %s: ", program_name, mode);
- vfprintf (stderr, message, ap);
- fprintf (stderr, ".\n");
-
- if (exit_status >= 0)
- exit (exit_status);
-}
-
-void
-lt_fatal (const char *message, ...)
-{
- va_list ap;
- va_start (ap, message);
- lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
- va_end (ap);
-}
-EOF
- # we should really use a build-platform specific compiler
- # here, but OTOH, the wrappers (shell script and this C one)
- # are only useful if you want to execute the "real" binary.
- # Since the "real" binary is built for $host, then this
- # wrapper might as well be built for $host, too.
- $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
- ;;
- esac
- $rm $output
- trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
-
- $echo > $output "\
-#! $SHELL
-
-# $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of the build directory.
-# If it is, it will not operate correctly.
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='${SED} -e 1s/^X//'
-sed_quote_subst='$sed_quote_subst'
-
-# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
-if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '\${1+\"\$@\"}'='\"\$@\"'
- setopt NO_GLOB_SUBST
-else
- case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-relink_command=\"$relink_command\"
-
-# This environment variable determines our operation mode.
-if test \"\$libtool_install_magic\" = \"$magic\"; then
- # install mode needs the following variable:
- notinst_deplibs='$notinst_deplibs'
-else
- # When we are sourced in execute mode, \$file and \$echo are already set.
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- echo=\"$qecho\"
- file=\"\$0\"
- # Make sure echo works.
- if test \"X\$1\" = X--no-reexec; then
- # Discard the --no-reexec flag, and continue.
- shift
- elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
- # Yippee, \$echo works!
- :
- else
- # Restart under the correct shell, and then maybe \$echo will work.
- exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
- fi
- fi\
-"
- $echo >> $output "\
-
- # Find the directory that this script lives in.
- thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
- test \"x\$thisdir\" = \"x\$file\" && thisdir=.
-
- # Follow symbolic links until we get to the real thisdir.
- file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
- while test -n \"\$file\"; do
- destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
-
- # If there was a directory component, then change thisdir.
- if test \"x\$destdir\" != \"x\$file\"; then
- case \"\$destdir\" in
- [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
- *) thisdir=\"\$thisdir/\$destdir\" ;;
- esac
- fi
-
- file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
- file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
- done
-
- # Try to get the absolute directory name.
- absdir=\`cd \"\$thisdir\" && pwd\`
- test -n \"\$absdir\" && thisdir=\"\$absdir\"
-"
-
- if test "$fast_install" = yes; then
- $echo >> $output "\
- program=lt-'$outputname'$exeext
- progdir=\"\$thisdir/$objdir\"
-
- if test ! -f \"\$progdir/\$program\" || \\
- { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
- test \"X\$file\" != \"X\$progdir/\$program\"; }; then
-
- file=\"\$\$-\$program\"
-
- if test ! -d \"\$progdir\"; then
- $mkdir \"\$progdir\"
- else
- $rm \"\$progdir/\$file\"
- fi"
-
- $echo >> $output "\
-
- # relink executable if necessary
- if test -n \"\$relink_command\"; then
- if relink_command_output=\`eval \$relink_command 2>&1\`; then :
- else
- $echo \"\$relink_command_output\" >&2
- $rm \"\$progdir/\$file\"
- exit $EXIT_FAILURE
- fi
- fi
-
- $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
- { $rm \"\$progdir/\$program\";
- $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
- $rm \"\$progdir/\$file\"
- fi"
- else
- $echo >> $output "\
- program='$outputname'
- progdir=\"\$thisdir/$objdir\"
-"
- fi
-
- $echo >> $output "\
-
- if test -f \"\$progdir/\$program\"; then"
-
- # Export our shlibpath_var if we have one.
- if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
- $echo >> $output "\
- # Add our own library path to $shlibpath_var
- $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
-
- # Some systems cannot cope with colon-terminated $shlibpath_var
- # The second colon is a workaround for a bug in BeOS R4 sed
- $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
-
- export $shlibpath_var
-"
- fi
-
- # fixup the dll searchpath if we need to.
- if test -n "$dllsearchpath"; then
- $echo >> $output "\
- # Add the dll search path components to the executable PATH
- PATH=$dllsearchpath:\$PATH
-"
- fi
-
- $echo >> $output "\
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- # Run the actual program with our arguments.
-"
- case $host in
- # Backslashes separate directories on plain windows
- *-*-mingw | *-*-os2*)
- $echo >> $output "\
- exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
- ;;
-
- *)
- $echo >> $output "\
- exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
- ;;
- esac
- $echo >> $output "\
- \$echo \"\$0: cannot exec \$program \$*\"
- exit $EXIT_FAILURE
- fi
- else
- # The program doesn't exist.
- \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
- \$echo \"This script is just a wrapper for \$program.\" 1>&2
- $echo \"See the $PACKAGE documentation for more information.\" 1>&2
- exit $EXIT_FAILURE
- fi
-fi\
-"
- chmod +x $output
- fi
- exit $EXIT_SUCCESS
- ;;
- esac
-
- # See if we need to build an old-fashioned archive.
- for oldlib in $oldlibs; do
-
- if test "$build_libtool_libs" = convenience; then
- oldobjs="$libobjs_save"
- addlibs="$convenience"
- build_libtool_libs=no
- else
- if test "$build_libtool_libs" = module; then
- oldobjs="$libobjs_save"
- build_libtool_libs=no
- else
- oldobjs="$old_deplibs $non_pic_objects"
- fi
- addlibs="$old_convenience"
- fi
-
- if test -n "$addlibs"; then
- gentop="$output_objdir/${outputname}x"
- generated="$generated $gentop"
-
- func_extract_archives $gentop $addlibs
- oldobjs="$oldobjs $func_extract_archives_result"
- fi
-
- # Do each command in the archive commands.
- if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
- cmds=$old_archive_from_new_cmds
- else
- # POSIX demands no paths to be encoded in archives. We have
- # to avoid creating archives with duplicate basenames if we
- # might have to extract them afterwards, e.g., when creating a
- # static archive out of a convenience library, or when linking
- # the entirety of a libtool archive into another (currently
- # not supported by libtool).
- if (for obj in $oldobjs
- do
- $echo "X$obj" | $Xsed -e 's%^.*/%%'
- done | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- $echo "copying selected object files to avoid basename conflicts..."
-
- if test -z "$gentop"; then
- gentop="$output_objdir/${outputname}x"
- generated="$generated $gentop"
-
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
- $show "$mkdir $gentop"
- $run $mkdir "$gentop"
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
- exit $exit_status
- fi
- fi
-
- save_oldobjs=$oldobjs
- oldobjs=
- counter=1
- for obj in $save_oldobjs
- do
- objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
- case " $oldobjs " in
- " ") oldobjs=$obj ;;
- *[\ /]"$objbase "*)
- while :; do
- # Make sure we don't pick an alternate name that also
- # overlaps.
- newobj=lt$counter-$objbase
- counter=`expr $counter + 1`
- case " $oldobjs " in
- *[\ /]"$newobj "*) ;;
- *) if test ! -f "$gentop/$newobj"; then break; fi ;;
- esac
- done
- $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
- $run ln "$obj" "$gentop/$newobj" ||
- $run cp "$obj" "$gentop/$newobj"
- oldobjs="$oldobjs $gentop/$newobj"
- ;;
- *) oldobjs="$oldobjs $obj" ;;
- esac
- done
- fi
-
- eval cmds=\"$old_archive_cmds\"
-
- if len=`expr "X$cmds" : ".*"` &&
- test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- cmds=$old_archive_cmds
- else
- # the command line is too long to link in one step, link in parts
- $echo "using piecewise archive linking..."
- save_RANLIB=$RANLIB
- RANLIB=:
- objlist=
- concat_cmds=
- save_oldobjs=$oldobjs
-
- # Is there a better way of finding the last object in the list?
- for obj in $save_oldobjs
- do
- last_oldobj=$obj
- done
- for obj in $save_oldobjs
- do
- oldobjs="$objlist $obj"
- objlist="$objlist $obj"
- eval test_cmds=\"$old_archive_cmds\"
- if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
- test "$len" -le "$max_cmd_len"; then
- :
- else
- # the above command should be used before it gets too long
- oldobjs=$objlist
- if test "$obj" = "$last_oldobj" ; then
- RANLIB=$save_RANLIB
- fi
- test -z "$concat_cmds" || concat_cmds=$concat_cmds~
- eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
- objlist=
- fi
- done
- RANLIB=$save_RANLIB
- oldobjs=$objlist
- if test "X$oldobjs" = "X" ; then
- eval cmds=\"\$concat_cmds\"
- else
- eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
- fi
- fi
- fi
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- eval cmd=\"$cmd\"
- IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- done
-
- if test -n "$generated"; then
- $show "${rm}r$generated"
- $run ${rm}r$generated
- fi
-
- # Now create the libtool archive.
- case $output in
- *.la)
- old_library=
- test "$build_old_libs" = yes && old_library="$libname.$libext"
- $show "creating $output"
-
- # Preserve any variables that may affect compiler behavior
- for var in $variables_saved_for_relink; do
- if eval test -z \"\${$var+set}\"; then
- relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
- elif eval var_value=\$$var; test -z "$var_value"; then
- relink_command="$var=; export $var; $relink_command"
- else
- var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
- relink_command="$var=\"$var_value\"; export $var; $relink_command"
- fi
- done
- # Quote the link command for shipping.
- relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
- relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
- if test "$hardcode_automatic" = yes ; then
- relink_command=
- fi
-
-
- # Only create the output if not a dry run.
- if test -z "$run"; then
- for installed in no yes; do
- if test "$installed" = yes; then
- if test -z "$install_libdir"; then
- break
- fi
- output="$output_objdir/$outputname"i
- # Replace all uninstalled libtool libraries with the installed ones
- newdependency_libs=
- for deplib in $dependency_libs; do
- case $deplib in
- *.la)
- name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
- if test -z "$libdir"; then
- $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
- exit $EXIT_FAILURE
- fi
- newdependency_libs="$newdependency_libs $libdir/$name"
- ;;
- *) newdependency_libs="$newdependency_libs $deplib" ;;
- esac
- done
- dependency_libs="$newdependency_libs"
- newdlfiles=
- for lib in $dlfiles; do
- name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
- if test -z "$libdir"; then
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- exit $EXIT_FAILURE
- fi
- newdlfiles="$newdlfiles $libdir/$name"
- done
- dlfiles="$newdlfiles"
- newdlprefiles=
- for lib in $dlprefiles; do
- name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
- if test -z "$libdir"; then
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- exit $EXIT_FAILURE
- fi
- newdlprefiles="$newdlprefiles $libdir/$name"
- done
- dlprefiles="$newdlprefiles"
- else
- newdlfiles=
- for lib in $dlfiles; do
- case $lib in
- [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
- *) abs=`pwd`"/$lib" ;;
- esac
- newdlfiles="$newdlfiles $abs"
- done
- dlfiles="$newdlfiles"
- newdlprefiles=
- for lib in $dlprefiles; do
- case $lib in
- [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
- *) abs=`pwd`"/$lib" ;;
- esac
- newdlprefiles="$newdlprefiles $abs"
- done
- dlprefiles="$newdlprefiles"
- fi
- $rm $output
- # place dlname in correct position for cygwin
- tdlname=$dlname
- case $host,$output,$installed,$module,$dlname in
- *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
- esac
- $echo > $output "\
-# $outputname - a libtool library file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='$tdlname'
-
-# Names of this library.
-library_names='$library_names'
-
-# The name of the static archive.
-old_library='$old_library'
-
-# Libraries that this one depends upon.
-dependency_libs='$dependency_libs'
-
-# Version information for $libname.
-current=$current
-age=$age
-revision=$revision
-
-# Is this an already installed library?
-installed=$installed
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=$module
-
-# Files to dlopen/dlpreopen
-dlopen='$dlfiles'
-dlpreopen='$dlprefiles'
-
-# Directory that this library needs to be installed in:
-libdir='$install_libdir'"
- if test "$installed" = no && test "$need_relink" = yes; then
- $echo >> $output "\
-relink_command=\"$relink_command\""
- fi
- done
- fi
-
- # Do a symbolic link so that the libtool archive can be found in
- # LD_LIBRARY_PATH before the program is installed.
- $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
- $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
- ;;
- esac
- exit $EXIT_SUCCESS
- ;;
-
- # libtool install mode
- install)
- modename="$modename: install"
-
- # There may be an optional sh(1) argument at the beginning of
- # install_prog (especially on Windows NT).
- if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
- # Allow the use of GNU shtool's install command.
- $echo "X$nonopt" | grep shtool > /dev/null; then
- # Aesthetically quote it.
- arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- install_prog="$arg "
- arg="$1"
- shift
- else
- install_prog=
- arg=$nonopt
- fi
-
- # The real first argument should be the name of the installation program.
- # Aesthetically quote it.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog$arg"
-
- # We need to accept at least all the BSD install flags.
- dest=
- files=
- opts=
- prev=
- install_type=
- isdir=no
- stripme=
- for arg
- do
- if test -n "$dest"; then
- files="$files $dest"
- dest=$arg
- continue
- fi
-
- case $arg in
- -d) isdir=yes ;;
- -f)
- case " $install_prog " in
- *[\\\ /]cp\ *) ;;
- *) prev=$arg ;;
- esac
- ;;
- -g | -m | -o) prev=$arg ;;
- -s)
- stripme=" -s"
- continue
- ;;
- -*)
- ;;
- *)
- # If the previous option needed an argument, then skip it.
- if test -n "$prev"; then
- prev=
- else
- dest=$arg
- continue
- fi
- ;;
- esac
-
- # Aesthetically quote the argument.
- arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
- case $arg in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- arg="\"$arg\""
- ;;
- esac
- install_prog="$install_prog $arg"
- done
-
- if test -z "$install_prog"; then
- $echo "$modename: you must specify an install program" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- if test -n "$prev"; then
- $echo "$modename: the \`$prev' option requires an argument" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- if test -z "$files"; then
- if test -z "$dest"; then
- $echo "$modename: no file or destination specified" 1>&2
- else
- $echo "$modename: you must specify a destination" 1>&2
- fi
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Strip any trailing slash from the destination.
- dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
-
- # Check to see that the destination is a directory.
- test -d "$dest" && isdir=yes
- if test "$isdir" = yes; then
- destdir="$dest"
- destname=
- else
- destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
- test "X$destdir" = "X$dest" && destdir=.
- destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
-
- # Not a directory, so check to see that there is only one file specified.
- set dummy $files
- if test "$#" -gt 2; then
- $echo "$modename: \`$dest' is not a directory" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
- fi
- case $destdir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- for file in $files; do
- case $file in
- *.lo) ;;
- *)
- $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
- done
- ;;
- esac
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- staticlibs=
- future_libdirs=
- current_libdirs=
- for file in $files; do
-
- # Do each installation.
- case $file in
- *.$libext)
- # Do the static libraries later.
- staticlibs="$staticlibs $file"
- ;;
-
- *.la)
- # Check to see that this really is a libtool archive.
- if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- library_names=
- old_library=
- relink_command=
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Add the libdir to current_libdirs if it is the destination.
- if test "X$destdir" = "X$libdir"; then
- case "$current_libdirs " in
- *" $libdir "*) ;;
- *) current_libdirs="$current_libdirs $libdir" ;;
- esac
- else
- # Note the libdir as a future libdir.
- case "$future_libdirs " in
- *" $libdir "*) ;;
- *) future_libdirs="$future_libdirs $libdir" ;;
- esac
- fi
-
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
- test "X$dir" = "X$file/" && dir=
- dir="$dir$objdir"
-
- if test -n "$relink_command"; then
- # Determine the prefix the user has applied to our future dir.
- inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
-
- # Don't allow the user to place us outside of our expected
- # location b/c this prevents finding dependent libraries that
- # are installed to the same prefix.
- # At present, this check doesn't affect windows .dll's that
- # are installed into $libdir/../bin (currently, that works fine)
- # but it's something to keep an eye on.
- if test "$inst_prefix_dir" = "$destdir"; then
- $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
- exit $EXIT_FAILURE
- fi
-
- if test -n "$inst_prefix_dir"; then
- # Stick the inst_prefix_dir data into the link command.
- relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
- else
- relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
- fi
-
- $echo "$modename: warning: relinking \`$file'" 1>&2
- $show "$relink_command"
- if $run eval "$relink_command"; then :
- else
- $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
- exit $EXIT_FAILURE
- fi
- fi
-
- # See the names of the shared library.
- set dummy $library_names
- if test -n "$2"; then
- realname="$2"
- shift
- shift
-
- srcname="$realname"
- test -n "$relink_command" && srcname="$realname"T
-
- # Install the shared library and build the symlinks.
- $show "$install_prog $dir/$srcname $destdir/$realname"
- $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
- if test -n "$stripme" && test -n "$striplib"; then
- $show "$striplib $destdir/$realname"
- $run eval "$striplib $destdir/$realname" || exit $?
- fi
-
- if test "$#" -gt 0; then
- # Delete the old symlinks, and create new ones.
- # Try `ln -sf' first, because the `ln' binary might depend on
- # the symlink we replace! Solaris /bin/ln does not understand -f,
- # so we also need to try rm && ln -s.
- for linkname
- do
- if test "$linkname" != "$realname"; then
- $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
- $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
- fi
- done
- fi
-
- # Do each command in the postinstall commands.
- lib="$destdir/$realname"
- cmds=$postinstall_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || {
- lt_exit=$?
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
- fi
-
- exit $lt_exit
- }
- done
- IFS="$save_ifs"
- fi
-
- # Install the pseudo-library for information purposes.
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- instname="$dir/$name"i
- $show "$install_prog $instname $destdir/$name"
- $run eval "$install_prog $instname $destdir/$name" || exit $?
-
- # Maybe install the static library, too.
- test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
- ;;
-
- *.lo)
- # Install (i.e. copy) a libtool object.
-
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- destfile="$destdir/$destfile"
- fi
-
- # Deduce the name of the destination old-style object file.
- case $destfile in
- *.lo)
- staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
- ;;
- *.$objext)
- staticdest="$destfile"
- destfile=
- ;;
- *)
- $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- # Install the libtool object if requested.
- if test -n "$destfile"; then
- $show "$install_prog $file $destfile"
- $run eval "$install_prog $file $destfile" || exit $?
- fi
-
- # Install the old object if enabled.
- if test "$build_old_libs" = yes; then
- # Deduce the name of the old-style object file.
- staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
-
- $show "$install_prog $staticobj $staticdest"
- $run eval "$install_prog \$staticobj \$staticdest" || exit $?
- fi
- exit $EXIT_SUCCESS
- ;;
-
- *)
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- destfile="$destdir/$destfile"
- fi
-
- # If the file is missing, and there is a .exe on the end, strip it
- # because it is most likely a libtool script we actually want to
- # install
- stripped_ext=""
- case $file in
- *.exe)
- if test ! -f "$file"; then
- file=`$echo $file|${SED} 's,.exe$,,'`
- stripped_ext=".exe"
- fi
- ;;
- esac
-
- # Do a test to see if this is really a libtool program.
- case $host in
- *cygwin*|*mingw*)
- wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
- ;;
- *)
- wrapper=$file
- ;;
- esac
- if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
- notinst_deplibs=
- relink_command=
-
- # Note that it is not necessary on cygwin/mingw to append a dot to
- # foo even if both foo and FILE.exe exist: automatic-append-.exe
- # behavior happens only for exec(3), not for open(2)! Also, sourcing
- # `FILE.' does not work on cygwin managed mounts.
- #
- # If there is no directory component, then add one.
- case $wrapper in
- */* | *\\*) . ${wrapper} ;;
- *) . ./${wrapper} ;;
- esac
-
- # Check the variables that should have been set.
- if test -z "$notinst_deplibs"; then
- $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
- exit $EXIT_FAILURE
- fi
-
- finalize=yes
- for lib in $notinst_deplibs; do
- # Check to see that each library is installed.
- libdir=
- if test -f "$lib"; then
- # If there is no directory component, then add one.
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
- fi
- libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
- if test -n "$libdir" && test ! -f "$libfile"; then
- $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
- finalize=no
- fi
- done
-
- relink_command=
- # Note that it is not necessary on cygwin/mingw to append a dot to
- # foo even if both foo and FILE.exe exist: automatic-append-.exe
- # behavior happens only for exec(3), not for open(2)! Also, sourcing
- # `FILE.' does not work on cygwin managed mounts.
- #
- # If there is no directory component, then add one.
- case $wrapper in
- */* | *\\*) . ${wrapper} ;;
- *) . ./${wrapper} ;;
- esac
-
- outputname=
- if test "$fast_install" = no && test -n "$relink_command"; then
- if test "$finalize" = yes && test -z "$run"; then
- tmpdir=`func_mktempdir`
- file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
- outputname="$tmpdir/$file"
- # Replace the output file specification.
- relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
-
- $show "$relink_command"
- if $run eval "$relink_command"; then :
- else
- $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
- ${rm}r "$tmpdir"
- continue
- fi
- file="$outputname"
- else
- $echo "$modename: warning: cannot relink \`$file'" 1>&2
- fi
- else
- # Install the binary that we compiled earlier.
- file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
- fi
- fi
-
- # remove .exe since cygwin /usr/bin/install will append another
- # one anyway
- case $install_prog,$host in
- */usr/bin/install*,*cygwin*)
- case $file:$destfile in
- *.exe:*.exe)
- # this is ok
- ;;
- *.exe:*)
- destfile=$destfile.exe
- ;;
- *:*.exe)
- destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
- ;;
- esac
- ;;
- esac
- $show "$install_prog$stripme $file $destfile"
- $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
- test -n "$outputname" && ${rm}r "$tmpdir"
- ;;
- esac
- done
-
- for file in $staticlibs; do
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-
- # Set up the ranlib parameters.
- oldlib="$destdir/$name"
-
- $show "$install_prog $file $oldlib"
- $run eval "$install_prog \$file \$oldlib" || exit $?
-
- if test -n "$stripme" && test -n "$old_striplib"; then
- $show "$old_striplib $oldlib"
- $run eval "$old_striplib $oldlib" || exit $?
- fi
-
- # Do each command in the postinstall commands.
- cmds=$old_postinstall_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
- done
-
- if test -n "$future_libdirs"; then
- $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
- fi
-
- if test -n "$current_libdirs"; then
- # Maybe just do a dry run.
- test -n "$run" && current_libdirs=" -n$current_libdirs"
- exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
- else
- exit $EXIT_SUCCESS
- fi
- ;;
-
- # libtool finish mode
- finish)
- modename="$modename: finish"
- libdirs="$nonopt"
- admincmds=
-
- if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
- for dir
- do
- libdirs="$libdirs $dir"
- done
-
- for libdir in $libdirs; do
- if test -n "$finish_cmds"; then
- # Do each command in the finish commands.
- cmds=$finish_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || admincmds="$admincmds
- $cmd"
- done
- IFS="$save_ifs"
- fi
- if test -n "$finish_eval"; then
- # Do the single finish_eval.
- eval cmds=\"$finish_eval\"
- $run eval "$cmds" || admincmds="$admincmds
- $cmds"
- fi
- done
- fi
-
- # Exit here if they wanted silent mode.
- test "$show" = : && exit $EXIT_SUCCESS
-
- $echo "X----------------------------------------------------------------------" | $Xsed
- $echo "Libraries have been installed in:"
- for libdir in $libdirs; do
- $echo " $libdir"
- done
- $echo
- $echo "If you ever happen to want to link against installed libraries"
- $echo "in a given directory, LIBDIR, you must either use libtool, and"
- $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
- $echo "flag during linking and do at least one of the following:"
- if test -n "$shlibpath_var"; then
- $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
- $echo " during execution"
- fi
- if test -n "$runpath_var"; then
- $echo " - add LIBDIR to the \`$runpath_var' environment variable"
- $echo " during linking"
- fi
- if test -n "$hardcode_libdir_flag_spec"; then
- libdir=LIBDIR
- eval flag=\"$hardcode_libdir_flag_spec\"
-
- $echo " - use the \`$flag' linker flag"
- fi
- if test -n "$admincmds"; then
- $echo " - have your system administrator run these commands:$admincmds"
- fi
- if test -f /etc/ld.so.conf; then
- $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
- fi
- $echo
- $echo "See any operating system documentation about shared libraries for"
- $echo "more information, such as the ld(1) and ld.so(8) manual pages."
- $echo "X----------------------------------------------------------------------" | $Xsed
- exit $EXIT_SUCCESS
- ;;
-
- # libtool execute mode
- execute)
- modename="$modename: execute"
-
- # The first argument is the command name.
- cmd="$nonopt"
- if test -z "$cmd"; then
- $echo "$modename: you must specify a COMMAND" 1>&2
- $echo "$help"
- exit $EXIT_FAILURE
- fi
-
- # Handle -dlopen flags immediately.
- for file in $execute_dlfiles; do
- if test ! -f "$file"; then
- $echo "$modename: \`$file' is not a file" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- dir=
- case $file in
- *.la)
- # Check to see that this really is a libtool archive.
- if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
- else
- $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Read the libtool library.
- dlname=
- library_names=
-
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Skip this library if it cannot be dlopened.
- if test -z "$dlname"; then
- # Warn if it was a shared library.
- test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
- continue
- fi
-
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
-
- if test -f "$dir/$objdir/$dlname"; then
- dir="$dir/$objdir"
- else
- if test ! -f "$dir/$dlname"; then
- $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
- exit $EXIT_FAILURE
- fi
- fi
- ;;
-
- *.lo)
- # Just add the directory containing the .lo file.
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$file" && dir=.
- ;;
-
- *)
- $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
- continue
- ;;
- esac
-
- # Get the absolute pathname.
- absdir=`cd "$dir" && pwd`
- test -n "$absdir" && dir="$absdir"
-
- # Now add the directory to shlibpath_var.
- if eval "test -z \"\$$shlibpath_var\""; then
- eval "$shlibpath_var=\"\$dir\""
- else
- eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
- fi
- done
-
- # This variable tells wrapper scripts just to set shlibpath_var
- # rather than running their programs.
- libtool_execute_magic="$magic"
-
- # Check if any of the arguments is a wrapper script.
- args=
- for file
- do
- case $file in
- -*) ;;
- *)
- # Do a test to see if this is really a libtool program.
- if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- # If there is no directory component, then add one.
- case $file in
- */* | *\\*) . $file ;;
- *) . ./$file ;;
- esac
-
- # Transform arg to wrapped name.
- file="$progdir/$program"
- fi
- ;;
- esac
- # Quote arguments (to preserve shell metacharacters).
- file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
- args="$args \"$file\""
- done
-
- if test -z "$run"; then
- if test -n "$shlibpath_var"; then
- # Export the shlibpath_var.
- eval "export $shlibpath_var"
- fi
-
- # Restore saved environment variables
- for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
- do
- eval "if test \"\${save_$lt_var+set}\" = set; then
- $lt_var=\$save_$lt_var; export $lt_var
- fi"
- done
-
- # Now prepare to actually exec the command.
- exec_cmd="\$cmd$args"
- else
- # Display what would be done.
- if test -n "$shlibpath_var"; then
- eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
- $echo "export $shlibpath_var"
- fi
- $echo "$cmd$args"
- exit $EXIT_SUCCESS
- fi
- ;;
-
- # libtool clean and uninstall mode
- clean | uninstall)
- modename="$modename: $mode"
- rm="$nonopt"
- files=
- rmforce=
- exit_status=0
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- for arg
- do
- case $arg in
- -f) rm="$rm $arg"; rmforce=yes ;;
- -*) rm="$rm $arg" ;;
- *) files="$files $arg" ;;
- esac
- done
-
- if test -z "$rm"; then
- $echo "$modename: you must specify an RM program" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- rmdirs=
-
- origobjdir="$objdir"
- for file in $files; do
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$dir" = "X$file"; then
- dir=.
- objdir="$origobjdir"
- else
- objdir="$dir/$origobjdir"
- fi
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
- test "$mode" = uninstall && objdir="$dir"
-
- # Remember objdir for removal later, being careful to avoid duplicates
- if test "$mode" = clean; then
- case " $rmdirs " in
- *" $objdir "*) ;;
- *) rmdirs="$rmdirs $objdir" ;;
- esac
- fi
-
- # Don't error if the file doesn't exist and rm -f was used.
- if (test -L "$file") >/dev/null 2>&1 \
- || (test -h "$file") >/dev/null 2>&1 \
- || test -f "$file"; then
- :
- elif test -d "$file"; then
- exit_status=1
- continue
- elif test "$rmforce" = yes; then
- continue
- fi
-
- rmfiles="$file"
-
- case $name in
- *.la)
- # Possibly a libtool archive, so verify it.
- if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- . $dir/$name
-
- # Delete the libtool libraries and symlinks.
- for n in $library_names; do
- rmfiles="$rmfiles $objdir/$n"
- done
- test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
-
- case "$mode" in
- clean)
- case " $library_names " in
- # " " in the beginning catches empty $dlname
- *" $dlname "*) ;;
- *) rmfiles="$rmfiles $objdir/$dlname" ;;
- esac
- test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
- ;;
- uninstall)
- if test -n "$library_names"; then
- # Do each command in the postuninstall commands.
- cmds=$postuninstall_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd"
- if test "$?" -ne 0 && test "$rmforce" != yes; then
- exit_status=1
- fi
- done
- IFS="$save_ifs"
- fi
-
- if test -n "$old_library"; then
- # Do each command in the old_postuninstall commands.
- cmds=$old_postuninstall_cmds
- save_ifs="$IFS"; IFS='~'
- for cmd in $cmds; do
- IFS="$save_ifs"
- eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd"
- if test "$?" -ne 0 && test "$rmforce" != yes; then
- exit_status=1
- fi
- done
- IFS="$save_ifs"
- fi
- # FIXME: should reinstall the best remaining shared library.
- ;;
- esac
- fi
- ;;
-
- *.lo)
- # Possibly a libtool object, so verify it.
- if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-
- # Read the .lo file
- . $dir/$name
-
- # Add PIC object to the list of files to remove.
- if test -n "$pic_object" \
- && test "$pic_object" != none; then
- rmfiles="$rmfiles $dir/$pic_object"
- fi
-
- # Add non-PIC object to the list of files to remove.
- if test -n "$non_pic_object" \
- && test "$non_pic_object" != none; then
- rmfiles="$rmfiles $dir/$non_pic_object"
- fi
- fi
- ;;
-
- *)
- if test "$mode" = clean ; then
- noexename=$name
- case $file in
- *.exe)
- file=`$echo $file|${SED} 's,.exe$,,'`
- noexename=`$echo $name|${SED} 's,.exe$,,'`
- # $file with .exe has already been added to rmfiles,
- # add $file without .exe
- rmfiles="$rmfiles $file"
- ;;
- esac
- # Do a test to see if this is a libtool program.
- if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
- relink_command=
- . $dir/$noexename
-
- # note $name still contains .exe if it was in $file originally
- # as does the version of $file that was added into $rmfiles
- rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
- if test "$fast_install" = yes && test -n "$relink_command"; then
- rmfiles="$rmfiles $objdir/lt-$name"
- fi
- if test "X$noexename" != "X$name" ; then
- rmfiles="$rmfiles $objdir/lt-${noexename}.c"
- fi
- fi
- fi
- ;;
- esac
- $show "$rm $rmfiles"
- $run $rm $rmfiles || exit_status=1
- done
- objdir="$origobjdir"
-
- # Try to remove the ${objdir}s in the directories where we deleted files
- for dir in $rmdirs; do
- if test -d "$dir"; then
- $show "rmdir $dir"
- $run rmdir $dir >/dev/null 2>&1
- fi
- done
-
- exit $exit_status
- ;;
-
- "")
- $echo "$modename: you must specify a MODE" 1>&2
- $echo "$generic_help" 1>&2
- exit $EXIT_FAILURE
- ;;
- esac
-
- if test -z "$exec_cmd"; then
- $echo "$modename: invalid operation mode \`$mode'" 1>&2
- $echo "$generic_help" 1>&2
- exit $EXIT_FAILURE
- fi
-fi # test -z "$show_help"
-
-if test -n "$exec_cmd"; then
- eval exec $exec_cmd
- exit $EXIT_FAILURE
-fi
-
-# We need to display help for each of the modes.
-case $mode in
-"") $echo \
-"Usage: $modename [OPTION]... [MODE-ARG]...
-
-Provide generalized library-building support services.
-
- --config show all configuration variables
- --debug enable verbose shell tracing
--n, --dry-run display commands without modifying any files
- --features display basic configuration information and exit
- --finish same as \`--mode=finish'
- --help display this help message and exit
- --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
- --quiet same as \`--silent'
- --silent don't print informational messages
- --tag=TAG use configuration variables from tag TAG
- --version print version information
-
-MODE must be one of the following:
-
- clean remove files from the build directory
- compile compile a source file into a libtool object
- execute automatically set library path, then run a program
- finish complete the installation of libtool libraries
- install install libraries or executables
- link create a library or an executable
- uninstall remove libraries from an installed directory
-
-MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
-a more detailed description of MODE.
-
-Report bugs to <bug-libtool@gnu.org>."
- exit $EXIT_SUCCESS
- ;;
-
-clean)
- $echo \
-"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
-
-Remove files from the build directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, object or program, all the files associated
-with it are deleted. Otherwise, only FILE itself is deleted using RM."
- ;;
-
-compile)
- $echo \
-"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-This mode accepts the following additional options:
-
- -o OUTPUT-FILE set the output file name to OUTPUT-FILE
- -prefer-pic try to building PIC objects only
- -prefer-non-pic try to building non-PIC objects only
- -static always build a \`.o' file suitable for static linking
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'."
- ;;
-
-execute)
- $echo \
-"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
-
-Automatically set library path, then run a program.
-
-This mode accepts the following additional options:
-
- -dlopen FILE add the directory containing FILE to the library path
-
-This mode sets the library path environment variable according to \`-dlopen'
-flags.
-
-If any of the ARGS are libtool executable wrappers, then they are translated
-into their corresponding uninstalled binary, and any of their required library
-directories are added to the library path.
-
-Then, COMMAND is executed, with ARGS as arguments."
- ;;
-
-finish)
- $echo \
-"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges. Use
-the \`--dry-run' option if you just want to see what would be executed."
- ;;
-
-install)
- $echo \
-"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command. The first component should be
-either the \`install' or \`cp' program.
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized)."
- ;;
-
-link)
- $echo \
-"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
- -all-static do not do any dynamic linking at all
- -avoid-version do not add a version suffix if possible
- -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
- -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
- -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
- -export-symbols SYMFILE
- try to export only the symbols listed in SYMFILE
- -export-symbols-regex REGEX
- try to export only the symbols matching REGEX
- -LLIBDIR search LIBDIR for required installed libraries
- -lNAME OUTPUT-FILE requires the installed library libNAME
- -module build a library that can dlopened
- -no-fast-install disable the fast-install mode
- -no-install link a not-installable executable
- -no-undefined declare that a library does not refer to external symbols
- -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
- -objectlist FILE Use a list of object files found in FILE to specify objects
- -precious-files-regex REGEX
- don't remove output files matching REGEX
- -release RELEASE specify package release information
- -rpath LIBDIR the created library will eventually be installed in LIBDIR
- -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
- -static do not do any dynamic linking of uninstalled libtool libraries
- -static-libtool-libs
- do not do any dynamic linking of libtool libraries
- -version-info CURRENT[:REVISION[:AGE]]
- specify library version info [each variable defaults to 0]
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename. Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
-only library objects (\`.lo' files) may be specified, and \`-rpath' is
-required, except when creating a convenience library.
-
-If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
-using \`ar' and \`ranlib', or on Windows using \`lib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
-is created, otherwise an executable program is created."
- ;;
-
-uninstall)
- $echo \
-"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM."
- ;;
-
-*)
- $echo "$modename: invalid operation mode \`$mode'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
- ;;
-esac
-
-$echo
-$echo "Try \`$modename --help' for more information about other modes."
-
-exit $?
-
-# The TAGs below are defined such that we never get into a situation
-# in which we disable both kinds of libraries. Given conflicting
-# choices, we go for a static library, that is the most portable,
-# since we can't tell whether shared libraries were disabled because
-# the user asked for that or because the platform doesn't support
-# them. This is particularly important on AIX, because we don't
-# support having both static and shared libraries enabled at the same
-# time on that platform, so we default to a shared-only configuration.
-# If a disable-shared tag is given, we'll fallback to a static-only
-# configuration. But we'll never go from static-only to shared-only.
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
-disable_libs=shared
-# ### END LIBTOOL TAG CONFIG: disable-shared
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-static
-disable_libs=static
-# ### END LIBTOOL TAG CONFIG: disable-static
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
+++ /dev/null
-#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-
-scriptversion=2005-06-08.21
-
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-if test $# -eq 0; then
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
-fi
-
-run=:
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
- configure_ac=configure.ac
-else
- configure_ac=configure.in
-fi
-
-msg="missing on your system"
-
-case "$1" in
---run)
- # Try to run requested program, and just exit if it succeeds.
- run=
- shift
- "$@" && exit 0
- # Exit code 63 means version mismatch. This often happens
- # when the user try to use an ancient version of a tool on
- # a file that requires a minimum version. In this case we
- # we should proceed has if the program had been absent, or
- # if --run hadn't been passed.
- if test $? = 63; then
- run=:
- msg="probably too old"
- fi
- ;;
-
- -h|--h|--he|--hel|--help)
- echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
-
-Options:
- -h, --help display this help and exit
- -v, --version output version information and exit
- --run try to run the given command, and emulate it if it fails
-
-Supported PROGRAM values:
- aclocal touch file \`aclocal.m4'
- autoconf touch file \`configure'
- autoheader touch file \`config.h.in'
- automake touch all \`Makefile.in' files
- bison create \`y.tab.[ch]', if possible, from existing .[ch]
- flex create \`lex.yy.c', if possible, from existing .c
- help2man touch the output file
- lex create \`lex.yy.c', if possible, from existing .c
- makeinfo touch the output file
- tar try tar, gnutar, gtar, then tar without non-portable flags
- yacc create \`y.tab.[ch]', if possible, from existing .[ch]
-
-Send bug reports to <bug-automake@gnu.org>."
- exit $?
- ;;
-
- -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
- echo "missing $scriptversion (GNU Automake)"
- exit $?
- ;;
-
- -*)
- echo 1>&2 "$0: Unknown \`$1' option"
- echo 1>&2 "Try \`$0 --help' for more information"
- exit 1
- ;;
-
-esac
-
-# Now exit if we have it, but it failed. Also exit now if we
-# don't have it and --version was passed (most likely to detect
-# the program).
-case "$1" in
- lex|yacc)
- # Not GNU programs, they don't have --version.
- ;;
-
- tar)
- if test -n "$run"; then
- echo 1>&2 "ERROR: \`tar' requires --run"
- exit 1
- elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
- exit 1
- fi
- ;;
-
- *)
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
- # We have it, but it failed.
- exit 1
- elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
- # Could not run --version or --help. This is probably someone
- # running `$TOOL --version' or `$TOOL --help' to check whether
- # $TOOL exists and not knowing $TOOL uses missing.
- exit 1
- fi
- ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case "$1" in
- aclocal*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`acinclude.m4' or \`${configure_ac}'. You might want
- to install the \`Automake' and \`Perl' packages. Grab them from
- any GNU archive site."
- touch aclocal.m4
- ;;
-
- autoconf)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`${configure_ac}'. You might want to install the
- \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
- archive site."
- touch configure
- ;;
-
- autoheader)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`acconfig.h' or \`${configure_ac}'. You might want
- to install the \`Autoconf' and \`GNU m4' packages. Grab them
- from any GNU archive site."
- files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
- test -z "$files" && files="config.h"
- touch_files=
- for f in $files; do
- case "$f" in
- *:*) touch_files="$touch_files "`echo "$f" |
- sed -e 's/^[^:]*://' -e 's/:.*//'`;;
- *) touch_files="$touch_files $f.in";;
- esac
- done
- touch $touch_files
- ;;
-
- automake*)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
- You might want to install the \`Automake' and \`Perl' packages.
- Grab them from any GNU archive site."
- find . -type f -name Makefile.am -print |
- sed 's/\.am$/.in/' |
- while read f; do touch "$f"; done
- ;;
-
- autom4te)
- echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
- You might have modified some files without having the
- proper tools for further handling them.
- You can get \`$1' as part of \`Autoconf' from any GNU
- archive site."
-
- file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
- test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
- if test -f "$file"; then
- touch $file
- else
- test -z "$file" || exec >$file
- echo "#! /bin/sh"
- echo "# Created by GNU Automake missing as a replacement of"
- echo "# $ $@"
- echo "exit 0"
- chmod +x $file
- exit 1
- fi
- ;;
-
- bison|yacc)
- echo 1>&2 "\
-WARNING: \`$1' $msg. You should only need it if
- you modified a \`.y' file. You may need the \`Bison' package
- in order for those modifications to take effect. You can get
- \`Bison' from any GNU archive site."
- rm -f y.tab.c y.tab.h
- if [ $# -ne 1 ]; then
- eval LASTARG="\${$#}"
- case "$LASTARG" in
- *.y)
- SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
- if [ -f "$SRCFILE" ]; then
- cp "$SRCFILE" y.tab.c
- fi
- SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
- if [ -f "$SRCFILE" ]; then
- cp "$SRCFILE" y.tab.h
- fi
- ;;
- esac
- fi
- if [ ! -f y.tab.h ]; then
- echo >y.tab.h
- fi
- if [ ! -f y.tab.c ]; then
- echo 'main() { return 0; }' >y.tab.c
- fi
- ;;
-
- lex|flex)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a \`.l' file. You may need the \`Flex' package
- in order for those modifications to take effect. You can get
- \`Flex' from any GNU archive site."
- rm -f lex.yy.c
- if [ $# -ne 1 ]; then
- eval LASTARG="\${$#}"
- case "$LASTARG" in
- *.l)
- SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
- if [ -f "$SRCFILE" ]; then
- cp "$SRCFILE" lex.yy.c
- fi
- ;;
- esac
- fi
- if [ ! -f lex.yy.c ]; then
- echo 'main() { return 0; }' >lex.yy.c
- fi
- ;;
-
- help2man)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a dependency of a manual page. You may need the
- \`Help2man' package in order for those modifications to take
- effect. You can get \`Help2man' from any GNU archive site."
-
- file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
- if test -z "$file"; then
- file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
- fi
- if [ -f "$file" ]; then
- touch $file
- else
- test -z "$file" || exec >$file
- echo ".ab help2man is required to generate this page"
- exit 1
- fi
- ;;
-
- makeinfo)
- echo 1>&2 "\
-WARNING: \`$1' is $msg. You should only need it if
- you modified a \`.texi' or \`.texinfo' file, or any other file
- indirectly affecting the aspect of the manual. The spurious
- call might also be the consequence of using a buggy \`make' (AIX,
- DU, IRIX). You might want to install the \`Texinfo' package or
- the \`GNU make' package. Grab either from any GNU archive site."
- # The file to touch is that specified with -o ...
- file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
- if test -z "$file"; then
- # ... or it is the one specified with @setfilename ...
- infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
- file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
- # ... or it is derived from the source name (dir/f.texi becomes f.info)
- test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
- fi
- # If the file does not exist, the user really needs makeinfo;
- # let's fail without touching anything.
- test -f $file || exit 1
- touch $file
- ;;
-
- tar)
- shift
-
- # We have already tried tar in the generic part.
- # Look for gnutar/gtar before invocation to avoid ugly error
- # messages.
- if (gnutar --version > /dev/null 2>&1); then
- gnutar "$@" && exit 0
- fi
- if (gtar --version > /dev/null 2>&1); then
- gtar "$@" && exit 0
- fi
- firstarg="$1"
- if shift; then
- case "$firstarg" in
- *o*)
- firstarg=`echo "$firstarg" | sed s/o//`
- tar "$firstarg" "$@" && exit 0
- ;;
- esac
- case "$firstarg" in
- *h*)
- firstarg=`echo "$firstarg" | sed s/h//`
- tar "$firstarg" "$@" && exit 0
- ;;
- esac
- fi
-
- echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
- You may want to install GNU tar or Free paxutils, or check the
- command line arguments."
- exit 1
- ;;
-
- *)
- echo 1>&2 "\
-WARNING: \`$1' is needed, and is $msg.
- You might have modified some files without having the
- proper tools for further handling them. Check the \`README' file,
- it often tells you about the needed prerequisites for installing
- this package. You may also peek at any GNU archive site, in case
- some other package would contain this missing \`$1' program."
- exit 1
- ;;
-esac
-
-exit 0
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
+++ /dev/null
-#! /bin/sh
-# mkinstalldirs --- make directory hierarchy
-# Author: Noah Friedman <friedman@prep.ai.mit.edu>
-# Created: 1993-05-16
-# Public domain
-
-errstatus=0
-dirmode=""
-
-usage="\
-Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
-
-# process command line arguments
-while test $# -gt 0 ; do
- case "${1}" in
- -h | --help | --h* ) # -h for help
- echo "${usage}" 1>&2; exit 0 ;;
- -m ) # -m PERM arg
- shift
- test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
- dirmode="${1}"
- shift ;;
- -- ) shift; break ;; # stop option processing
- -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
- * ) break ;; # first non-opt arg
- esac
-done
-
-for file
-do
- if test -d "$file"; then
- shift
- else
- break
- fi
-done
-
-case $# in
-0) exit 0 ;;
-esac
-
-case $dirmode in
-'')
- if mkdir -p -- . 2>/dev/null; then
- echo "mkdir -p -- $*"
- exec mkdir -p -- "$@"
- fi ;;
-*)
- if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
- echo "mkdir -m $dirmode -p -- $*"
- exec mkdir -m "$dirmode" -p -- "$@"
- fi ;;
-esac
-
-for file
-do
- set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
- shift
-
- pathcomp=
- for d
- do
- pathcomp="$pathcomp$d"
- case "$pathcomp" in
- -* ) pathcomp=./$pathcomp ;;
- esac
-
- if test ! -d "$pathcomp"; then
- echo "mkdir $pathcomp"
-
- mkdir "$pathcomp" || lasterr=$?
-
- if test ! -d "$pathcomp"; then
- errstatus=$lasterr
- else
- if test ! -z "$dirmode"; then
- echo "chmod $dirmode $pathcomp"
-
- lasterr=""
- chmod "$dirmode" "$pathcomp" || lasterr=$?
-
- if test ! -z "$lasterr"; then
- errstatus=$lasterr
- fi
- fi
- fi
- fi
-
- pathcomp="$pathcomp/"
- done
-done
-
-exit $errstatus
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 3
-# End:
-# mkinstalldirs ends here
+++ /dev/null
-#######################################################################
-# Process this file wth autoconf to produce a configure script.
-#######################################################################
-
-AC_PREREQ(2.50)
-
-# The "-dev" suffix is important to keep because it makes possible to distinguish
-# between a build from official release and a build from git release branch on a
-# machine with no git.
-#
-# NOTE: when releasing the "-dev" suffix needs to be stripped off!
-AC_INIT(gromacs, 4.5.5-dev, [gmx-users@gromacs.org])
-AC_CONFIG_SRCDIR(src/gmxlib/3dview.c)
-AC_CONFIG_AUX_DIR(config)
-AC_CANONICAL_HOST
-
-AM_INIT_AUTOMAKE(tar-ustar)
-AC_PREFIX_DEFAULT(/usr/local/gromacs)
-
-AM_CONFIG_HEADER(src/config.h)
-dnl This is the version info according to the libtool versioning system.
-dnl It does *not* correspond to the release number.
-SHARED_VERSION_INFO="6:0:0"
-AC_SUBST(SHARED_VERSION_INFO)
-
-AC_ENABLE_SHARED
-test "$enable_mpi" = "yes" && AC_DISABLE_SHARED
-PKG_CFLAGS=""
-
-#######################################################################
-# Simple options and makefile variables
-#######################################################################
-
-### Single/Double
-AC_ARG_ENABLE(float,
- [AC_HELP_STRING([--disable-float],
- [Use double instead of single precision])],, enable_float=yes)
-
-AC_ARG_ENABLE(double,
- [AC_HELP_STRING([--enable-double],
- [Same effect as --disable-float])],, enable_double=no)
-if test "$enable_double" = "yes"; then
- enable_float=no;
-fi
-if test "$enable_float" = "no"; then
- AC_DEFINE(GMX_DOUBLE,,[Compile in double precision])
- PKG_CFLAGS="$PKG_CFLAGS -DGMX_DOUBLE"
-fi
-AM_CONDITIONAL([GMX_DOUBLE],[test "$enable_float" = "no"])
-
-
-
-### Fortran or not
-AC_ARG_ENABLE(fortran,
- [AC_HELP_STRING([--enable-fortran],
- [Use Fortran kernels])],,
-[case "${host_cpu}-${host_os}" in
- sparc*-solaris* | alpha*-* | rs6000*-aix* | powerpc*-aix* | mips*-irix*) enable_fortran=yes ;;
- *) enable_fortran=no ;;
- esac])
-# always use CC for linking:
-AC_SUBST(F77LINK,"\$(LINK)")
-
-#On some systems GNU libtool's la files are more confusing for libtool than helpful due to the
-#hard coded paths/libs in the files. And for better linking we have pkg-config files (.pc).
-AC_ARG_ENABLE(la-files,
- [AS_HELP_STRING([--disable-la-files],[Do NOT install GNU libtool's la files])],,
- [enable_la_files=yes])
-AM_CONDITIONAL(NO_LA_FILES,[test "$enable_la_files" = no])
-
-
-
-
-### MPI or not
-AC_ARG_ENABLE(mpi,
- [AC_HELP_STRING([--enable-mpi],
- [Compile for parallel runs using MPI]
- [(instead of threads)])],,enable_mpi=no)
-
-
-### MPI environment
-AC_ARG_ENABLE(mpi-environment,
- [AC_HELP_STRING([--enable-mpi-environment=VAR],
- [Only start parallel runs when VAR is set])],,
-[case "${host_cpu}" in
- mips*-irix*) enable_mpi_environment="MPI_ENVIRONMENT" ;;
- *) enable_mpi_environment=no ;;
-esac])
-if test "$enable_mpi_environment" != "no"; then
- AC_DEFINE_UNQUOTED(GMX_CHECK_MPI_ENV,"$enable_mpi_environment",[If defined, only start MPI runs when this variable is set])
-fi
-
-### MPI_IN_PLACE
-AC_ARG_ENABLE(mpi-in-place,
- [AC_HELP_STRING([--disable-mpi-in-place],
- [Disable MPI_IN_PLACE. For MPI implementations]
- [that have broken support for it ]
- [(some versions of MPICH, for example).])],, enable_mpi_in_place=yes)
-
-
-
-AC_ARG_ENABLE(debug,
- [AC_HELP_STRING([--enable-debug],
- [Add -g to other command line arguments])],,enable_debug=no)
-
-### IA32 assembly code
-AC_ARG_ENABLE(ia32_sse,
- [AC_HELP_STRING([--disable-ia32-sse],
- [Don't build SSE/SSE2 assembly loops on ia32])],,enable_ia32_sse=yes)
-
-case "${host_cpu}-${host_vendor}" in
- i?86-*) ;;
- *) enable_ia32_sse=no ;;
-esac
-
-### AMD64 assembly code
-AC_ARG_ENABLE(x86_64_sse,
- [AC_HELP_STRING([--disable-x86-64-sse],
- [Don't build SSE assembly loops on X86_64])],,enable_x86_64_sse=yes)
-case "${host_cpu}-${host_vendor}" in
- x86_64-* | amd64-*) ;;
- i?86-apple) ;;
- *) enable_x86_64_sse=no ;;
-esac
-
-
-### Altivec on powerpc (motorola)
-AC_ARG_ENABLE(ppc_altivec,
- [AC_HELP_STRING([--disable-ppc-altivec],
- [Don't build Altivec loops on PowerPC])],,enable_ppc_altivec=undef)
-# Power3/4/5 running AIX does not support altivec. We identify this with vendor=IBM.
-# IBM powerpc 970 boxes run linux, and have vendor=unknown.
-if test "$enable_ppc_altivec" = "undef"; then
- case "${host_cpu}-${host_vendor}" in
- ppc*-ibm* | powerpc*-ibm*) enable_ppc_altivec=no ;;
- ppc*-* | powerpc*-*) enable_ppc_altivec=yes ;;
- *) enable_ppc_altivec=no ;;
- esac
-fi
-
-###################################
-## Detect buggy version of gcc
-###################################
-AC_ARG_ENABLE(gcc41_check,
- [AC_HELP_STRING([--disable-gcc41-check],
- [Disable the check for buggy gcc 4.1])],,enable_gcc41_check=yes)
-
-
-
-### ia64 assembly code
-AC_ARG_ENABLE(ia64_asm,
- [AC_HELP_STRING([--enable-ia64-asm],
- [Build assembly loops on ia64])],,enable_ia64_asm=no)
-case "${host_cpu}" in
- ia64) ;;
- *) enable_ia64_asm=no ;;
-esac
-
-
-# IBM Power6-specific optimization
-AC_ARG_ENABLE(power6,
- [AC_HELP_STRING([--enable-power6],
- [Use IBM Power6-specific F77 kernels])],,enable_power6=no)
-if test "$enable_power6" = "yes"; then
- AC_DEFINE(GMX_POWER6,,[Enable IBM Power6-specific F77 kernels])
-fi
-
-AC_ARG_ENABLE(bluegene,
- [AC_HELP_STRING([--enable-bluegene],
- [Build assembly intrinsics kernels on bluegene])],,enable_bluegene=no)
-
-
-### Optimize for host cpu version
-AC_ARG_ENABLE(cpu-optimization,
- [AC_HELP_STRING([--disable-cpu-optimization],
- [No detection or tuning flags for cpu version])],, enable_cpu_optimization=yes)
-
-
-### Do software 1/sqrt(x)
-AC_ARG_ENABLE(software-invsqrt,
- [AC_HELP_STRING([--disable-software-invsqrt],
- [No software 1/sqrt (disabled on sgi,ibm,ia64)])],,
-[case "${host_cpu}-${host_os}" in
- mips*-irix* | rs6000*-aix* | powerpc*-aix | powerpc*-none | ia64*-*) enable_software_invsqrt=no ;;
- *) enable_software_invsqrt=yes ;;
-esac])
-if test "$enable_software_invsqrt" = "yes"; then
- AC_DEFINE(GMX_SOFTWARE_INVSQRT,,[Use the GROMACS software 1/sqrt(x)])
- PKG_CFLAGS="$PKG_CFLAGS -DGMX_SOFTWARE_INVSQRT"
-fi
-AM_CONDITIONAL([GMX_SOFTWARE_INVSQRT],[test "$enable_software_invsqrt" = "yes"])
-
-AC_ARG_ENABLE(fahcore,
- [AC_HELP_STRING([--enable-fahcore],
- [Create a library with mdrun functionality])],, enable_fahcore=no)
-
-
-
-# The four options below used to improve code scheduling, but the newest CPUs can usually rearrange
-# instructions dynamically at runtime, so they might not make much difference now:
-
-
-AC_ARG_ENABLE(all-static,
- [AC_HELP_STRING([--enable-all-static],
- [Make completely static binaries])],, enable_all_static=no)
-# Dont add the -all-static flag until after the compiler test.
-
-
-# FFT libraries - only use one...
-AC_ARG_WITH(fft,
- [AC_HELP_STRING([--with-fft=@<:@fftw3/fftw2/mkl(>=6.0)/fftpack@:>@],
- [FFT library to use. fftw3 is default, fftpack built in.])],,
- with_fft=fftw3)
-
-AC_ARG_ENABLE(fftw-measure,
- [AC_HELP_STRING([--disable-fftw-measure],
- [Dont optimize FFTs. This produces binary exactly]
- [reproducible runs (as the -reprod flag to mdrun),]
- [and if you are using FFTW on x86 and specified its]
- [--enable-sse/sse2 flag (NOT default in FFTW!) the]
- [kernels used are close-to-optimal anyway.])],,
- enable_fftw_measure=yes)
-
-
-AC_ARG_ENABLE(threads,
- [AC_HELP_STRING([--disable-threads],
- [Disable parallel runs using threads])],,enable_threads=yes)
-
-
-### Use external BLAS/LAPACK libraries if the user wants to.
-###
-AC_ARG_WITH(external_blas,
- [AC_HELP_STRING([--with-external-blas],
- [Use system BLAS library (add to LIBS). Automatic on OS X.])],,
-[
-# default action - check if we are on OS X
-case "${host_vendor}-${host_os}" in
- apple-darwin*) with_external_blas="yes" ; extra_LDFLAGS="-framework Accelerate" ;;
- *) with_external_blas="no" ;;
-esac
-])
-AM_CONDITIONAL([GMX_EXTERNAL_BLAS], [test "$with_external_blas" = "yes"])
-
-
-AC_ARG_WITH(external_lapack,
- [AC_HELP_STRING([--with-external-lapack],
- [Use system LAPACK library (add to LIBS). Automatic on OS X.])],,
-[
-# default action - check if we are on OS X
-case "${host_vendor}-${host_os}" in
- apple-darwin*) with_external_lapack="yes" ; extra_LDFLAGS="-framework Accelerate" ;;
- *) with_external_lapack="no" ;;
-esac
-])
-AM_CONDITIONAL([GMX_EXTERNAL_LAPACK], [test "$with_external_lapack" = "yes"])
-
-
-
-
-AC_ARG_WITH(qmmm_gaussian,
- [AC_HELP_STRING([--without-qmmm-gaussian],
- [Use modified Gaussian0x for QM-MM (see website)])],,with_qmmm_gaussian=yes)
-if test "$with_qmmm_gaussian" = "yes"; then
- AC_DEFINE(GMX_QMMM_GAUSSIAN,,[Use (modified) Gaussian0x for QM-MM calculations])
-fi
-
-
-AC_ARG_WITH(qmmm_gamess,
- [AC_HELP_STRING([--without-qmmm-gamess],
- [Use modified Gamess-UK for QM-MM (see website)])],,with_qmmm_gamess=no)
-if test "$with_qmmm_gamess" = "yes"; then
- AC_DEFINE(GMX_QMMM_GAMESS,,[Use (modified) Gamess-UK for QM-MM calculations])
-fi
-
-
-AC_ARG_WITH(qmmm_mopac,
- [AC_HELP_STRING([--without-qmmm-mopac],
- [Use modified Mopac 7 for QM-MM (see website)])],,with_qmmm_mopac=no)
-if test "$with_qmmm_mopac" = "yes"; then
- AC_DEFINE(GMX_QMMM_MOPAC,,[Use (modified) Mopac 7 for QM-MM calculations])
-fi
-
-
-AC_ARG_WITH(qmmm_orca,
- [AC_HELP_STRING([--without-qmmm-orca],
- [Use ORCA for QM-MM])],,with_qmmm_orca=no)
-if test "$with_qmmm_orca"="yes"; then
- AC_DEFINE(GMX_QMMM_ORCA,,[Use ORCA for QM-MM calculations])
-fi
-
-
-AC_ARG_WITH(dlopen,
- [AC_HELP_STRING([--without-dlopen],
- [do not compile with dlopen, needed to read VMD]
- [supported file formats])],,with_dlopen=yes)
-
-
-
-############################################################
-# Add some debug info: Who is building, and on what machine?
-############################################################
-AC_DEFINE_UNQUOTED([BUILD_TIME],["`date`"],[Date and time for build])
-AC_DEFINE_UNQUOTED([BUILD_USER],["`whoami`@`hostname`"],[User doing build])
-AC_DEFINE_UNQUOTED([BUILD_MACHINE],["`uname -srm`"],[Hardware and OS version for build host])
-
-
-############################################################
-# Checks for requirements for version information generation
-############################################################
-generate_version=no
-if test -d $srcdir/.git ; then
- AC_CHECK_PROG(have_git, git, yes, no)
- if test "$have_git" = "yes" ; then
- AC_MSG_CHECKING(for a recent enough git)
- if git --git-dir=$srcdir/.git rev-list -n1 --pretty=format:%cd HEAD | grep "Mon\|Tue\|Wed\|Thu\|Fri\|Sat\|Sun" >/dev/null 2>&1; then
- AC_MSG_RESULT(yes)
- generate_version=yes
- AC_DEFINE(USE_VERSION_H,,[Use generated version info])
- else
- AC_MSG_RESULT(no)
- fi
- fi
- if test "$generate_version" = "no" ; then
- AC_MSG_WARN([No compatible git version found, won't be able to generate proper development version information.])
- fi
-fi
-AM_CONDITIONAL([USE_VERSION_H],[test "$generate_version" = "yes"])
-
-
-############################################################
-# Checks for programs
-############################################################
-
-# normally we use the default compiler, but on alpha/linux we try the compaq ones first
-case "${host_cpu}-${host_os}" in
- alpha*-linux*)
- cc_names="ccc cc gcc"
- f77_names="fort f77 gfortran g77"
- ;;
- *)
- cc_names="cc icc xlc gcc"
- f77_names="f77 ifort xlf xlf77 cf77 fl32 gfortran g77 fort77 f90 xlf90 pgf77 cf77 fort fort77 pgf90"
- ;;
-esac
-# the (non-mpi) c compiler, which is also used for programs executed during build stage
-AC_PROG_CC( $cc_names )
-# Check for environment variable CC_FOR_BUILD before overwriting it
-if test -z "$CC_FOR_BUILD"; then
- CC_FOR_BUILD=$CC
-fi
-
-if test "$enable_gcc41_check" = "yes"; then
- if $CC --version 2>&1 | grep 'gcc.* 4\.1' > /dev/null 2>&1; then
- AC_MSG_ERROR([Uh-oh. Your compilers appears to be GCC version 4.1, which unfortunately produces]
-[buggy code at high optimimzation levels. It would be a good idea to update or]
-[use a different compiler. If you are ABSOLUTELY sure what you are doing, you]
-[can override this check with --disable-gcc41-check.])
- fi
-fi
-
-
-
-AC_SUBST(CC_FOR_BUILD)
-
-if test "$enable_fortran" = "yes" -o "$enable_power6" = "yes"; then
- AC_PROG_F77( $f77_names )
- if test -z "$F77"; then
- AC_MSG_ERROR([No fortran compiler found])
- fi
-fi
-
-AM_PROG_AS( $CC )
-
-# if we are using mpi, also get an MPICC. We cannot set that in the PROG_CC macro
-# above, since autoconf checks that the created file can be executed. This would
-# fail on platforms where MPI executables can only be run through a batchqueue.
-
-if test "$enable_mpi" = "yes"; then
- enable_threads="no"
- AC_CHECK_PROGS(MPICC, mpxlc mpicc mpcc hcc, $CC)
-# now change the normal cc to the MPI one - see the comment above.
- CC=$MPICC
- CXX=$MPICC
- AC_MSG_CHECKING([whether the MPI cc command works]) # be paranoid
- AC_TRY_LINK([#include <mpi.h>],[int argc; char **argv; MPI_Init(&argc,&argv);],
-AC_MSG_RESULT([yes]),AC_MSG_ERROR([Cannot compile and link MPI code with $CC]))
- AC_DEFINE(GMX_MPI,,[Make a parallel version of GROMACS using MPI])
- AC_DEFINE(GMX_LIB_MPI,,[Use a real MPI library])
- PKG_CFLAGS="$PKG_CFLAGS -DGMX_LIB_MPI"
-
- if test "$enable_mpi_in_place" = "yes"; then
- # not all MPIs support MPI_IN_PLACE:
- AC_MSG_CHECKING([for MPI_IN_PLACE in collective operations])
- AC_TRY_COMPILE([
-#include <mpi.h>
-void test(void)
-{
- void *buf;
- MPI_Allreduce(MPI_IN_PLACE, buf, 10, MPI_FLOAT, MPI_SUM, MPI_COMM_WORLD);
-}
- ],,[
- AC_MSG_RESULT([yes])
- AC_DEFINE(MPI_IN_PLACE_EXISTS,[],[MPI_IN_PLACE available for collective operations])
- ],[
- AC_MSG_RESULT([no])
- ])
- fi
-
-# on the cray xt3 we have to tell autoconf that we
-# are actually cross-compiling even if the architecture
-# of host and target are the same. so we enforce
-# cross-compilation if __QK_USER__ is defined
- AC_MSG_CHECKING([for catamount])
- AC_TRY_COMPILE([
-#if defined __QK_USER__
-#else
-#error not catamount
-#endif
-],,[
- AC_MSG_RESULT([yes])
- cross_compiling=yes
- AC_DEFINE(GMX_CRAY_XT3,[],[Enable special hacks for Cray XT3])
- PKG_CFLAGS="$PKG_CFLAGS -DGMX_CRAY_XT3"
- AC_DEFINE(GMX_NO_SYSTEM,[],[Ignore calls to system(3)])
- AC_DEFINE(GMX_NO_NICE,[],[Ignore calls to nice(3)])
- AC_DEFINE(GMX_BROKEN_CALLOC,[],[Don't use calloc(3)])
- extra_LDFLAGS="$extra_LDFLAGS -lgmalloc -lacml"
-],[
- AC_MSG_RESULT([no])
-])
-# end of "$enable_mpi" = "yes"
-fi
-
-
-AH_TEMPLATE([F77_OR_C_FUNC],
- [Set to F77_FUNC(name,NAME) if Fortran used, otherwise 'name' for C.])
-AH_TEMPLATE([F77_OR_C_FUNC_],
- [Set to F77_FUNC_(name,NAME) if Fortran used, otherwise 'name' for C.])
-
-
-
-if test "$enable_fortran" = "yes" -o "$enable_power6" = "yes"; then
- AC_F77_LIBRARY_LDFLAGS
- AC_F77_WRAPPERS
- AC_DEFINE([F77_OR_C_FUNC(name,NAME)],[F77_FUNC(name,NAME)])
- AC_DEFINE([F77_OR_C_FUNC_(name,NAME)],[F77_FUNC_(name,NAME)])
-else
- AC_DEFINE([F77_OR_C_FUNC(name,NAME)],[name])
- AC_DEFINE([F77_OR_C_FUNC_(name,NAME)],[name])
-fi
-
-
-
-AC_PROG_CPP
-# Needed by libtool scripts?
-AC_PROG_EGREP
-AC_PROG_LN_S
-
-if test "$enable_cpu_optimization" = "yes"; then
- ACX_DETECT_GMXCPU
-else
- gmxcpu=""
-fi
-ACX_COMPILER_MAXOPT
-
-
-# We've postponed the threads check because we need to check with the right
-# compilers/flags
-SAVED_LIBS="$LIBS"
-if test "$enable_threads" = "yes"; then
- if test "$enable_mpi" = "yes"; then
- AC_MSG_ERROR([Cannot use both threads and MPI - yet.])
- fi
- if test "$with_fft" = "fftw2"; then
- AC_MSG_ERROR([fftw2 can't be used with threads. Use fftw3 or mkl.])
- fi
- if test "$enable_fortran" = "yes"; then
- AC_MSG_ERROR([FORTRAN is incompatible with threads and only provides a speed-up on certain IBM compilers. Use --disable-threads if you really want to use FORTRAN kernels.])
- fi
- AC_CHECK_HEADERS(unistd.h)
- AC_CHECK_HEADERS(sys/time.h)
- AC_CHECK_HEADERS(sched.h)
- AC_CHECK_FUNCS(sysconf)
-
- # for now we just assume pthreads
- ACX_PTHREAD(,AC_MSG_ERROR([Cannot find POSIX threads - required for thread support using configure!]))
- LIBS="$PTHREAD_LIBS $LIBS"
- CFLAGS="$CFLAGS $PTHREAD_CFLAGS -I$srcdir/include"
- CXXFLAGS="$CXXFLAGS $PTHREAD_CFLAGS -I$srcdir/include"
- CC="$PTHREAD_CC "
- AC_DEFINE(THREAD_PTHREADS,,[Use pthreads for multithreading])
-
- # profiling
- AC_ARG_ENABLE(tmpi-profiling,
- [AC_HELP_STRING([--enable-tmpi-profiling],
- [Enables profiling of thread_mpi calls and wait times])],,
- enable_tmpi_profiling=no)
- if test "x$enable_tmpi_profiling" = "xyes"; then
- AC_DEFINE(TMPI_PROFILE,,[Enable profiling for call and wait times])
- fi
-
- # check the atomics
- AC_MSG_CHECKING(if atomic operations are supported)
- CFLAGS_RET="$CFLAGS"
- CXXFLAGS_RET="$CXXFLAGS"
- CFLAGS="$CFLAGS -I$srcdir/include -DTMPI_CHECK_ATOMICS"
- CXXFLAGS="$CXXFLAGS -I$srcdir/include -DTMPI_CHECK_ATOMICS"
- # this sets a variable 'tmpi_atomics' to 'yes' if there are atomics.
- AC_COMPILE_IFELSE([#include "thread_mpi/atomic.h" ],
- [AC_MSG_RESULT(yes); tmpi_atomics=yes],
- [AC_MSG_WARN(
-[No atomics.
-
-This compiler+CPU combination doesn't have working atomics.
-Thread support will be unbearably slow: disable threads.
-
-Atomics should work on all but the most obscure CPU+compiler combinations;
-if your system is not obscure -- like, for example, x86 with gcc -- please
-contact the developers.
-]); tmpi_atomics=no])
-
-
- # pthread_setaffinity
- AC_MSG_CHECKING(if pthread_setaffinity_np is available)
- AC_COMPILE_IFELSE([#define _GNU_SOURCE
-#include <pthread.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <errno.h>
-int main(void)
-{
- cpu_set_t set;
- CPU_ZERO(&set);
- CPU_SET(0, &set);
- pthread_setaffinity_np(pthread_self(), sizeof(set), &set);
- return 0;
-}],
- [AC_MSG_RESULT(yes); pthread_setaffinity=yes],
- [AC_MSG_RESULT(no); pthread_setaffinity=no] )
-
- if test "x$pthread_setaffinity" = "xyes"; then
- AC_DEFINE(HAVE_PTHREAD_SETAFFINITY,1,[pthread_setaffinity_np is available])
- fi
-
- CFLAGS="$CFLAGS_RET"
- CXXFLAGS="$CXXFLAGS_RET"
-
- AC_DEFINE(GMX_THREADS,,[Use threads for parallelization])
- PKG_CFLAGS="$PKG_CFLAGS -DGMX_THREADS"
- AC_DEFINE(GMX_MPI,,[Make a parallel version of GROMACS using MPI])
- AM_CONDITIONAL(THREAD_PARALLEL,true)
-else
- AM_CONDITIONAL(THREAD_PARALLEL,false)
-fi
-LIBS="$SAVED_LIBS"
-
-
-
-#############
-# Check integer endian
-#############
-AC_C_BIGENDIAN([AC_DEFINE([GMX_INTEGER_BIG_ENDIAN],,[Integer byte order is big endian.])],[],[
-AC_MSG_ERROR([Cannot determine endian in compiled output])])
-# Little endian implied if GMX_INTEGER_BIG_ENDIAN not defined in source.
-
-#############
-# Make sure size_t can hold pointers.
-# On some Nec machines, you reportedly need to specify a flag for size_t to be 64 bits wide.
-#############
-AC_MSG_CHECKING([that size_t can hold pointers])
-AC_TRY_COMPILE([
-#include <stdlib.h>
-#include <stddef.h>
-],[int chk[sizeof(size_t)-sizeof(int *)+1];],AC_MSG_RESULT([yes]),[
- AC_MSG_ERROR([size_t is smaller than int*. Check if your compiler needs a flag to make it 64 bit.])])
-
-
-#############
-# Check that SIGUSR1 is defined
-#############
-AC_MSG_CHECKING([for SIGUSR1])
-AC_TRY_COMPILE([#include <signal.h>],[int i=SIGUSR1;],[
-AC_MSG_RESULT([yes])
-AC_DEFINE(HAVE_SIGUSR1,,[SIGUSR1 supported and defined])
-],AC_MSG_RESULT([no]))
-
-#############
-# Check if pipes are supported
-#############
-AC_MSG_CHECKING([for pipes])
-AC_TRY_COMPILE([#include <stdio.h>],[
-FILE *pipe=popen("/tmp/pipe","r");
-],[
-AC_MSG_RESULT([yes])
-AC_DEFINE(HAVE_PIPES,,[Pipes (popen/pclose) supported])
-],AC_MSG_RESULT([no]))
-
-
-
-#############
-# Check floating-point format and endian
-#############
-ACX_FLOAT_FORMAT
-
-
-AC_PROG_INSTALL
-AC_PROG_LN_S
-AC_PROG_MAKE_SET
-AC_LIBTOOL_WIN32_DLL
-AC_LIBTOOL_DLOPEN
-AC_PROG_LIBTOOL
-AC_SYS_LARGEFILE
-#
-# Use our own version of AC_FUNC_FSEEKO from autoconf 2.63 instead
-# of the broken one we might get from autoconf 2.61.
-ACX_FUNC_FSEEKO_FIXED
-
-
-
-
-############################################################################
-# Checks for libraries.
-############################################################################
-#
-# Don't add math library for intel compilers
-if $CC -V 2>&1 | grep 'Intel Corporation' > /dev/null 2>&1; then
- AC_MSG_NOTICE([Using built-in math library with intel compiler])
-else
- AC_CHECK_LIB(m,sqrt,,AC_MSG_ERROR([No math library found]))
-fi
-
-#####
-# Disable MASS support for now.
-#####
-
-#save current LIBS
-SAVED_LIBS="$LIBS"
-
-#set empty defaults
-PKG_FFT=""
-FFT_LIBS=""
-case "$with_fft" in
-fftw2)
- if test "$enable_float" = "yes"; then
- sizeof_real=4
- else
- sizeof_real=8
- fi
- ACX_CHECK_FFTW2(fftw,$sizeof_real)
- ACX_CHECK_FFTW2(rfftw,$sizeof_real)
- FFT_LIBS="-lfftw -lrfftw"
-
- case ${ac_fftw_savedprefix} in
- d) AC_DEFINE(FFTW2_NAME_DFFTW,,[Use the d prefix on fftw2 includes]) ;;
- s) AC_DEFINE(FFTW2_NAME_SFFTW,,[Use the s prefix on fftw2 includes]) ;;
- *) AC_DEFINE(FFTW2_NAME_FFTW,,[Dont use any prefix on fftw2 includes]) ;;
- esac
-
- AC_DEFINE(GMX_FFT_FFTW2,,[Use FFTW2 FFT library])
-
- ;; # end of fftw2 check
-
-fftw3) # Much simpler check than fftw2
-# Check for header <fftw3.h> AC_CHECK_HEADERS doesnt work, since we must
-# use mpicc to get includes - cpp isnt always the same compiler.
-AC_MSG_CHECKING([for fftw3.h])
-AC_TRY_COMPILE([#include<fftw3.h>],,[
-# ok, look for library file too
-AC_MSG_RESULT(yes)
-if test "$enable_float" = "yes"; then
- AC_CHECK_LIB([fftw3f],main,,AC_MSG_ERROR([Cannot find fftw3f library]))
- PKG_FFT="fftw3f"
- FFT_LIBS="-lfftw3f"
-else
- AC_CHECK_LIB([fftw3],main,,AC_MSG_ERROR([Cannot find fftw3 library]))
- PKG_FFT="fftw3"
- FFT_LIBS="-lfftw3"
-fi
- AC_DEFINE(GMX_FFT_FFTW3,,[Use FFTW3 FFT library])
-],[
-# not ok, echo a warning
-AC_MSG_ERROR(
-[Cannot find the default external FFT library (fftw3).
-Other alternatives are 'fftw2', or 'mkl' for Intel MKL.
-You are STRONGLY recommended to use one of these - fftw is free.
-
-Use CPPFLAGS and LDFLAGS if the library is installed in a
-non-standard location. (see FAQ at http://www.gromacs.org)
-
-If you dont care about performance you can also specify 'fftpack'
-to use a slower set of FFTs built into Gromacs.
-(Just install FFTW3 unless you really know what you are doing).
-])
-])
- ;;
-
-mkl*)
-###########
-# Intel Math Kernel Library version 6 and later.
-##########
-AC_MSG_CHECKING([for mkl_dfti.h])
-AC_TRY_COMPILE([#include<mkl_dfti.h>],,AC_MSG_RESULT(yes),AC_MSG_ERROR([Cannot find mkl_dfti.h header from Intel Math Kernel Library>=6.0.]\
-))
-## Check for library
-# AC_CHECK_LIB([guide],main,,AC_MSG_ERROR([Cannot find libguide (Intel MKL)]))
-# AC_CHECK_LIB([mkl],DftiComputeForward,,
-# AC_MSG_ERROR([Cannot find Intel Math Kernel Library >= 6.0]))
- # first check for older MKLs
- AC_CHECK_LIB([mkl],DftiComputeForward,,[have_mkl="no"])
- if test "$have_mkl" = "no"; then
- # we assume it's a new MKL
- LIBS="$LIBS -liomp5 -lmkl_sequential -lmkl_core"
- LMKL=" -liomp5 -lmkl_sequential -lmkl_core"
- AC_CHECK_LIB([mkl_intel_lp64],DftiComputeForward,,[have_mkl10_64="no"])
- FFT_LIBS="$LMKL -lmkl_intel_lp64"
- if test "$have_mkl10_64" = "no"; then
- AC_CHECK_LIB([mkl_intel],DftiComputeForward,,[have_mkl10_32="no"])
- FFT_LIBS="$LMKL -lmkl_intel"
- if test "$have_mkl10_32" = "no"; then
- AC_MSG_ERROR([Cannot find Intel Math Kernel Library >= 6.0])
- fi
- fi
- fi
- AC_DEFINE(GMX_FFT_MKL,,[Use Intel MKL FFT library])
- AC_SUBST(LMKL)
- ;;
-
-fftpack | no)
- AC_MSG_WARN([The built-in FFTPACK routines are slow.
-Are you sure you don't want to use FFTW? It is free and much faster...])
- AC_DEFINE(GMX_FFT_FFTPACK,,[Use Built-in FFTPACK FFT library])
- ;;
-*)
- AC_MSG_ERROR([Unknown FFT library])
- ;;
-esac
-#restore LIBS from before fft check
-LIBS="$SAVED_LIBS"
-
-#only fftw3 has support for pkg-config
-AC_SUBST(PKG_FFT)
-if test -z "${PKG_FFT}"; then
- AC_SUBST(PKG_FFT_LIBS,"$FFT_LIBS")
-else
- AC_SUBST(PKG_FFT_LIBS,"")
-fi
-#flag for Makefile
-AC_SUBST(FFT_LIBS)
-
-if test "$enable_fftw_measure" != "yes"; then
- AC_DEFINE(GMX_DISABLE_FFTW_MEASURE,,[Do not optimize FFTW setups (not needed with SSE FFT kernels)])
-fi
-
-######
-# check for xtc headers
-case "${host_os}" in
-cygwin* | mingw*) # use our own xdr stuff for cygwin/mingw
- ;;
-*)
- AC_CHECK_HEADERS([rpc/rpc.h])
- AC_CHECK_HEADERS([rpc/xdr.h],,,
-[#if HAVE_RPC_RPC_H
-# include <rpc/rpc.h>
-#endif
-])
- AC_CHECK_LIB(nsl,xdr_float)
- AC_TRY_LINK([
-#if HAVE_RPC_RPC_H
-#include<rpc/rpc.h>
-#else
-#error NO rpc.h header
-#endif
-#if HAVE_RPC_XDR_H
-#include<rpc/xdr.h>
-#else
-#error No xdr.h header
-#endif
-],[ XDR *xd; float f; xdr_float(xd,&f);],[have_xdr="yes"])
-
- if test "$have_xdr" != "yes"; then
- AC_DEFINE(GMX_INTERNAL_XDR,,[Use our own instead of system XDR libraries])
- PKG_CFLAGS="$PKG_CFLAGS -DGMX_INTERNAL_XDR"
- AC_MSG_WARN([Couldn't find XDR headers and/or libraries - using our own])
- fi
- ;;
-esac
-
-
-########################################################################
-# Checks for header files and types
-########################################################################
-
-AC_CHECK_HEADERS([limits.h unistd.h],,AC_MSG_ERROR([Include headers not found]))
-AC_CHECK_HEADERS(unistd.h)
-AC_CHECK_HEADERS(direct.h)
-AC_CHECK_HEADERS(sys/types.h)
-AC_CHECK_HEADERS(sys/time.h)
-AC_CHECK_HEADERS(dirent.h,,[AC_MSG_WARN(
-[
-********************************************************************
-* WARNING! We could not find the header file dirent.h *
-* *
-* Without this header, we will not be able to scan directories for *
-* files, which completely breaks pdb2gmx. You will still be able *
-* to run simulations, but you cannot prepare input data. *
-* dirent.h is part of the POSIX 2001-1 standard, and should be *
-* present on all UNIX-like systems, CygWin, and MinGW. *
-********************************************************************])])
-## NOTE: On native windows we do not use configure.ac
-AC_CHECK_HEADERS(regex.h,,[AC_MSG_WARN(
-[No regex.h found.
-Regular expression matching in selections will be disabled.
-Selections still work, but the default groups can differ from
-those obtained with regular expressions enabled.
-Consider installing the regular expression library from GNU libc.])])
-
-
-
-#####
-# Checks for additional and/or optional functions or libraries.
-#AC_FUNC_MALLOC
-AC_FUNC_MEMCMP
-AC_TYPE_SIGNAL
-AC_TYPE_OFF_T
-AC_FUNC_VPRINTF
-AM_WITH_DMALLOC
-AC_CHECK_FUNCS(strcasecmp)
-AC_CHECK_FUNCS(strdup)
-AC_CHECK_FUNCS(gettimeofday)
-AC_CHECK_FUNCS(cbrt)
-AC_CHECK_FUNCS(isnan)
-AC_CHECK_FUNCS(_isnan)
-AC_CHECK_FUNCS(isfinite)
-AC_CHECK_FUNCS(_isfinite)
-AC_CHECK_FUNCS(fsync)
-AC_CHECK_FUNCS(fileno)
-
-# check for bool (must come late, since CFLAGS/includes might affect it)
-AC_CHECK_TYPES([bool])
-AC_SEARCH_LIBS(posix_memalign, c, AC_DEFINE(HAVE_POSIX_MEMALIGN, 1, Define to 1 if you have the posix_memalign function))
-AC_SEARCH_LIBS(memalign, c, AC_DEFINE(HAVE_MEMALIGN, 1, Define to 1 if you have the memalign function))
-AC_CHECK_FUNCS(_aligned_malloc)
-#AC_SEARCH_LIBS(_aligned_malloc, c, AC_DEFINE(HAVE__ALIGNED_MALLOC, 1, Define to 1 if you have the _aligned_malloc function))
-
-
-
-
-
-
-#############
-# Check integer sizes, set to zero if e.g. long long is not supported.
-# (Note: this must come *after* type checks for the corresponding types!)
-#############
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(long int)
-AC_CHECK_SIZEOF(long long int)
-AC_CHECK_SIZEOF(off_t)
-AC_CHECK_SIZEOF(void*)
-
-
-
-# Apple OS X is a bit strange/braindead in that it always reports itself as i386, both for
-# 32 and 64 bit builds (even with the 64 bit kernel!).
-#
-# To get the SSE support right we check for the size of void * that we detected above...
-case "${host_vendor}-${host_os}" in
- apple-darwin*)
- if test $ac_cv_sizeof_voidp = 8; then
- enable_ia32_sse=no;
- else
- enable_x86_64_sse=no;
- fi
- ;;
- *) ;;
-esac
-
-
-
-
-#####
-# Look for X
-AC_PATH_XTRA
-if test "$no_x" != "yes"; then
- AM_CONDITIONAL(USE_X11,true)
-else
- AM_CONDITIONAL(USE_X11,false)
-fi
-
-# GNU Scientific Library or not
-AC_ARG_WITH(gsl,
- [AC_HELP_STRING([--with-gsl],[Link to the GNU scientific library, ]
- [enables extra functions in analysis])],,with_gsl=no)
-
-######
-PKG_GSL=""
-GSL_LIBS=""
-if test "$with_gsl" = "yes"; then
- SAVED_LIBS="$LIBS"
- AC_CHECK_HEADERS([gsl/gsl_version.h],[
-# header found, check for libraries
- AC_CHECK_LIB(gslcblas,main,[
-# gslcblas library found, check main lib
- AC_CHECK_LIB(gsl,main,[
-# everything need for gsl found
- GSL_LIBS="-lgsl -lgslcblas"
-#gsl has pkg-config support
- PKG_GSL="gsl"
- AC_DEFINE(HAVE_LIBGSL,1,[Do we have libgsl])
- ],[:],[-lgslcblas])])])
- LIBS="$SAVED_LIBS"
-#
-fi
-AC_SUBST(PKG_GSL)
-AC_SUBST(GSL_LIBS)
-
-AC_ARG_WITH(xml,
- [AC_HELP_STRING([--without-xml],[do not link to the xml2 library,]
- [disallows the use of certain file formats])],,with_xml=yes)
-
-#########
-# Check for libxml2, but it is optional, so dont stop
-# if it isnt there.
-PKG_XML=""
-XML_LIBS=""
-if test "$with_xml" = "yes"; then
- SAVED_LIBS="$LIBS"
- ac_save_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$ac_save_CPPFLAGS -I/usr/include/libxml2"
- AC_CHECK_HEADERS([libxml/parser.h],AC_CHECK_LIB(xml2,main))
- if test "$ac_cv_lib_xml2_main" = "yes"; then
- INCLUDES="$INCLUDES -I/usr/include/libxml2"
- PKG_XML="libxml-2.0"
- XML_LIBS="-lxml2"
- if test "$enable_all_static" = "yes"; then
- LDFLAGS_RET=$LDFLAGS
- LDFLAGS="-static $LDFLAGS"
- LIBS_RET="$LIBS"
- LIBS="$LIBS -lz"
- AC_MSG_CHECKING(for broken libxml2)
- AC_TRY_RUN([
-#include <libxml/parser.h>
-main() {
- xmlInitParser();
- return 0;
-}],
- AC_MSG_RESULT([no]),[AC_MSG_RESULT([yes])
- AC_MSG_ERROR([Your libxml2 is broken for static linking, recompile it without threads or build gromacs without libxml])],[-lz])
- LDFLAGS=$LDFLAGS_RET
- LIBS="$LIBS_RET"
- fi
- fi
-# restore CPPFLAGS
- CPPFLAGS="$ac_save_CPPFLAGS"
- LIBS="$SAVED_LIBS"
-fi
-AC_SUBST(PKG_XML)
-AC_SUBST(XML_LIBS)
-
-####
-# And collect the f77 libs to the linker - on Solaris, f77 stuff must go first,
-# and we need -L/usr/ucblib to find libucb... (stupid OS)
-# On e.g. ibm the mass libraries must come before -lm...
-case "${host_cpu}-${host_os}" in
- *-solaris*)
- LIBS="$FLIBS $LIBS"
- LDFLAGS="$LDFLAGS -L/usr/ucblib"
- ;;
- *) LIBS="$LIBS $FLIBS" ;;
-esac
-
-
-# add the Accelerate framework if enabled above.
-# LDFLAGS might have been set in the CPU optimization, so we cant assign it directly before that.
-LDFLAGS="$LDFLAGS $extra_LDFLAGS"
-
-
-
-
-
-
-#####
-# Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_TYPE_SIZE_T
-AC_STRUCT_TM
-AC_C_INLINE
-AC_C_RESTRICT
-
-# AC_TYPE_UID_T is broken on Mac OS X, so use generic tests instead
-AC_CHECK_TYPES([uid_t],[],[AC_DEFINE(uid_t, int, [Define to `int' if <sys/types.h> doesn't define.])],[[#include <sys/types.h>]])
-AC_CHECK_TYPES([gid_t],[],[AC_DEFINE(gid_t, int, [Define to `int' if <sys/types.h> doesn't define.])],[[#include <sys/types.h>]])
-
-AC_CHECK_TYPES([sig_atomic_t],[],[AC_DEFINE(sig_atomic_t, int, [Define to `int' (and hope it's atomic) if <signal.h> doesn't define it.])],[[#include <signal.h>]])
-
-
-
-
-# Test stuff for ia32 and x86_64 assembly, and add objects/libraries.
-if test "$enable_ia32_sse" = "yes" -o "$enable_x86_64_sse" = "yes"; then
- AC_MSG_CHECKING([whether your compiler can handle assembly files (*.s)])
-#
-# Use 64-bit registers (rsp/rbp) on x86_64
-#
-if test "$enable_x86_64_sse" = "yes"; then
-cat > conftestasm.s << EOF
-checkasm:
- mov %rsp, %rbp
- ret
-EOF
-else
-cat > conftestasm.s << EOF
-checkasm:
- movl %esp, %ebp
- ret
-EOF
-fi
- if AC_TRY_COMMAND($CC $CFLAGS -c conftestasm.s); then
- if test -f conftestasm.o; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([Upgrade your compiler (or disable assembly loops).])
- fi
- else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([Upgrade your compiler (or disable assembly loops).])
- fi
-
-# ok, cc understands assembly.
-#
-# If we are using double precision we need SSE2
- if test "$enable_float" = "no"; then
-# test SSE2 on ia32:
- if test "$enable_ia32_sse" = "yes"; then
- AC_MSG_CHECKING([whether as fully supports ia32 SSE2])
-cat > conftest.s << EOF
-checkasm:
- emms
- movapd 32(%esi,%edx,8),%xmm4
- emms
- ret
-EOF
- if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
- fi
- AC_DEFINE([GMX_IA32_SSE2],,[Double-precision SSE2 instructions on ia32])
- fi
-# test SSE2 on X86_64:
- if test "$enable_x86_64_sse" = "yes"; then
- AC_MSG_CHECKING([whether as fully supports X86_64 SSE2])
-cat > conftest.s << EOF
-checkasm:
- emms
- movapd 32(%rsi,%rdx,8),%xmm4
- emms
- ret
-EOF
- if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
- fi
- AC_DEFINE([GMX_X86_64_SSE2],,[Double-precision SSE2 instructions on X86_64])
- fi
- else
-# end of double precision testing, now do single.
- if test "$enable_ia32_sse" = "yes"; then
- AC_MSG_CHECKING([whether as fully supports ia32 SSE])
-cat > conftest.s << EOF
-checkasm:
- emms
- movaps 32(%esi,%edx,8),%xmm4
- emms
- ret
-EOF
- if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
- fi
- AC_DEFINE([GMX_IA32_SSE],,[Single-precision SSE instructions on ia32])
- fi
-# test SSE2 on X86_64:
- if test "$enable_x86_64_sse" = "yes"; then
- AC_MSG_CHECKING([whether as fully supports X86_64 SSE instructions])
-cat > conftest.s << EOF
-checkasm:
- emms
- movaps 32(%rsi,%rdx,8),%xmm4
- emms
- ret
-EOF
- if AC_TRY_COMMAND($CC $CFLAGS -c conftest.s); then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([Upgrade to a more recent binutils (or disable assembly loops).])
- fi
- AC_DEFINE([GMX_X86_64_SSE],,[Single-precision SSE instructions on X86_64])
- fi
- fi
-fi
-
-
-# Test stuff for ia64 assembly
-#
-# Nothing to test right now.
-
-
-
-
-#
-# Test altivec support.
-#
-if test "$enable_ppc_altivec" = "yes"; then
- if test "$enable_float" = "no"; then
- AC_MSG_WARN([PowerPC Altivec loops can only be used in single precision - disabling])
- enable_ppc_altivec=no
- else
- # On FSF (vanilla) GCC we must include altivec.h, and on apple we
- # should NOT do it after using -faltivec. Go figure...
- case "${host_os}" in
- darwin*)
- # do nothing on Apple systems
- ;;
- *)
- AC_CHECK_HEADERS([altivec.h])
- ;;
- esac
-
- AC_MSG_CHECKING([whether the compiler supports altivec extensions])
- AC_TRY_COMPILE([],[
-#ifndef __VEC__
-choke_me
-#endif
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE([GMX_PPC_ALTIVEC],,[Use PowerPC Altivec inner loops])],[
- AC_MSG_RESULT([no])
- AC_MSG_WARN([no altivec support found - On recent PowerPC CPUs]
-[you can get a huge performance gain by using an altivec-enabled compiler.]
-[On OS X, you need GCC>=3.3, or the IBM compilers. If you are using standard]
-[GCC, you need at least version 4.0])
- enable_ppc_altivec=no])
- fi
-fi
-
-if test "$enable_ia64_asm" = "yes"; then
- AC_DEFINE(GMX_IA64_ASM,,[Use ia64 assembly tuned for Itanium2])
- AC_DEFINE(DISABLE_WATER_NLIST,,[Turn off all water neighborlist optimization])
- AC_DEFINE(DISABLE_WATERWATER_NLIST,,[Turn off water-water neighborlist optimization only])
-fi
-
-if test "$enable_bluegene" = "yes"; then
- AC_DEFINE(GMX_BLUEGENE,,[Use assembly intrinsics kernels for BlueGene])
- AC_DEFINE_UNQUOTED(GMX_POWERPC_INVSQRT,,[Use the PowerPC hardware 1/sqrt(x)])
- PKG_CFLAGS="$PKG_CFLAGS -DGMX_POWERPC_INVSQRT"
-fi
-
-if test "$enable_fortran" = "yes"; then
- AC_DEFINE(GMX_FORTRAN,,[Enable Fortran support])
-fi
-
-##
-# Add the appropriate assembly loops
-#
-AM_CONDITIONAL([GMX_IA32_SSE],[test "$enable_ia32_sse" = "yes" -a "$enable_float" = "yes"])
-AM_CONDITIONAL([GMX_IA32_SSE2],[test "$enable_ia32_sse" = "yes" -a "$enable_float" = "no"])
-AM_CONDITIONAL([GMX_X86_64_SSE],[test "$enable_x86_64_sse" = "yes" -a "$enable_float" = "yes"])
-AM_CONDITIONAL([GMX_X86_64_SSE2],[test "$enable_x86_64_sse" = "yes" -a "$enable_float" = "no"])
-AM_CONDITIONAL([GMX_FORTRAN],[test "$enable_fortran" = "yes"])
-AM_CONDITIONAL([GMX_PPC_ALTIVEC],[test "$enable_ppc_altivec" = "yes" -a "$enable_float" = "yes"])
-AM_CONDITIONAL([GMX_IA64_ASM],[test "$enable_ia64_asm" = "yes"])
-AM_CONDITIONAL([GMX_BLUEGENE],[test "$enable_bluegene" = "yes"])
-AM_CONDITIONAL([GMX_POWER6],[test "$enable_power6" = "yes"])
-
-
-#############
-# Check integer endian
-#############
-AC_C_BIGENDIAN([AC_DEFINE([GMX_INTEGER_BIG_ENDIAN],,[Integer byte order is big endian.])],[],[
-AC_MSG_ERROR([Cannot determine endian in compiled output])])
-# Little endian implied if GMX_INTEGER_BIG_ENDIAN not defined in source.
-
-
-
-case "${host_cpu}" in
- i?86)
- # Check if inline assembly works
- AC_MSG_CHECKING(if the compiler supports gcc inline assembly)
- AC_TRY_LINK([],[float f;int i; asm("fld %1\nfistpl %0\n" : "=m" (*&i) : "f" (f));],[AC_MSG_RESULT(yes)
-AC_DEFINE(GMX_X86_GCC_INLINE_ASM,,[Enable x86 gcc inline assembly])],[AC_MSG_RESULT(no)])
- # Check for MSVC inline assembly
- AC_MSG_CHECKING(if the compiler supports MSVC inline assembly)
- AC_TRY_LINK([],[float f;int i; _asm { fld f } ; _asm { fistpl i };],[AC_MSG_RESULT(yes)
-AC_DEFINE(GMX_X86_MSVC_INLINE_ASM,,[Enable x86 MSVC inline assembly])],[AC_MSG_RESULT(no)])
- ;;
- *) ;;
-esac
-
-
-############
-# Check dlopen
-###########
-if test "$with_dlopen" = "yes"; then
- AC_MSG_CHECKING(if dlopen supported)
- CFLAGS_RET=$CFLAGS
- #LDFLAGS="$lt_cv_dlopen_libs $LDFLAGS" #can't make the macro, which is getting lt_cv_dlopen_libs, to work
- LDFLAGS_RET=$LDFLAGS
- LIBS_RET=$LIBS
- if test "$enable_all_static" = "yes"; then #make sure we test also whether it works static
- LDFLAGS="$LDFLAGS -static"
- fi
- CFLAGS="-I$srcdir/include -DGMX_DLOPEN $CFLAGS"
- LIBS="$DLOPEN_LIBS $LIBS"
- AC_TRY_LINK([#include "$srcdir/src/gmxlib/vmddlopen.c"],,[
- AC_MSG_RESULT([yes])
- AC_DEFINE(GMX_DLOPEN,,[Compile with dlopen])
- AC_SUBST(DLOPEN_LIBS)
- ],[
- AC_MSG_RESULT([no])
- AC_SUBST(DLOPEN_LIBS,"")
- ])
- CFLAGS=$CFLAGS_RET
- LIBS=$LIBS_RET
- LDFLAGS=$LDFLAGS_RET
-fi
-
-
-
-
-########################################################################
-# Final output stage
-########################################################################
-AS="$CC"
-AC_SUBST(ASFLAGS)
-AC_SUBST(AS)
-AC_SUBST(INCLUDES) # should be automatic, but doesnt seem to be?
-
-# To tell libraries apart, we use four versions of the name. For instance, libgmx:
-# libgmx single prec, no mpi.
-# libgmx_d double prec, no mpi.
-# libgmx_mpi single prec, mpi.
-# libgmx_mpi_d double prec, mpi.
-# However, the non-suffixed names are linked to the _mpi and/or _d suffixed
-# ones upon installation if that is the only version available.
-
-AC_ARG_VAR(
- [LIBSUFFIX],
- [To tell libraries apart, a suffix can be used. This is normally done
- automatically during ./configure (_d|_mpi|_mpi_d). But with this
- variable you can overwrite it
- ]
-)
-if test -z "${LIBSUFFIX}" ; then
- if test "$enable_mpi" = "yes"; then
- LIBSUFFIX="_mpi"
- fi
- if test "$enable_float" = "no"; then
- LIBSUFFIX="${LIBSUFFIX}_d"
- fi
-fi
-AC_SUBST(LIBSUFFIX)
-
-# Unless the user has explicitly requested a prefix/suffix/transform, we
-# use _d on double precision files. Don't add anything for mpi, but at the
-# end we tell the user it is possible and smart to do in some cases!
-if test "$program_transform_name" = "s,x,x,"; then
- name_transform_provided=no;
- if test "$enable_float" = "no"; then
- program_transform_name="s,\$\$,_d,"
- fi
-else
- name_transform_provided=yes;
-fi
-
-
-# Use a variable for RPM - this way it can be
-# overridden with make RPM=rpm3 rpm
-RPM=rpm
-AC_SUBST(RPM)
-
-if test "$enable_fahcore" = "yes"; then
- CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/../corewrap -include swindirect.h -DFULLINDIRECT -DUSE_FAH_XDR"
- if test "$enable_mpi" = "yes"; then
- CFLAGS="$CFLAGS -DMPI"
- fi
-fi
-AM_CONDITIONAL([GMX_FAHCORE],[test "$enable_fahcore" = "yes"])
-
-
-if test "$enable_all_static" = "yes"; then
- LDFLAGS="$LDFLAGS -all-static"
-fi
-
-# we have asm source, so this is necessary for automake 1.6
-CCAS=$CC
-CCASFLAGS=$CFLAGS
-
-AC_SUBST(CCAS)
-AC_SUBST(CCASFLAGS)
-AC_SUBST(PKG_CFLAGS)
-
-AC_CONFIG_FILES([ Makefile ])
-AC_CONFIG_FILES([ src/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/libgmx${LIBSUFFIX}.pc:src/gmxlib/libgmx.pc.in ])
-AC_CONFIG_FILES([ src/gmxlib/gmx_blas/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/gmx_lapack/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/selection/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/statistics/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/trajana/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/thread_mpi/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/nonbonded/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_c/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia32_sse/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia32_sse2/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_x86_64_sse/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_x86_64_sse2/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ppc_altivec/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia64_single/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_ia64_double/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_bluegene/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_power6/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_f77_single/Makefile ])
-AC_CONFIG_FILES([ src/gmxlib/nonbonded/nb_kernel_f77_double/Makefile ])
-AC_CONFIG_FILES([ include/Makefile ])
-AC_CONFIG_FILES([ include/types/Makefile ])
-AC_CONFIG_FILES([ include/thread_mpi/Makefile ])
-AC_CONFIG_FILES([ include/thread_mpi/atomic/Makefile ])
-AC_CONFIG_FILES([ src/mdlib/Makefile ])
-AC_CONFIG_FILES([ src/mdlib/libmd${LIBSUFFIX}.pc:src/mdlib/libmd.pc.in ])
-AC_CONFIG_FILES([ src/kernel/Makefile ])
-AC_CONFIG_FILES([ src/kernel/libgmxpreprocess${LIBSUFFIX}.pc:src/kernel/libgmxpreprocess.pc.in ])
-AC_CONFIG_FILES([ src/tools/Makefile ])
-AC_CONFIG_FILES([ src/tools/libgmxana${LIBSUFFIX}.pc:src/tools/libgmxana.pc.in ])
-AC_CONFIG_FILES([ src/ngmx/Makefile ])
-AC_CONFIG_FILES([ src/contrib/Makefile ])
-AC_CONFIG_FILES([ scripts/Makefile ])
-AC_CONFIG_FILES([ admin/Makefile ])
-AC_CONFIG_FILES([ share/Makefile ])
-AC_CONFIG_FILES([ share/tutor/Makefile ])
-AC_CONFIG_FILES([ share/tutor/gmxdemo/Makefile ])
-AC_CONFIG_FILES([ share/tutor/nmr1/Makefile ])
-AC_CONFIG_FILES([ share/tutor/nmr2/Makefile ])
-AC_CONFIG_FILES([ share/tutor/water/Makefile ])
-AC_CONFIG_FILES([ share/tutor/mixed/Makefile ])
-AC_CONFIG_FILES([ share/tutor/methanol/Makefile ])
-AC_CONFIG_FILES([ share/tutor/speptide/Makefile ])
-AC_CONFIG_FILES([ share/template/Makefile ])
-AC_CONFIG_FILES([ share/top/Makefile ])
-AC_CONFIG_FILES([ share/top/gmx.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/gmx2.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/encadv.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/encads.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/oplsaa.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/gromos43a1.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/gromos43a2.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/gromos45a3.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/gromos53a5.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/gromos53a6.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/charmm27.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/amber94.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/amber96.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/amberGS.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/amber99.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/amber99sb.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/amber99sb-ildn.ff/Makefile ])
-AC_CONFIG_FILES([ share/top/amber03.ff/Makefile ])
-AC_CONFIG_FILES([ share/html/Makefile ])
-AC_CONFIG_FILES([ share/html/images/Makefile ])
-AC_CONFIG_FILES([ share/html/online/Makefile ])
-AC_CONFIG_FILES([ man/Makefile man/man1/Makefile man/man7/Makefile ])
-AC_CONFIG_FILES([ Doxyfile ])
-AC_OUTPUT
-
-
-
-
-
-
-
-#########################################################
-# Echo some important info, to avoid stupid mistakes
-#
-
-if test "$enable_float" = "no" -a "$name_transform_provided" = "no"; then
- echo ""
- echo "* You are compiling a double precision version of Gromacs -"
- echo " program names will be suffixed with _d to avoid overwriting single"
- echo " precision files. You can override it with --program-suffix"
-fi
-
-if test "$name_transform_provided" = "no" -a "$enable_mpi" = "yes"; then
- echo ""
- echo "* Seems you are compiling with MPI support. You can install the MPI-"
- echo " enabled programs with suffixed names to have both MPI and non-MPI"
- echo " versions. This is useful e.g. on supercomputers where you usually"
- echo " cannot run MPI-linked programs on the login node."
- echo " Set a suffix with e.g. --program-suffix=_mpi (or _mpi_d for double)."
- echo " You only need MPI for mdrun, so if you already have non-MPI stuff"
- echo " installed you can issue make mdrun; make install-mdrun."
- echo ""
- echo " WARNING:"
- echo " There are known problems with some MPI implementations:"
- echo " OpenMPI version < 1.4.1"
- echo " MVAPICH2 version <= 1.4.1"
-fi
-
-if test "$enable_shared" = "no"; then
- echo ""
- echo "* On most platforms you can save 10X space with dynamic libraries, although"
- echo " the binaries might be less portable. Why not try --enable-shared ?"
-fi
-
-
-if test "$tmpi_atomics" = "no"; then
- echo ""
- echo "* This compiler+CPU combination doesn't have working atomic operations."
- echo " Thread support will be unbearably slow: the default number of threads"
- echo " is set to 1."
- echo " Atomics should work on all but the most obscure CPU+compiler"
- echo " combinations; if your system is not obscure (like, for example, x86"
- echo " with gcc) please contact the developers."
- echo ""
-fi
-
-
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-SUBDIRS = . types thread_mpi
-
-
-pkginclude_HEADERS = \
-3dview.h \
-assert.h \
-atomprop.h \
-bondf.h \
-calcgrid.h \
-calch.h \
-calcmu.h \
-centerofmass.h \
-chargegroup.h \
-checkpoint.h \
-confio.h \
-constr.h \
-copyrite.h \
-coulomb.h \
-dihre.h \
-displacement.h \
-disre.h \
-do_fit.h \
-domdec.h \
-domdec_network.h \
-ebin.h \
-edsam.h \
-enxio.h \
-ffscanf.h \
-filenm.h \
-force.h \
-futil.h \
-gbutil.h \
-gen_ad.h \
-genborn.h \
-gmx_ana.h \
-gmx_arpack.h \
-gmx_blas.h \
-gmx_cyclecounter.h \
-gmx_fatal.h \
-gmx_fft.h \
-gmx_ga2la.h \
-gmx_lapack.h \
-gmx_matrix.h \
-gmx_parallel_3dfft.h \
-gmx_random.h \
-gmx_sort.h \
-gmx_sse2_single.h \
-gmx_statistics.h \
-gmx_system_xdr.h \
-gmx_wallcycle.h \
-gmxcomplex.h \
-gmxcpp.h \
-gmxfio.h \
-gpp_atomtype.h \
-gpp_nextnb.h \
-grompp.h \
-gstat.h \
-hackblock.h \
-histogram.h \
-index.h \
-indexutil.h \
-inputrec.h \
-invblock.h \
-macros.h \
-magic.h \
-main.h \
-maths.h \
-matio.h \
-md5.h \
-mdatoms.h \
-mdebin.h \
-mdrun.h \
-mpelogging.h \
-mshift.h \
-mtop_util.h\
-mtxio.h \
-mvdata.h \
-names.h \
-nbsearch.h \
-network.h \
-nonbonded.h \
-nrama.h \
-nrjac.h \
-nrnb.h \
-ns.h \
-nsgrid.h \
-orires.h \
-partdec.h \
-pbc.h \
-pdbio.h \
-pdb2top.h \
-perf_est.h \
-physics.h \
-pme.h \
-poscalc.h \
-position.h \
-pppm.h \
-princ.h \
-pull.h \
-qmmm.h \
-random.h \
-rbin.h \
-rdgroup.h \
-readinp.h \
-resall.h \
-rmpbc.h \
-selection.h \
-selmethod.h \
-selparam.h \
-selvalue.h \
-sfactor.h \
-shellfc.h \
-shift.h \
-smalloc.h \
-sortwater.h \
-sparsematrix.h \
-split.h \
-splitter.h \
-statutil.h \
-strdb.h \
-string2.h \
-symtab.h \
-sysstuff.h \
-tgroup.h \
-topsort.h \
-toputil.h \
-tpxio.h \
-trajana.h \
-trnio.h \
-txtdump.h \
-typedefs.h \
-update.h \
-vcm.h \
-vec.h \
-viewit.h \
-vmdio.h \
-vsite.h \
-warninp.h \
-wgms.h \
-wman.h \
-writeps.h \
-xdrf.h \
-xtcio.h \
-xvgr.h \
-thread_mpi.h \
-tmpi.h \
-mainpage.h \
-molfile_plugin.h \
-vmddlopen.h \
-vmdplugin.h \
-oenv.h \
-sighandler.h \
-gmx_sse2_double.h
fflush(stderr); \
if (toupper(getc(stdin))=='Y') \
(void) abort(); else exit(-1); \
- } else
+ }
#ifdef __cplusplus
}
*
*************************************************************************/
t_ifunc bonds,g96bonds,morse_bonds,cubic_bonds,FENE_bonds,restraint_bonds;
- t_ifunc angles,g96angles,cross_bond_bond,cross_bond_angle,urey_bradley,quartic_angles;
+ t_ifunc angles,g96angles,cross_bond_bond,cross_bond_angle,urey_bradley,quartic_angles,linear_angles;
t_ifunc pdihs,idihs,rbdihs;
t_ifunc tab_bonds,tab_angles,tab_dihs;
- t_ifunc polarize,water_pol,thole_pol,angres,angresz,unimplemented;
+ t_ifunc polarize,anharm_polarize,water_pol,thole_pol,angres,angresz,unimplemented;
#ifdef __cplusplus
}
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
const char *fn,
real rtab);
+/* Read a table for AdResS Thermo Force calculations */
+extern t_forcetable make_atf_table(FILE *out,const output_env_t oenv,
+ const t_forcerec *fr,
+ const char *fn,
+ matrix box);
+
void pr_forcerec(FILE *fplog,t_forcerec *fr,t_commrec *cr);
void
matrix box,
gmx_bool bMolEpot,
const char *tabfn,
+ const char *tabafn,
const char *tabpfn,
const char *tabbfn,
gmx_bool bNoSolvOpt,
int
gmx_dos(int argc,char *argv[]);
+int
+gmx_dyecoupl(int argc,char *argv[]);
+
int
gmx_dyndom(int argc,char *argv[]);
int
gmx_options(int argc,char *argv[]);
+int
+gmx_sans(int argc,char *argv[]);
+
#ifdef __cplusplus
}
#endif
* \param bReproducible Try to avoid FFT timing optimizations and other stuff
* that could make results differ for two runs with
* identical input (reproducibility for debugging).
+ * \param nthreads Run in parallel using n threads
*
* \return 0 or a standard error code.
*/
int
gmx_parallel_3dfft_init (gmx_parallel_3dfft_t * pfft_setup,
ivec ndata,
- real ** real_data,
- t_complex ** complex_data,
+ real ** real_data,
+ t_complex ** complex_data,
MPI_Comm comm[2],
int * slab2index_major,
int * slab2index_minor,
- gmx_bool bReproducible);
+ gmx_bool bReproducible,
+ int nthreads);
*/
int
gmx_parallel_3dfft_real_limits(gmx_parallel_3dfft_t pfft_setup,
- ivec local_ndata,
- ivec local_offset,
- ivec local_size);
+ ivec local_ndata,
+ ivec local_offset,
+ ivec local_size);
/*! \brief Get reciprocal space grid index limits
int
gmx_parallel_3dfft_complex_limits(gmx_parallel_3dfft_t pfft_setup,
ivec complex_order,
- ivec local_ndata,
- ivec local_offset,
- ivec local_size);
+ ivec local_ndata,
+ ivec local_offset,
+ ivec local_size);
int
gmx_parallel_3dfft_execute(gmx_parallel_3dfft_t pfft_setup,
- enum gmx_fft_direction dir,
- void * in_data,
- void * out_data);
+ enum gmx_fft_direction dir,
+ void * in_data,
+ void * out_data,
+ int thread,
+ gmx_wallcycle_t wcycle);
/*! \brief Release all data in parallel fft setup
* is not released, but the contents is invalid after this call.
*
* \param pfft_setup Parallel 3dfft setup.
+ * \param in_data Input data.
+ * \param out_data Output data.
+ * \param thread Thread index of the calling thread, i.e. index to the part
+ * of the data operated on last by the calling thread. This
+ * is needed to start the FFT without an OpenMP barrier.
+ * \param wcycle Wall cycle counters.
*
* \return 0 or a standard error code.
*/
int (*compar)(const void *, const void *));
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* Some implementations of qsort are not threadsafe.
* For instance qsort in glibc contains a bug which makes it non-threadsafe:
* http://sources.redhat.com/bugzilla/show_bug.cgi?id=11655
extern "C" {
#endif
- enum { ewcRUN, ewcSTEP, ewcPPDURINGPME, ewcDOMDEC, ewcDDCOMMLOAD, ewcDDCOMMBOUND, ewcVSITECONSTR, ewcPP_PMESENDX, ewcMOVEX, ewcNS, ewcGB, ewcFORCE, ewcMOVEF, ewcPMEMESH, ewcPME_REDISTXF, ewcPME_SPREADGATHER, ewcPME_FFT, ewcPME_SOLVE, ewcPMEWAITCOMM, ewcPP_PMEWAITRECVF, ewcVSITESPREAD, ewcTRAJ, ewcUPDATE, ewcCONSTR, ewcMoveE, ewcTEST, ewcNR };
+ enum { ewcRUN, ewcSTEP, ewcPPDURINGPME, ewcDOMDEC, ewcDDCOMMLOAD, ewcDDCOMMBOUND, ewcVSITECONSTR, ewcPP_PMESENDX, ewcMOVEX, ewcNS, ewcGB, ewcFORCE, ewcMOVEF, ewcPMEMESH, ewcPME_REDISTXF, ewcPME_SPREADGATHER, ewcPME_FFT, ewcPME_FFTCOMM, ewcPME_SOLVE, ewcPMEWAITCOMM, ewcPP_PMEWAITRECVF, ewcVSITESPREAD, ewcTRAJ, ewcUPDATE, ewcCONSTR, ewcMoveE, ewcROT, ewcROTadd, ewcTEST, ewcNR };
gmx_bool wallcycle_have_counter(void);
/* Returns if cycle counting is supported */
-gmx_wallcycle_t wallcycle_init(FILE *fplog,int resetstep,t_commrec *cr);
+gmx_wallcycle_t wallcycle_init(FILE *fplog, int resetstep, t_commrec *cr, int omp_nthreads);
/* Returns the wall cycle structure.
* Returns NULL when cycle counting is not supported.
*/
gmx_bool bHisto, const char *fn_histo, int maxchi,
real **dih, int nlist, t_dlist dlist[],
int nframes, int nangles, const char *grpname,
- int xity[], real *time, gmx_bool bRb,
+ int multiplicity[], real *time, gmx_bool bRb,
real core_frac, const output_env_t oenv);
- /* as above but passes dlist so can copy occupancies into it, and xity[]
+ /* as above but passes dlist so can copy occupancies into it, and multiplicity[]
* (1..nangles, corresp to dih[this][], so can have non-3 multiplicity of
* rotamers. Also production of xvg output files is conditional
* and the fractional width of each rotamer can be set ie for a 3 fold
void mk_chi_lookup (int **lookup, int maxchi, real **dih,
int nlist, t_dlist dlist[]) ;
-void mk_multiplicity_lookup (int *xity, int maxchi, real **dih,
+void mk_multiplicity_lookup (int *multiplicity, int maxchi, real **dih,
int nlist, t_dlist dlist[],int nangle) ;
void get_chi_product_traj (real **dih,int nframes,int nangles,
int nlist,int maxchi, t_dlist dlist[],
- real time[], int **lookup,int *xity,
+ real time[], int **lookup,int *multiplicity,
gmx_bool bRb,gmx_bool bNormalize,
real core_frac,gmx_bool bAll,const char *fnall,
const output_env_t oenv);
#ifndef M_SQRT2
#define M_SQRT2 sqrt(2.0)
#endif
+
+#ifndef M_1_PI
+#define M_1_PI 0.31830988618379067154
+#endif
/* Suzuki-Yoshida Constants, for n=3 and n=5, for symplectic integration */
/* for n=1, w0 = 1 */
gmx_bool bNHC_trotter;
gmx_bool bMTTK;
gmx_bool bDiagPres;
+ gmx_bool bVir;
+ gmx_bool bPress;
+ gmx_bool bSurft;
+ gmx_bool bMu;
int f_nre;
int epc;
real ref_p;
*/
extern gmx_large_int_t deform_init_init_step_tpx;
extern matrix deform_init_box_tpx;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
extern tMPI_Thread_mutex_t deform_init_box_mutex;
/* The minimum number of atoms per thread. With fewer atoms than this,
/**
* Required header
*/
- vmdplugin_HEAD
+ vmdplugin_HEAD;
/**
* Filename extension for this file type. May be NULL if no filename
extern const char *ewt_names[ewtNR+1];
extern const char *epull_names[epullNR+1];
extern const char *epullg_names[epullgNR+1];
+extern const char *erotg_names[erotgNR+1];
+extern const char *erotg_originnames[erotgNR+1];
+extern const char *erotg_fitnames[erotgFitNR+1];
extern const char *eQMmethod_names[eQMmethodNR+1];
extern const char *eQMbasis_names[eQMbasisNR+1];
extern const char *eQMMMscheme_names[eQMMMschemeNR+1];
extern const char *eMultentOpt_names[eMultentOptNR+1];
+extern const char *eAdresstype_names[eAdressNR+1];
+extern const char *eAdressICtype_names[eAdressICNR+1];
+extern const char *eAdressSITEtype_names[eAdressSITENR+1];
#define UNDEFINED "UNDEFINED"
#define ENUM_NAME(e,max,names) ((((e)<0)||((e)>=(max)))?UNDEFINED:(names)[e])
#define EWALLTYPE(e) ENUM_NAME(e,ewtNR,ewt_names)
#define EPULLTYPE(e) ENUM_NAME(e,epullNR,epull_names)
#define EPULLGEOM(e) ENUM_NAME(e,epullgNR,epullg_names)
+#define EROTGEOM(e) ENUM_NAME(e,erotgNR,erotg_names)
+#define EROTORIGIN(e) ENUM_NAME(e,erotgOriginNR,erotg_originnames)
+#define EROTFIT(e) ENUM_NAME(e,erotgFitNR,erotg_fitnames)
#define EQMMETHOD(e) ENUM_NAME(e,eQMmethodNR,eQMmethod_names)
#define EQMBASIS(e) ENUM_NAME(e,eQMbasisNR,eQMbasis_names)
#define EQMMMSCHEME(e) ENUM_NAME(e,eQMMMschemeNR,eQMMMscheme_names)
#define EMULTENTOPT(e) ENUM_NAME(e,eMultentOptNR,eMultentOpt_names)
+#define EADRESSTYPE(e) ENUM_NAME(e,eAdressNR,eAdresstype_names)
+#define EADRESSICTYPE(e) ENUM_NAME(e,eAdressICNR,eAdressICtype_names)
+#define EADRESSSITETYPE(e) ENUM_NAME(e,eAdressSITENR,eAdressSITEtype_names)
#ifdef __cplusplus
}
int gmx_node_rank(void);
/* return the rank of the node */
+int gmx_hostname_num(void);
+/* If the first part of the hostname (up to the first dot) ends with a number, returns this number.
+ If the first part of the hostname does not ends in a number (0-9 characters), returns 0.
+*/
+
void gmx_setup_nodecomm(FILE *fplog,t_commrec *cr);
/* Sets up fast global communication for clusters with multi-core nodes */
#endif
void gmx_setup_kernels(FILE *fplog,gmx_bool bGenericKernelOnly);
+void gmx_setup_adress_kernels(FILE *fplog,gmx_bool bGenericKernelOnly);
#define GMX_DONB_LR (1<<0)
#define GMX_DONB_FORCES (1<<1)
enum { GMX_SUM_QGRID_FORWARD, GMX_SUM_QGRID_BACKWARD };
int gmx_pme_init(gmx_pme_t *pmedata,t_commrec *cr,
- int nnodes_major,int nnodes_minor,
- t_inputrec *ir,int homenr,
- gmx_bool bFreeEnergy, gmx_bool bReproducible);
-
+ int nnodes_major,int nnodes_minor,
+ t_inputrec *ir,int homenr,
+ gmx_bool bFreeEnergy, gmx_bool bReproducible, int nthread);
+
int gmx_pme_destroy(FILE *log,gmx_pme_t *pmedata);
/* Initialize and destroy the pme data structures resepectively.
* Return value 0 indicates all well, non zero is an error code.
--- /dev/null
+/*
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2008, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ *
+ * And Hey:
+ * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
+ */
+
+/*! \file pull_rotation.h
+ *
+ * @brief Enforced rotation of protein parts or other groups of particles.
+ *
+ * This file contains routines that are used to enforce rotational motion
+ * upon a subgroup of particles.
+ *
+ */
+
+#ifndef _pull_rotation_h
+#define _pull_rotation_h
+
+#ifdef HAVE_CONFIG_H
+ #include <config.h>
+#endif
+
+#include "vec.h"
+#include "typedefs.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*! \brief Initialize the enforced rotation groups.
+ *
+ * This routine does the memory allocation for various helper arrays, opens
+ * the output files etc.
+ *
+ * \param fplog General output file, normally md.log.
+ * \param ir Struct containing MD input parameters, among those
+ * also the enforced rotation parameters.
+ * \param nfile Number of entries in the fnm structure.
+ * \param fnm The filenames struct containing also the names
+ * of the rotation output files.
+ * \param cr Pointer to MPI communication data.
+ * \param x The positions of all MD particles.
+ * \param mtop Molecular topology.
+ * \param oenv Needed to open the rotation output xvgr file.
+ * \param Flags Flags passed over from main, used to determine
+ * whether or not we are doing a rerun.
+ */
+extern void init_rot(FILE *fplog,t_inputrec *ir,int nfile,const t_filenm fnm[],
+ t_commrec *cr, rvec *x, matrix box, gmx_mtop_t *mtop, const output_env_t oenv,
+ gmx_bool bVerbose, unsigned long Flags);
+
+
+/*! \brief Make a selection of the home atoms for all enforced rotation groups.
+ *
+ * This routine is similar to dd_make_local_pull_groups, but works only with
+ * domain decomposition. It should be called at every domain decomposition.
+ *
+ * \param dd Structure containing domain decomposition data.
+ * \param rot Pointer to all the enforced rotation data.
+ */
+extern void dd_make_local_rotation_groups(gmx_domdec_t *dd,t_rot *rot);
+
+
+/*! \brief Calculation of the enforced rotation potential.
+ *
+ * This is the main enforced rotation module which is called during every time
+ * step. Here the rotation potential as well as the resulting forces are
+ * calculated.
+ *
+ * \param cr Pointer to MPI communication data.
+ * \param ir Struct containing MD input parameters, among those
+ * \param box Simulation box, needed to make group whole.
+ * \param x The positions of all the local particles.
+ * \param t Time.
+ * \param step The time step.
+ * \param wcycle During the potential calculation the wallcycles are
+ * counted. Later they enter the dynamic load balancing.
+ * \param bNS After domain decomposition / neighborsearching several
+ * local arrays have to be updated (masses, shifts)
+ */
+extern void do_rotation(t_commrec *cr,t_inputrec *ir,matrix box,rvec x[],real t,
+ gmx_large_int_t step,gmx_wallcycle_t wcycle,gmx_bool bNS);
+
+
+/*! \brief Add the enforced rotation forces to the official force array.
+ *
+ * Adds the forces from enforced rotation potential to the local forces and
+ * sums up the contributions to the rotation potential from all the nodes. Since
+ * this needs communication, this routine should be called after the SR forces
+ * have been evaluated (in order not to spoil cycle counts).
+ * This routine also outputs data to the various rotation output files (e.g.
+ * the potential, the angle of the group, torques and more).
+ *
+ * \param rot Pointer to all the enforced rotation data.
+ * \param f The local forces to which the rotational forces have
+ * to be added.
+ * \param cr Pointer to MPI communication data.
+ * \param step The time step, used for output.
+ * \param t Time, used for output.
+ */
+extern real add_rot_forces(t_rot *rot, rvec f[], t_commrec *cr, gmx_large_int_t step, real t);
+
+
+/*! \brief Close the enforced rotation output files.
+ *
+ * \param fplog General output file, normally md.log.
+ * \param rot Pointer to all the enforced rotation data.
+ */
+extern void finish_rot(FILE *fplog,t_rot *rot);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+++ /dev/null
-# Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-SUBDIRS = atomic
-
-pkgincludethread_mpidir = ${pkgincludedir}/thread_mpi
-
-pkgincludethread_mpi_HEADERS = \
- atomic.h event.h lock.h tmpi.h \
- barrier.h mpi_bindings.h wait.h \
- collective.h list.h threads.h numa_malloc.h
-
-
+++ /dev/null
-# Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-pkgincludethread_mpidir = ${pkgincludedir}/thread_mpi/atomic
-
-pkgincludethread_mpi_HEADERS = \
- cycles.h gcc_intrinsics.h gcc_x86.h\
- gcc.h gcc_ppc.h msvc.h\
- gcc_ia64.h gcc_spinlock.h xlc_ppc.h
-
tMPI_Atomic_t count; /*!< Number of threads remaining */
int threshold; /*!< Total number of threads */
volatile int cycle; /*!< Current cycle (alternating 0/1) */
- TMPI_YIELD_WAIT_DATA
+ TMPI_YIELD_WAIT_DATA;
};
{
tMPI_Atomic_t sync; /* the event sync counter */
int last_sync; /* the last sync event looked at */
- TMPI_YIELD_WAIT_DATA /* data associated with yielding */
+ TMPI_YIELD_WAIT_DATA; /* data associated with yielding */
};
struct tMPI_Lock
{
tMPI_Spinlock_t lock; /*!< The underlying spin lock */
- TMPI_YIELD_WAIT_DATA
+ TMPI_YIELD_WAIT_DATA;
};
#define TMPI_GROUP_NULL NULL
/** the empty group */
-extern tMPI_Group tMPI_GROUP_EMPTY;
+extern tMPI_Group TMPI_GROUP_EMPTY;
/** The maximum processor name returned using tMPI_Get_processor_name(). */
lead to starvation. This mixed approach actually gives better real-world
performance in the test program.*/
/* the data associated with waiting. */
-#define TMPI_YIELD_WAIT_DATA int yield_wait_counter;
+#define TMPI_YIELD_WAIT_DATA int yield_wait_counter
/* the initialization associated with waiting. */
#define TMPI_YIELD_WAIT_DATA_INIT(data) { (data)->yield_wait_counter=0; }
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-pkgincludetypesdir = ${pkgincludedir}/types
-
-pkgincludetypes_HEADERS = \
- atoms.h forcerec.h ifunc.h oenv.h \
- mdatom.h simple.h block.h constr.h \
- energy.h graph.h inputrec.h nblist.h \
- ns.h nsgrid.h symtab.h commrec.h \
- enums.h group.h ishift.h globsig.h \
- topology.h fcdata.h filenm.h idef.h \
- matrix.h nrnb.h trx.h state.h \
- pbc.h qmmmrec.h shellfc.h genborn.h \
- iteratedconstraints.h nlistheuristics.h
-
#ifdef GMX_LIB_MPI
#include <mpi.h>
#else
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "../tmpi.h"
#else
typedef void* MPI_Comm;
#define PULL_CYL(pull) ((pull)->eGeom == epullgCYL)
+/* Enforced rotation groups */
+enum {
+ erotgISO , erotgISOPF ,
+ erotgPM , erotgPMPF ,
+ erotgRM , erotgRMPF ,
+ erotgRM2 , erotgRM2PF ,
+ erotgFLEX , erotgFLEXT ,
+ erotgFLEX2, erotgFLEX2T,
+ erotgNR
+};
+
+enum {
+ erotgFitRMSD, erotgFitNORM, erotgFitPOT, erotgFitNR
+};
+
/* QMMM */
enum {
eQMmethodAM1, eQMmethodPM3, eQMmethodRHF,
eMultentOptName, eMultentOptNo, eMultentOptLast, eMultentOptNR
};
+enum {
+ eAdressOff,eAdressConst, eAdressXSplit, eAdressSphere, eAdressNR
+};
+
+enum {
+ eAdressICOff, eAdressICThermoForce, eAdressICNR
+};
+
+enum {
+ eAdressSITEcom,eAdressSITEcog, eAdressSITEatom, eAdressSITEatomatom, eAdressSITENR
+};
+
#ifdef __cplusplus
}
#endif
double t_wait;
int timesteps;
+ /* parameter needed for AdResS simulation */
+ int adress_type;
+ gmx_bool badress_tf_full_box;
+ real adress_const_wf;
+ real adress_ex_width;
+ real adress_hy_width;
+ int adress_icor;
+ int adress_site;
+ rvec adress_refs;
+ int n_adress_tf_grps;
+ int * adress_tf_table_index;
+ int *adress_group_explicit;
+ t_forcetable * atf_tabs;
+ real adress_ex_forcecap;
+ gmx_bool adress_do_hybridpairs;
+
/* User determined parameters, copied from the inputrec */
int userint1;
int userint2;
F_RESTRBONDS,
F_ANGLES,
F_G96ANGLES,
+ F_LINEAR_ANGLES,
F_CROSS_BOND_BONDS,
F_CROSS_BOND_ANGLES,
F_UREY_BRADLEY,
F_POLARIZATION,
F_WATER_POL,
F_THOLE_POL,
+ F_ANHARM_POL,
F_POSRES,
F_DISRES,
F_DISRESVIOL,
*/
struct {real a,b,c; } bham;
struct {real rA,krA,rB,krB; } harmonic;
+ struct {real klinA,aA,klinB,aB; } linangle;
struct {real lowA,up1A,up2A,kA,lowB,up1B,up2B,kB; } restraint;
/* No free energy supported for cubic bonds, FENE, WPOL or cross terms */
struct {real b0,kb,kcub; } cubic;
struct {real theta,ktheta,r13,kUB; } u_b;
struct {real theta,c[5]; } qangle;
struct {real alpha; } polarize;
+ struct {real alpha,drcut,khyp; } anharm_polarize;
struct {real al_x,al_y,al_z,rOH,rHH,rOD; } wpol;
struct {real a,alpha1,alpha2,rfac; } thole;
struct {real c6,c12; } lj;
#define NRFP(ftype) (NRFPA(ftype)+NRFPB(ftype))
#define NRAL(ftype) (interaction_function[(ftype)].nratoms)
-#define IS_CHEMBOND(ftype) (interaction_function[(ftype)].nratoms==2 && interaction_function[(ftype)].flags & IF_CHEMBOND)
+#define IS_CHEMBOND(ftype) (interaction_function[(ftype)].nratoms==2 && (interaction_function[(ftype)].flags & IF_CHEMBOND))
/* IS_CHEMBOND tells if function type ftype represents a chemical bond */
/* IS_ANGLE tells if a function type ftype represents an angle
* Per Larsson, 2007-11-06
*/
-#define IS_ANGLE(ftype) (interaction_function[(ftype)].nratoms==3 && interaction_function[(ftype)].flags & IF_ATYPE)
+#define IS_ANGLE(ftype) (interaction_function[(ftype)].nratoms==3 && (interaction_function[(ftype)].flags & IF_ATYPE))
#define IS_VSITE(ftype) (interaction_function[(ftype)].flags & IF_VSITE)
#define IS_TABULATED(ftype) (interaction_function[(ftype)].flags & IF_TABULATED)
FILE *out_f; /* output file for pull data */
} t_pull;
+
+/* Abstract types for enforced rotation only defined in pull_rotation.c */
+typedef struct gmx_enfrot *gmx_enfrot_t;
+typedef struct gmx_enfrotgrp *gmx_enfrotgrp_t;
+
+typedef struct {
+ int eType; /* Rotation type for this group */
+ int bMassW; /* Use mass-weighed positions? */
+ int nat; /* Number of atoms in the group */
+ atom_id *ind; /* The global atoms numbers */
+ rvec *x_ref; /* The reference positions */
+ rvec vec; /* The normalized rotation vector */
+ real rate; /* Rate of rotation (degree/ps) */
+ real k; /* Force constant (kJ/(mol nm^2) */
+ rvec pivot; /* Pivot point of rotation axis (nm) */
+ int eFittype; /* Type of fit to determine actual group angle */
+ int PotAngle_nstep; /* Number of angles around the reference angle
+ for which the rotation potential is also
+ evaluated (for fit type 'potential' only) */
+ real PotAngle_step; /* Distance between two angles in degrees (for
+ fit type 'potential' only) */
+ real slab_dist; /* Slab distance (nm) */
+ real min_gaussian; /* Minimum value the gaussian must have so that
+ the force is actually evaluated */
+ real eps; /* Additive constant for radial motion2 and
+ flexible2 potentials (nm^2) */
+ gmx_enfrotgrp_t enfrotgrp; /* Stores non-inputrec rotation data per group */
+} t_rotgrp;
+
+typedef struct {
+ int ngrp; /* Number of rotation groups */
+ int nstrout; /* Output frequency for main rotation outfile */
+ int nstsout; /* Output frequency for per-slab data */
+ t_rotgrp *grp; /* Groups to rotate */
+ gmx_enfrot_t enfrot; /* Stores non-inputrec enforced rotation data */
+} t_rot;
+
+
+typedef struct {
+ int type; /* type of AdResS simulation */
+ gmx_bool bnew_wf; /* enable new AdResS weighting function */
+ gmx_bool bchempot_dx; /*true:interaction table format input is F=-dmu/dx false: dmu_dwp */
+ gmx_bool btf_full_box; /* true: appy therm force everywhere in the box according to table false: only in hybrid region */
+ real const_wf; /* value of weighting function for eAdressConst */
+ real ex_width; /* center of the explicit zone */
+ real hy_width; /* width of the hybrid zone */
+ int icor; /* type of interface correction */
+ int site; /* AdResS CG site location */
+ rvec refs; /* Coordinates for AdResS reference */
+ real ex_forcecap; /* in the hybrid zone, cap forces large then this to adress_ex_forcecap */
+ gmx_bool do_hybridpairs; /* If true pair interaction forces are also scaled in an adress way*/
+
+ int * tf_table_index; /* contains mapping of energy group index -> i-th adress tf table*/
+ int n_tf_grps;
+ int *group_explicit;
+ int n_energy_grps;
+} t_adress;
+
typedef struct {
int eI; /* Integration method */
gmx_large_int_t nsteps; /* number of steps to be taken */
real wall_ewald_zfac; /* Scaling factor for the box for Ewald */
int ePull; /* Type of pulling: no, umbrella or constraint */
t_pull *pull; /* The data for center of mass pulling */
+ gmx_bool bRot; /* Calculate enforced rotation potential(s)? */
+ t_rot *rot; /* The data for enforced rotation potentials */
real cos_accel; /* Acceleration for viscosity calculation */
tensor deform; /* Triclinic deformation velocities (nm/ps) */
int userint1; /* User determined parameters */
int QMconstraints; /* constraints on QM bonds */
int QMMMscheme; /* Scheme: ONIOM or normal */
real scalefactor; /* factor for scaling the MM charges in QM calc.*/
+ /* parameter needed for AdResS simulation */
+ gmx_bool bAdress; /* Is AdResS enabled ? */
+ t_adress *adress; /* The data for adress simulations */
} t_inputrec;
#define DEFORM(ir) ((ir).deform[XX][XX]!=0 || (ir).deform[YY][YY]!=0 || (ir).deform[ZZ][ZZ]!=0 || (ir).deform[YY][XX]!=0 || (ir).deform[ZZ][XX]!=0 || (ir).deform[ZZ][YY]!=0)
extern "C" {
#endif
+
+#define NO_TF_TABLE 255
+#define DEFAULT_TF_TABLE 0
+
typedef struct {
real tmassA,tmassB,tmass;
int nr;
int homenr;
/* The lambda value used to create the contents of the struct */
real lambda;
+ /* The AdResS weighting function */
+ real *wf;
+ gmx_bool pureex;
+ gmx_bool purecg;
+ unsigned short *tf_table_index; /* The tf table that will be applied, if thermodyn, force enabled*/
} t_mdatoms;
#ifdef __cplusplus
eNR_CONV, eNR_SOLVEPME,eNR_NS, eNR_RESETX,
eNR_SHIFTX, eNR_CGCM, eNR_FSUM,
eNR_BONDS, eNR_G96BONDS, eNR_FENEBONDS,
- eNR_TABBONDS, eNR_RESTRBONDS,
+ eNR_TABBONDS, eNR_RESTRBONDS, eNR_LINEAR_ANGLES,
eNR_ANGLES, eNR_G96ANGLES, eNR_QANGLES,
eNR_TABANGLES, eNR_PROPER, eNR_IMPROPER,
eNR_RB, eNR_FOURDIH, eNR_TABDIHS,
eNR_DISRES, eNR_ORIRES, eNR_DIHRES,
eNR_POSRES, eNR_ANGRES, eNR_ANGRESZ,
eNR_MORSE, eNR_CUBICBONDS, eNR_WALLS,
+ eNR_POLARIZE, eNR_ANHARM_POL,
eNR_WPOL, eNR_THOLE, eNR_VIRIAL,
eNR_UPDATE, eNR_EXTUPDATE, eNR_STOPCM,
eNR_PCOUPL, eNR_EKIN, eNR_LINCS,
* Instead, start by looking for "long long", and just go down if we
* have to (rarely on new systems). /EL 20100810
*/
-#if ( (defined LLONG_MAX && LLONG_MAX==9223372036854775807LL) || (defined SIZEOF_LONG_LONG_INT && SIZEOF_LONG_LONG_INT==8) )
+#if ( (defined SIZEOF_LONG_LONG_INT && SIZEOF_LONG_LONG_INT==8) || (defined LLONG_MAX && LLONG_MAX==9223372036854775807LL) )
/* Long long int is 64 bit */
typedef long long int gmx_large_int_t;
#define GMX_LARGE_INT_MIN (-GMX_LARGE_INT_MAX - 1LL)
#define GMX_MPI_LARGE_INT MPI_LONG_LONG_INT
-#elif ( (defined LONG_MAX && LONG_MAX==9223372036854775807L) || (defined SIZEOF_LONG_INT && SIZEOF_LONG_INT==8) )
+#elif ( (defined SIZEOF_LONG_INT && SIZEOF_LONG_INT==8) || (defined LONG_MAX && LONG_MAX==9223372036854775807L) )
/* Long int is 64 bit */
typedef long int gmx_large_int_t;
#define GMX_LARGE_INT_MIN (-GMX_LARGE_INT_MAX - 1LL)
#define GMX_MPI_LARGE_INT MPI_LONG_INT
-#elif ( (defined INT_MAX && INT_MAX==9223372036854775807L) || (defined SIZEOF_INT && SIZEOF_INT==8) )
+#elif ( (defined SIZEOF_INT && SIZEOF_INT==8) || (defined INT_MAX && INT_MAX==9223372036854775807L) )
/* int is 64 bit */
typedef int gmx_large_int_t;
const char *author; \
int majorv; \
int minorv; \
- int is_reentrant;
+ int is_reentrant
/**
* Typedef for generic plugin header, individual plugins can
* using the vmdplugin_HEAD macro.
*/
typedef struct {
- vmdplugin_HEAD
+ vmdplugin_HEAD;
} vmdplugin_t;
/**
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-SUBDIRS = man1 man7
-
-CLEANFILES = *~ \\\#*
+++ /dev/null
-# This file has been generated by mknroff.pl. Don't edit it.
-man_MANS = \
- do_dssp.1 \
- editconf.1 \
- eneconv.1 \
- g_anadock.1 \
- g_anaeig.1 \
- g_analyze.1 \
- g_angle.1 \
- g_bar.1 \
- g_bond.1 \
- g_bundle.1 \
- g_chi.1 \
- g_cluster.1 \
- g_clustsize.1 \
- g_confrms.1 \
- g_covar.1 \
- g_current.1 \
- g_density.1 \
- g_densmap.1 \
- g_densorder.1 \
- g_dielectric.1 \
- g_dih.1 \
- g_dipoles.1 \
- g_disre.1 \
- g_dist.1 \
- g_dyndom.1 \
- g_enemat.1 \
- g_energy.1 \
- g_filter.1 \
- g_gyrate.1 \
- g_h2order.1 \
- g_hbond.1 \
- g_helix.1 \
- g_helixorient.1 \
- g_hydorder.1 \
- g_lie.1 \
- g_mdmat.1 \
- g_membed.1 \
- g_mindist.1 \
- g_morph.1 \
- g_msd.1 \
- g_nmeig.1 \
- g_nmens.1 \
- g_nmtraj.1 \
- g_options.1 \
- g_order.1 \
- g_pme_error.1 \
- g_polystat.1 \
- g_potential.1 \
- g_principal.1 \
- g_protonate.1 \
- g_rama.1 \
- g_rdf.1 \
- g_rms.1 \
- g_rmsdist.1 \
- g_rmsf.1 \
- g_rotacf.1 \
- g_rotmat.1 \
- g_saltbr.1 \
- g_sas.1 \
- g_select.1 \
- g_sgangle.1 \
- g_sham.1 \
- g_sigeps.1 \
- g_sorient.1 \
- g_spatial.1 \
- g_spol.1 \
- g_tcaf.1 \
- g_traj.1 \
- g_tune_pme.1 \
- g_vanhove.1 \
- g_velacc.1 \
- g_wham.1 \
- g_wheel.1 \
- g_x2top.1 \
- g_xrama.1 \
- genbox.1 \
- genconf.1 \
- genion.1 \
- genrestr.1 \
- gmxcheck.1 \
- gmxdump.1 \
- grompp.1 \
- make_edi.1 \
- make_ndx.1 \
- mdrun.1 \
- mk_angndx.1 \
- ngmx.1 \
- pdb2gmx.1 \
- tpbconv.1 \
- trjcat.1 \
- trjconv.1 \
- trjorder.1 \
- xpm2ps.1
-
-EXTRA_DIST = ${man_MANS}
-
+++ /dev/null
-#
-man_MANS = gromacs.7
-
-EXTRA_DIST = ${man_MANS}
-
+++ /dev/null
-# bash configuration file for Gromacs
-# First we remove old gromacs stuff from the paths
-# by selecting everything else.
-# This is not 100% necessary, but very useful when we
-# repeatedly switch between gmx versions in a shell.
-
-# First remove gromacs part of ld_library_path
-tmppath=""
-for i in `echo $LD_LIBRARY_PATH | sed "s/:/ /g"`; do
- if test "$i" != "$GMXLDLIB"; then
- tmppath="${tmppath}${tmppath:+:}${i}"
- fi
-done
-LD_LIBRARY_PATH=$tmppath
-
-# remove gromacs part of PKG_CONFIG_PATH
-tmppath=""
-for i in `echo $PKG_CONFIG_PATH | sed "s/:/ /g"`; do
- if test "$i" != "$GMXLDLIB/pkgconfig"; then
- tmppath="${tmppath}${tmppath:+:}${i}"
- fi
-done
-PKG_CONFIG_PATH=$tmppath
-
-# remove gromacs part of path
-tmppath=""
-for i in `echo $PATH | sed "s/:/ /g"`; do
- if test "$i" != "$GMXBIN"; then
- tmppath="${tmppath}${tmppath:+:}${i}"
- fi
-done
-PATH=$tmppath
-
-# and remove the gmx part of manpath
-tmppath=""
-for i in `echo $MANPATH | sed "s/:/ /g"`; do
- if test "$i" != "$GMXMAN"; then
- tmppath="${tmppath}${tmppath:+:}${i}"
- fi
-done
-MANPATH=$tmppath
-
-##########################################################
-# This is the real configuration part. We save the Gromacs
-# things in separate vars, so we can remove them later.
-# If you move gromacs, change the next four line.
-##########################################################
-GMXBIN=@bindir@
-GMXLDLIB=@libdir@
-GMXMAN=@mandir@
-GMXDATA=@datadir@
-
-LD_LIBRARY_PATH=${GMXLDLIB}${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}
-PKG_CONFIG_PATH=${GMXLDLIB}/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}
-PATH=${GMXBIN}${PATH:+:}${PATH}
-#debian/ubuntu needs a : at the end
-MANPATH=${GMXMAN}:${MANPATH}
-
-# export should be separate, so /bin/sh understands it
-export GMXBIN GMXLDLIB GMXMAN GMXDATA LD_LIBRARY_PATH PATH MANPATH PKG_CONFIG_PATH
-
-# read bash completions if understand how to use them
-# and this shell supports extended globbing
-if (complete) > /dev/null 2>&1; then
- if (shopt -s extglob) > /dev/null 2>&1; then
- if [ -f $GMXBIN/completion.bash ]; then
- source $GMXBIN/completion.bash;
- fi
- fi
-fi
-
-
+++ /dev/null
-# csh/tcsh configuration file for Gromacs.
-# First we remove previous Gromacs stuff from paths
-# by selecting everything else.
-# Removal is not 100% necessary, but very useful when we
-# repeatedly switch between gmx versions in a shell.
-
-# zero possibly unset vars to avoid warnings
-if (! $?LD_LIBRARY_PATH) setenv LD_LIBRARY_PATH ""
-if (! $?PKG_CONFIG_PATH) setenv PKG_CONFIG_PATH ""
-if (! $?PATH) setenv PATH ""
-if (! $?MANPATH) setenv MANPATH ""
-if (! $?GMXLDLIB) setenv GMXLDLIB ""
-if (! $?GMXBIN) setenv GMXBIN ""
-if (! $?GMXMAN) setenv GMXMAN ""
-
-# remove previous gromacs part from ld_library_path
-set tmppath = ""
-foreach i ( `echo $LD_LIBRARY_PATH | sed "s/:/ /g"` )
- if ( "$i" != "$GMXLDLIB" ) then
- if ("${tmppath}" == "") then
- set tmppath = "$i"
- else
- set tmppath = "${tmppath}:$i"
- endif
- endif
-end
-setenv LD_LIBRARY_PATH $tmppath
-
-# remove previous gromacs part from PKG_CONFIG_PATH
-set tmppath = ""
-foreach i ( `echo $PKG_CONFIG_PATH | sed "s/:/ /g"` )
- if ( "$i" != "$GMXLDLIB/pkgconfig" ) then
- if ("${tmppath}" == "") then
- set tmppath = "$i"
- else
- set tmppath = "${tmppath}:$i"
- endif
- endif
-end
-setenv PKG_CONFIG_PATH $tmppath
-
-# remove gromacs stuff from binary path
-set tmppath = ""
-foreach i ( `echo $PATH | sed "s/:/ /g"` )
- if ( "$i" != "$GMXBIN" ) then
- if ("${tmppath}" == "") then
- set tmppath = "$i"
- else
- set tmppath = "${tmppath}:$i"
- endif
- endif
-end
-setenv PATH $tmppath
-
-# and remove stuff from manual path
-set tmppath = ""
-foreach i ( `echo $MANPATH | sed "s/:/ /g"` )
- if ( "$i" != "$GMXMAN" ) then
- if ("${tmppath}" == "") then
- set tmppath = "$i"
- else
- set tmppath = "${tmppath}:$i"
- endif
- endif
-end
-setenv MANPATH $tmppath
-
-##########################################################
-# This is the real configuration part. We save the Gromacs
-# things in separate vars, so we can remove them later.
-# If you move gromacs, change the next four line.
-##########################################################
-setenv GMXBIN @bindir@
-setenv GMXLDLIB @libdir@
-setenv GMXMAN @mandir@
-setenv GMXDATA @datadir@
-
-#make them begin with :
-if ($?LD_LIBRARY_PATH) setenv LD_LIBRARY_PATH ":${LD_LIBRARY_PATH}"
-if ($?PKG_CONFIG_PATH) setenv PKG_CONFIG_PATH ":${PKG_CONFIG_PATH}"
-
-#path is never empty
-setenv PATH ${GMXBIN}:${PATH}
-setenv LD_LIBRARY_PATH ${GMXLDLIB}${LD_LIBRARY_PATH}
-setenv PKG_CONFIG_PATH ${GMXLDLIB}/pkgconfig${PKG_CONFIG_PATH}
-#debian/ubuntu needs a : at the end
-setenv MANPATH ${GMXMAN}:${MANPATH}
-
-setenv GMXFONT 10x20
-
-# Read completions if we understand it (i.e. have tcsh)
-if { complete >& /dev/null } then
- if ( -f $GMXBIN/completion.csh ) source $GMXBIN/completion.csh
-endif
-
-
-
-
-
-
-
-
+++ /dev/null
-# This is a convenience script to determine which
-# type of shell you have, and then run GMXRC.[csh|bash|zsh]
-# from the Gromacs binary directory.
-#
-# If you only use one shell you can copy that GMXRC.* instead.
-
-
-# only csh/tcsh understand 'set'
-set is_csh = 123
-test "$is_csh" = 123 && goto CSH
-
-# if we got here, shell is bsh/bash/zsh/ksh
-# bsh cannot remove part of a variable with %%
-shtst="A.B"
-if [ "`(echo ${shtst%%.*}) 2>/dev/null`" = A ]; then
-
- # shell is bash/zsh/ksh
- # bash/zsh use $[...] for arithmetic evaluation, ksh doesn't
- if [ "`echo $[0+1]`" = 1 ]; then
-
- # shell is zsh/bash
- # zsh can test if the variable shtst is set with ${+shtst}
- if [ "`(echo ${+shtst}) 2>/dev/null`" = 1 ]; then
- # shell is zsh
- source @bindir@/GMXRC.zsh
- else
- # shell is bash
- source @bindir@/GMXRC.bash
- fi
-
- else
- # shell is ksh - use bash setup, completions won't be read.
- . @bindir@/GMXRC.bash
- fi
- return
-else
- # shell is bsh - use bash setup, completions won't be read.
- . @bindir@/GMXRC.bash
- exit
-fi
-
-# csh/tcsh jump here
-
-CSH:
-source @bindir@/GMXRC.csh
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+++ /dev/null
-# zsh configuration file for Gromacs
-# First we remove old gromacs stuff from the paths
-# by selecting everything else.
-# This is not 100% necessary, but very useful when we
-# repeatedly switch between gmx versions in a shell.
-
-# ATTENTION
-# zsh understands sh syntax - so this is just a copy from GMXRC.bash.in
-# BEGIN COPY
-
-# First remove gromacs part of ld_library_path
-tmppath=""
-for i in `echo $LD_LIBRARY_PATH | sed "s/:/ /g"`; do
- if test "$i" != "$GMXLDLIB"; then
- tmppath="${tmppath}${tmppath:+:}${i}"
- fi
-done
-LD_LIBRARY_PATH=$tmppath
-
-# remove gromacs part of PKG_CONFIG_PATH
-tmppath=""
-for i in `echo $PKG_CONFIG_PATH | sed "s/:/ /g"`; do
- if test "$i" != "$GMXLDLIB/pkgconfig"; then
- tmppath="${tmppath}${tmppath:+:}${i}"
- fi
-done
-PKG_CONFIG_PATH=$tmppath
-
-# remove gromacs part of path
-tmppath=""
-for i in `echo $PATH | sed "s/:/ /g"`; do
- if test "$i" != "$GMXBIN"; then
- tmppath="${tmppath}${tmppath:+:}${i}"
- fi
-done
-PATH=$tmppath
-
-# and remove the gmx part of manpath
-tmppath=""
-for i in `echo $MANPATH | sed "s/:/ /g"`; do
- if test "$i" != "$GMXMAN"; then
- tmppath="${tmppath}${tmppath:+:}${i}"
- fi
-done
-MANPATH=$tmppath
-
-##########################################################
-# This is the real configuration part. We save the Gromacs
-# things in separate vars, so we can remove them later.
-# If you move gromacs, change the next four line.
-##########################################################
-GMXBIN=@bindir@
-GMXLDLIB=@libdir@
-GMXMAN=@mandir@
-GMXDATA=@datadir@
-
-LD_LIBRARY_PATH=${GMXLDLIB}${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}
-PKG_CONFIG_PATH=${GMXLDLIB}/pkgconfig${PKG_CONFIG_PATH:+:}${PKG_CONFIG_PATH}
-PATH=${GMXBIN}${PATH:+:}${PATH}
-#debian/ubuntu needs a : at the end
-MANPATH=${GMXMAN}:${MANPATH}
-
-# export should be separate, so /bin/sh understands it
-export GMXBIN GMXLDLIB GMXMAN GMXDATA LD_LIBRARY_PATH PATH MANPATH PKG_CONFIG_PATH
-
-# END COPY
-
-# read zsh completions if understand how to use them
-if compctl >& /dev/null; then
- if [ -f $GMXBIN/completion.zsh ]; then
- source $GMXBIN/completion.zsh;
- fi
-fi
-
+++ /dev/null
- ## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-# These scripts don't depend on single/double/mpi, so don't suffix names
-transform=
-
-# Scripts generated at compile time
-bin_SCRIPTS = GMXRC GMXRC.csh GMXRC.bash GMXRC.zsh
-
-# Distributed scripts
-dist_bin_SCRIPTS = \
- completion.csh completion.bash completion.zsh \
- demux.pl xplor2gmx.pl
-
-
-# Scripts that will not be installed
-EXTRA_SCRIPTS = grompplog2top make_gromos_nb.pl \
- make_gromos_rtp.py make_gromos_bon.pl make_gromos_rtp.pl \
- CMakeLists.txt GMXRC.cmakein GMXRC.bash.cmakein \
- GMXRC.csh.cmakein GMXRC.zsh.cmakein
-
-
-
-# Extra files we need
-EXTRA_DIST = $(EXTRA_SCRIPTS) \
- GMXRC.in GMXRC.csh.in GMXRC.bash.in GMXRC.zsh.in
-
-GMXRC: GMXRC.in Makefile
- cat $(srcdir)/GMXRC.in | sed 's,@bindir\@,$(bindir),' > GMXRC
-
-GMXRC.csh: GMXRC.csh.in Makefile
- cat $(srcdir)/GMXRC.csh.in | sed 's,@libdir\@,$(libdir),' | \
- sed 's,@bindir\@,$(bindir),' | \
- sed 's,@datadir\@,$(datadir),' | \
- sed 's,@mandir\@,$(mandir),' > GMXRC.csh
-
-GMXRC.bash: GMXRC.bash.in Makefile
- cat $(srcdir)/GMXRC.bash.in | sed 's,@libdir\@,$(libdir),' | \
- sed 's,@bindir\@,$(bindir),' | \
- sed 's,@datadir\@,$(datadir),' | \
- sed 's,@mandir\@,$(mandir),' > GMXRC.bash
-
-GMXRC.zsh: GMXRC.zsh.in Makefile
- cat $(srcdir)/GMXRC.zsh.in | sed 's,@libdir\@,$(libdir),' | \
- sed 's,@bindir\@,$(bindir),' | \
- sed 's,@datadir\@,$(datadir),' | \
- sed 's,@mandir\@,$(mandir),' > GMXRC.zsh
-
-CLEANFILES = GMXRC GMXRC.csh GMXRC.bash GMXRC.zsh \\\#* *~
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-SUBDIRS = top tutor template html
-
-CLEANFILES = *~ \\\#*
\ No newline at end of file
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-SUBDIRS = . images online
-
-htmldir = ${pkgdatadir}/html
-
-html_DATA = online.html gmxfaq.html
-
-EXTRA_DIST = ${html_DATA}
-
-CLEANFILES = *~ \\\#*
-
-
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-htmldir = ${pkgdatadir}/html
-
-imagedir = ${htmldir}/images
-
-image_DATA = \
- features.gif \
- flow_leftrightup.gif flow_vrule.gif \
- flow_down.gif \
- flow_leftup.gif links.gif \
- articles.gif flow_downleft.gif \
- flow_right+left.gif mail.gif \
- bench.gif flow_hline.gif \
- flow_right.gif manual.gif \
- charts_down.gif flow_left.gif \
- flow_rightleftdown.gif gmxlogo_small.jpg \
- charts_up.gif flow_leftright.gif \
- flow_uprightleft.gif software.gif \
- faq.gif flow_leftrightdown.gif \
- flow_vline.gif topologies.gif \
- plotje.gif xvgr.gif \
- 1ctf-0.jpg 1ctf-0.2.jpg \
- 1ctf-0.5.jpg 1ctf-1.jpg \
- 1ctf-4.jpg 1ctf-10.jpg
-
-EXTRA_DIST = ${image_DATA}
-
-CLEANFILES = *~ \\\#*
-
-
-
-
-
-
-
-
-
-
-
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-htmldir = ${pkgdatadir}/html
-
-onlinedir = ${htmldir}/online
-
-online_DATA = \
- cpt.html \
- dat.html g_disre.html g_sorient.html ndx.html \
- dlg.html g_dist.html g_tcaf.html ngmx.html \
- do_dssp.html g_dyndom.html g_traj.html \
- edi.html g_enemat.html g_velacc.html options.html \
- editconf.html g_energy.html genbox.html out.html \
- edo.html g_gyrate.html genconf.html pdb.html \
- edr.html g_h2order.html genion.html pdb2gmx.html \
- ene.html g_hbond.html genpr.html protonate.html \
- eneconv.html g_helix.html getting_started.html rtp.html \
- eps.html g_lie.html gmxcheck.html tex.html \
- files.html g_mdmat.html gmxdump.html top.html \
- flow.html g_mindist.html gro.html tpa.html \
- g87.html g_morph.html grompp.html tpb.html \
- g96.html g_msd.html hat.html tpbconv.html \
- g_anaeig.html g_nmeig.html highway.html tpr.html \
- g_analyze.html g_nmens.html include_bot.html trj.html \
- g_angle.html g_order.html include_top.html trjcat.html \
- g_bond.html g_potential.html itp.html trjconv.html \
- g_bundle.html g_rama.html log.html trjorder.html \
- g_chi.html g_rdf.html m2p.html trr.html \
- g_cluster.html g_rms.html make_ndx.html wheel.html \
- g_confrms.html g_rmsdist.html map.html x2top.html \
- g_covar.html g_rmsf.html mdp.html xpm.html \
- g_density.html g_rotacf.html mdp_opt.html xpm2ps.html \
- g_dielectric.html g_saltbr.html mdrun.html xrama.html \
- g_dih.html g_sas.html mk_angndx.html xtc.html \
- g_dipoles.html g_sgangle.html mtx.html xvg.html \
- g_densmap.html g_sham.html make_edi.html g_densorder.html \
- style.css \
- water.html gmxdemo.html speptide.html yourown.html \
- methanol.html mixed.html protunf.html
-
-
-EXTRA_DIST = ${online_DATA}
-
-CLEANFILES = *~ \\\#*
nstlog = 5000
nstenergy = 250
nstxtcout = 250
-xtc_grps = Protein
+xtc-grps = Protein
energygrps = Protein SOL
nstlist = 10
-ns_type = grid
+ns-type = grid
rlist = 0.8
coulombtype = cut-off
rcoulomb = 1.4
rvdw = 0.8
tcoupl = Berendsen
tc-grps = Protein SOL
-tau_t = 0.1 0.1
-ref_t = 300 300
+tau-t = 0.1 0.1
+ref-t = 300 300
Pcoupl = Berendsen
-tau_p = 1.0
+tau-p = 1.0
compressibility = 4.5e-5
-ref_p = 1.0
-gen_vel = yes
-gen_temp = 300
-gen_seed = 173529
+ref-p = 1.0
+gen-vel = yes
+gen-temp = 300
+gen-seed = 173529
constraints = all-bonds
</pre>
<hr>
; Force tolerance and initial step-size =
emtol = 100
emstep = 0.01
-; Max number of iterations in relax_shells =
+; Max number of iterations in relax-shells =
niter = 20
; Frequency of steepest descents steps when doing CG =
nstcgsteep = 1000
xtc-precision = 1000
; This selects the subset of atoms for the xtc file. You can =
; select multiple groups. By default all atoms will be written. =
-xtc_grps = Protein
+xtc-grps = Protein
; Selection of energy groups =
energygrps = Protein SOL
; nblist update frequency =
nstlist = 10
; ns algorithm (simple or grid) =
-ns_type = grid
+ns-type = grid
; Periodic boundary conditions: xyz or none =
pbc = xyz
; nblist cut-off =
; Spacing for the PME/PPPM FFT grid =
fourierspacing = 0.12
; FFT grid size, when a value is 0 fourierspacing will be used =
-fourier_nx = 0
-fourier_ny = 0
-fourier_nz = 0
+fourier-nx = 0
+fourier-ny = 0
+fourier-nz = 0
; EWALD/PME/PPPM parameters =
-pme_order = 4
-ewald_rtol = 1e-05
-epsilon_surface = 0
-optimize_fft = no
+pme-order = 4
+ewald-rtol = 1e-05
+epsilon-surface = 0
+optimize-fft = no
; OPTIONS FOR WEAK COUPLING ALGORITHMS =
; Temperature coupling =
; Groups to couple separately =
tc-grps = Protein SOL
; Time constant (ps) and reference temperature (K) =
-tau_t = 0.1 0.1
-ref_t = 300 300
+tau-t = 0.1 0.1
+ref-t = 300 300
; Pressure coupling =
Pcoupl = Berendsen
Pcoupltype = Isotropic
; Time constant (ps), compressibility (1/bar) and reference P (bar) =
-tau_p = 1.0
+tau-p = 1.0
compressibility = 4.5e-5
-ref_p = 1.0
+ref-p = 1.0
; SIMULATED ANNEALING CONTROL =
annealing = no
; Time at which temperature should be zero (ps) =
-zero-temp_time = 0
+zero-temp-time = 0
; GENERATE VELOCITIES FOR STARTUP RUN =
-gen_vel = yes
-gen_temp = 300
-gen_seed = 173529
+gen-vel = yes
+gen-temp = 300
+gen-seed = 173529
; OPTIONS FOR BONDS =
constraints = all-bonds
freezegrps =
freezedim =
cos-acceleration = 0
-energygrp_excl =
+energygrp-excl =
; Electric fields =
; Format is number of terms (int) and for all terms an amplitude (real) =
<li><A HREF="#general"><b>General remarks</b></A>
<p> </p>
<li><A HREF="#pp"><b>preprocessing</b></A> (include, define)
-<li><A HREF="#run"><b>run control</b></A> (integrator, tinit, dt, nsteps, init_step, comm_mode, nstcomm, comm_grps)
-<li><A HREF="#ld"><b>langevin dynamics</b></A> (bd_fric, ld_seed)
+<li><A HREF="#run"><b>run control</b></A> (integrator, tinit, dt, nsteps, init-step, comm-mode, nstcomm, comm-grps)
+<li><A HREF="#ld"><b>langevin dynamics</b></A> (bd-fric, ld-seed)
<li><A HREF="#em"><b>energy minimization</b></A> (emtol, emstep, nstcgsteep)
<li><a HREF="#xmdrun"><b>shell molecular dynamics</b></a>(emtol,niter,fcstep)
<li><a HREF="#tpi"><b>test particle insertion</b></a>(rtpi)
-<li><A HREF="#out"><b>output control</b></A> (nstxout, nstvout, nstfout, nstlog, nstcalcenergy, nstenergy, nstxtcout, xtc_precision, xtc_grps, energygrps)
-<li><A HREF="#nl"><b>neighbor searching</b></A> (nstlist, ns_type, pbc, periodic_molecules, rlist, rlistlong)
-<li><A HREF="#el"><b>electrostatics</b></A> (coulombtype, rcoulomb_switch, rcoulomb, epsilon_r, epsilon_rf)
-<li><A HREF="#vdw"><b>VdW</b></A> (vdwtype, rvdw_switch, rvdw, DispCorr)
-<li><A HREF="#table"><b>tables</b></A> (table-extension, energygrp_table)
-<li><A HREF="#ewald"><b>Ewald</b></A> (fourierspacing, fourier_nx, fourier_ny, fourier_nz, pme_order, ewald_rtol, ewald_geometry, epsilon_surface, optimize_fft)
-<li><A HREF="#tc"><b>Temperature coupling</b></A> (tcoupl, nsttcouple, tc_grps, tau_t, ref_t)
+<li><A HREF="#out"><b>output control</b></A> (nstxout, nstvout, nstfout, nstlog, nstcalcenergy, nstenergy, nstxtcout, xtc-precision, xtc-grps, energygrps)
+<li><A HREF="#nl"><b>neighbor searching</b></A> (nstlist, ns-type, pbc, periodic-molecules, rlist, rlistlong)
+<li><A HREF="#el"><b>electrostatics</b></A> (coulombtype, rcoulomb-switch, rcoulomb, epsilon-r, epsilon-rf)
+<li><A HREF="#vdw"><b>VdW</b></A> (vdwtype, rvdw-switch, rvdw, DispCorr)
+<li><A HREF="#table"><b>tables</b></A> (table-extension, energygrp-table)
+<li><A HREF="#ewald"><b>Ewald</b></A> (fourierspacing, fourier-nx, fourier-ny, fourier-nz, pme-order, ewald-rtol, ewald-geometry, epsilon-surface, optimize-fft)
+<li><A HREF="#tc"><b>Temperature coupling</b></A> (tcoupl, nsttcouple, tc-grps, tau-t, ref-t)
<li><A HREF="#pc"><b>Pressure coupling</b></A> (pcoupl, pcoupltype,
- nstpcouple, tau_p, compressibility, ref_p, refcoord_scaling)
-<li><A HREF="#sa"><b>simulated annealing</b></A> (annealing, annealing_npoints, annealing_time, annealing_temp)
-<li><A HREF="#vel"><b>velocity generation</b></A> (gen_vel, gen_temp, gen_seed)
-<li><A HREF="#bond"><b>bonds</b></A> (constraints, constraint_algorithm, continuation, shake_tol, lincs_order, lincs_iter, lincs_warnangle, morse)
-<li><A HREF="#egexcl"><b>Energy group exclusions</b></A> (energygrp_excl)
-<li><A HREF="#walls"><b>Walls</b></A> (nwall, wall_type, wall_r_linpot, wall_atomtype,
-wall_density, wall_ewald_zfac)
+ nstpcouple, tau-p, compressibility, ref-p, refcoord-scaling)
+<li><A HREF="#sa"><b>simulated annealing</b></A> (annealing, annealing-npoints, annealing-time, annealing-temp)
+<li><A HREF="#vel"><b>velocity generation</b></A> (gen-vel, gen-temp, gen-seed)
+<li><A HREF="#bond"><b>bonds</b></A> (constraints, constraint-algorithm, continuation, shake-tol, lincs-order, lincs-iter, lincs-warnangle, morse)
+<li><A HREF="#egexcl"><b>Energy group exclusions</b></A> (energygrp-excl)
+<li><A HREF="#walls"><b>Walls</b></A> (nwall, wall-type, wall-r-linpot, wall-atomtype,
+wall-density, wall-ewald-zfac)
<li><A HREF="#pull"><b>COM pulling</b></A> (pull, ...)
-<li><A HREF="#nmr"><b>NMR refinement</b></A> (disre, disre_weighting, disre_mixed, disre_fc, disre_tau, nstdisreout, orire, orire_fc, orire_tau, orire_fitgrp, nstorireout)
-<li><A HREF="#free"><b>Free Energy calculations</b></A> (free_energy, init_lambda, delta_lambda, sc_alpha, sc_power, sc_sigma, couple-moltype, couple-lambda0, couple-lambda1, couple-intramol)
-<li><A HREF="#neq"><b>Non-equilibrium MD</b></A> (acc_grps, accelerate, freezegrps, freezedim, cos_acceleration, deform)
-<li><A HREF="#ef"><b>Electric fields</b></A> (E_x, E_xt, E_y, E_yt, E_z, E_zt )
+<li><A HREF="#nmr"><b>NMR refinement</b></A> (disre, disre-weighting, disre-mixed, disre-fc, disre-tau, nstdisreout, orire, orire-fc, orire-tau, orire-fitgrp, nstorireout)
+<li><A HREF="#free"><b>Free Energy calculations</b></A> (free-energy, init-lambda, delta-lambda, sc-alpha, sc-power, sc-sigma, couple-moltype, couple-lambda0, couple-lambda1, couple-intramol)
+<li><A HREF="#neq"><b>Non-equilibrium MD</b></A> (acc-grps, accelerate, freezegrps, freezedim, cos-acceleration, deform)
+<li><A HREF="#ef"><b>Electric fields</b></A> (E-x, E-xt, E-y, E-yt, E-z, E-zt )
<li><A HREF="#qmmm"><b>Mixed quantum/classical dynamics</b></A> (QMMM, QMMM-grps, QMMMscheme, QMmethod, QMbasis, QMcharge, Qmmult, CASorbitals, CASelectrons, SH)
-<li><A HREF="#gbsa"><b>Implicit solvent</b></A> (implicit_solvent, gb_algorithm, nstgbradii, rgbradii, gb_epsilon_solvent, gb_saltconc, gb_obc_alpha, gb_obc_beta, gb_obc_gamma, gb_dielectric_offset, sa_algorithm, sa_surface_tension)
-<li><A HREF="#user"><b>User defined thingies</b></A> (user1_grps, user2_grps, userint1, userint2, userint3, userint4, userreal1, userreal2, userreal3, userreal4)
+<li><A HREF="#gbsa"><b>Implicit solvent</b></A> (implicit-solvent, gb-algorithm, nstgbradii, rgbradii, gb-epsilon-solvent, gb-saltconc, gb-obc-alpha, gb-obc-beta, gb-obc-gamma, gb-dielectric-offset, sa-algorithm, sa-surface-tension)
+<li><A HREF="#adress"><b>AdResS settings</b></A> (adress, adress_type, adress_const_wf, adress_ex_width, adress_hy_width, adress_ex_forcecap, adress_interface_correction, adress_site, adress_reference_coords, adress_tf_grp_names, adress_cg_grp_names)
+<li><A HREF="#user"><b>User defined thingies</b></A> (user1-grps, user2-grps, userint1, userint2, userint3, userint4, userreal1, userreal2, userreal3, userreal4)
<li><A HREF="#idx"><b>Index</b></A>
</ul>
</P>
Depending on the computational cost of the force calculation,
this can take a significant part of the simulation time.
The temperature for one or more groups of atoms
-(<b><A HREF="#tc">tc_grps</A></b>)
-is set with <b><A HREF="#tc">ref_t</A></b> [K],
+(<b><A HREF="#tc">tc-grps</A></b>)
+is set with <b><A HREF="#tc">ref-t</A></b> [K],
the inverse friction constant for each group is set with
-<b><A HREF="#tc">tau_t</A></b> [ps].
+<b><A HREF="#tc">tau-t</A></b> [ps].
The parameter <b><A HREF="#tc">tcoupl</A></b> is ignored.
-The random generator is initialized with <b><A HREF="#ld">ld_seed</A></b>.
-When used as a thermostat, an appropriate value for <b>tau_t</b> is 2 ps,
+The random generator is initialized with <b><A HREF="#ld">ld-seed</A></b>.
+When used as a thermostat, an appropriate value for <b>tau-t</b> is 2 ps,
since this results in a friction that is lower than the internal friction
of water, while it is high enough to remove excess heat
(unless <b>cut-off</b> or <b>reaction-field</b> electrostatics is used).
NOTE: temperature deviations decay twice as fast as with
-a Berendsen thermostat with the same <b>tau_t</b>.</dd>
+a Berendsen thermostat with the same <b>tau-t</b>.</dd>
<dt><b>sd1</b></dt>
<dd> An efficient leap-frog stochastic dynamics integrator.
This integrator is equivalent to <b>sd</b>, except that it requires
-only one Gaussian random number and one constraint step.
-This integrator is less accurate.
-For water the relative error in the temperature with this integrator
-is 0.5 <b>delta_t</b>/<b>tau_t</b>, but for other systems it can be higher.
-Use with care and check the temperature.</dd>
+only one Gaussian random number and one constraint step and is therefore
+significantly faster. Without constraints the accuracy is the same as <b>sd</b>.
+With constraints the accuracy is significantly reduced, so then <b>sd</b>
+will often be preferred.</dd>
<dt><b>bd</b></dt>
<dd>An Euler integrator for Brownian or position Langevin dynamics, the
velocity is the force divided by a friction coefficient
-(<b><A HREF="#ld">bd_fric</A></b> [amu ps<sup>-1</sup>])
-plus random thermal noise (<b><A HREF="#tc">ref_t</A></b>).
-When <b><A HREF="#ld">bd_fric</A></b><tt>=0</tt>, the friction coefficient for each
-particle is calculated as mass/<b><A HREF="#tc">tau_t</A></b>, as for the
+(<b><A HREF="#ld">bd-fric</A></b> [amu ps<sup>-1</sup>])
+plus random thermal noise (<b><A HREF="#tc">ref-t</A></b>).
+When <b><A HREF="#ld">bd-fric</A></b><tt>=0</tt>, the friction coefficient for each
+particle is calculated as mass/<b><A HREF="#tc">tau-t</A></b>, as for the
integrator <tt>sd</tt>.
-The random generator is initialized with <b><A HREF="#ld">ld_seed</A></b>.</dd>
+The random generator is initialized with <b><A HREF="#ld">ld-seed</A></b>.</dd>
<dt><b>steep</b></dt>
<dd>A <!--Idx-->steepest descent<!--EIdx--> algorithm for energy
which is only allowed for single-atom molecules).
Since neighborlist construction is expensive, one can perform several
extra insertions with the same list almost for free.
-The random seed is set with <b><A HREF="#ld">ld_seed</A></b>.
+The random seed is set with <b><A HREF="#ld">ld-seed</A></b>.
The temperature for the Boltzmann weighting is set with
-<b><A HREF="#tc">ref_t</A></b>, this should match the temperature
+<b><A HREF="#tc">ref-t</A></b>, this should match the temperature
of the simulation of the original trajectory.
Dispersion correction is implemented correctly for tpi.
All relevant quantities are written to the file specified with
<tt>sd</tt> and <tt>bd</tt>)</dd>
<dt><b>nsteps: (0)</b></dt>
<dd>maximum number of steps to integrate or minimize, -1 is no maximum</dd>
-<dt><b>init_step: (0)</b></dt>
+<dt><b>init-step: (0)</b></dt>
<dd>The starting step.
-The time at an step i in a run is calculated as: t = <tt>tinit</tt> + <tt>dt</tt>*(<tt>init_step</tt> + i).
-The free-energy lambda is calculated as: lambda = <tt>init_lambda</tt> + <tt>delta_lambda</tt>*(<tt>init_step</tt> + i).
+The time at an step i in a run is calculated as: t = <tt>tinit</tt> + <tt>dt</tt>*(<tt>init-step</tt> + i).
+The free-energy lambda is calculated as: lambda = <tt>init-lambda</tt> + <tt>delta-lambda</tt>*(<tt>init-step</tt> + i).
Also non-equilibrium MD parameters can depend on the step number.
Thus for exact restarts or redoing part of a run it might be necessary to
-set <tt>init_step</tt> to the step number of the restart frame.
+set <tt>init-step</tt> to the step number of the restart frame.
<tt>tpbconv</tt> does this automatically.
</dd>
-<dt><b>comm_mode:</b></dt>
+<dt><b>comm-mode:</b></dt>
<dd><dl compact>
<dt><b>Linear</b></dt>
<dd>Remove center of mass translation</dd>
</dl></dd>
<dt><b>nstcomm: (10) [steps]</b></dt>
<dd>frequency for center of mass motion removal</dd>
-<dt><b>comm_grps:</b></dt>
+<dt><b>comm-grps:</b></dt>
<dd>group(s) for center of mass motion removal, default is the whole system</dd>
</dl>
<h3><!--Idx-->Langevin dynamics<!--EIdx--></h3>
<dl>
-<dt><b>bd_fric: (0) [amu ps<sup>-1</sup>]</b></dt>
+<dt><b>bd-fric: (0) [amu ps<sup>-1</sup>]</b></dt>
<dd>Brownian dynamics friction coefficient.
-When <b>bd_fric</b><tt>=0</tt>, the friction coefficient for each
-particle is calculated as mass/<b><A HREF="#tc">tau_t</A></b>.</dd>
-<dt><b>ld_seed: (1993) [integer]</b></dt>
+When <b>bd-fric</b><tt>=0</tt>, the friction coefficient for each
+particle is calculated as mass/<b><A HREF="#tc">tau-t</A></b>.</dd>
+<dt><b>ld-seed: (1993) [integer]</b></dt>
<dd>used to initialize random generator for thermal noise
for stochastic and Brownian dynamics.
-When <b>ld_seed</b> is set to -1, the seed is calculated from the process ID.
+When <b>ld-seed</b> is set to -1, the seed is calculated from the process ID.
When running BD or SD on multiple processors, each processor uses a seed equal
-to <b>ld_seed</b> plus the processor number.</dd>
+to <b>ld-seed</b> plus the processor number.</dd>
</dl>
<A NAME="em"><br>
energy averages and fluctuations also when <b>nstenergy</b><tt>>1</tt></dd>
<dt><b>nstxtcout: (0) [steps]</b></dt>
<dd>frequency to write coordinates to xtc trajectory</dd>
-<dt><b>xtc_precision: (1000) [real]</b></dt>
+<dt><b>xtc-precision: (1000) [real]</b></dt>
<dd>precision to write to xtc trajectory</dd>
-<dt><b>xtc_grps:</b></dt>
+<dt><b>xtc-grps:</b></dt>
<dd>group(s) to write to xtc trajectory, default the whole system is written
(if <b>nstxtcout</b> > 0)</dd>
<dt><b>energygrps:</b></dt>
</dd>
</dl></dd>
-<dt><b>ns_type:</b></dt>
+<dt><b>ns-type:</b></dt>
<dd><dl compact>
<dt><b>grid</b></dt>
<dd>Make a grid in the box and only check atoms in neighboring grid
<dd>Use no periodic boundary conditions, ignore the box.
To simulate without cut-offs, set all cut-offs to 0 and <b>nstlist</b><tt>=0</tt>.
For best performance without cut-offs, use <b>nstlist</b><tt>=0</tt>,
-<b>ns_type</b><tt>=simple</tt>
+<b>ns-type</b><tt>=simple</tt>
and particle decomposition instead of domain decomposition.</dd>
<dt><b>xy</b></dt>
<dd>Use periodic boundary conditions in x and y directions only.
-This works only with <b>ns_type</b><tt>=grid</tt> and can be used
+This works only with <b>ns-type</b><tt>=grid</tt> and can be used
in combination with <b><a href="#walls">walls</a></b>.
Without walls or with only one wall the system size is infinite
in the z direction. Therefore pressure coupling or Ewald summation
These disadvantages do not apply when two walls are used.</dd>
</dl></dd>
-<dt><b>periodic_molecules:</b></dt>
+<dt><b>periodic-molecules:</b></dt>
<dd><dl compact>
<dt><b>no</b></dt>
<dd>molecules are finite, fast molecular PBC can be used</dd>
Use e.g. <b>rlist</b><tt>=0.9</tt>, <b>rcoulomb</b><tt>=0.9</tt>. The highest magnitude of
wave vectors used in reciprocal space is controlled by <b>fourierspacing</b>.
The relative accuracy of direct/reciprocal space
-is controlled by <b>ewald_rtol</b>.
+is controlled by <b>ewald-rtol</b>.
<br>
NOTE: Ewald scales as O(N<sup>3/2</sup>)
and is thus extremely slow for large systems. It is included mainly for
<dd>Fast Particle-Mesh Ewald electrostatics. Direct space is similar
to the Ewald sum, while the reciprocal part is performed with
FFTs. Grid dimensions are controlled with <b>fourierspacing</b> and the
-interpolation order with <b>pme_order</b>. With a grid spacing of 0.1
+interpolation order with <b>pme-order</b>. With a grid spacing of 0.1
nm and cubic interpolation the electrostatic forces have an accuracy
of 2-3*10<sup>-4</sup>. Since the error from the vdw-cutoff is larger than this you
might try 0.15 nm. When running in parallel the interpolation
<dt><b><!--Idx-->Reaction-Field<!--EIdx--></b></dt>
<dd>Reaction field with Coulomb cut-off <b>rcoulomb</b>,
where <b>rcoulomb</b> ≥ <b>rlist</b>.
-The dielectric constant beyond the cut-off is <b>epsilon_rf</b>.
-The dielectric constant can be set to infinity by setting <b>epsilon_rf</b><tt>=0</tt>.</dd>
+The dielectric constant beyond the cut-off is <b>epsilon-rf</b>.
+The dielectric constant can be set to infinity by setting <b>epsilon-rf</b><tt>=0</tt>.</dd>
<dt><b>Generalized-Reaction-Field</b></dt>
<dd>Generalized reaction field with Coulomb cut-off <b>rcoulomb</b>,
where <b>rcoulomb</b> ≥ <b>rlist</b>.
-The dielectric constant beyond the cut-off is <b>epsilon_rf</b>.
+The dielectric constant beyond the cut-off is <b>epsilon-rf</b>.
The ionic strength is computed from the number of charged
(i.e. with non zero charge) <!--Idx-->charge group<!--EIdx-->s.
The temperature for the GRF potential is set with
-<b><A HREF="#tc">ref_t</A></b> [K].</dd>
+<b><A HREF="#tc">ref-t</A></b> [K].</dd>
<dt><b>Reaction-Field-zero</b></dt>
<dd>In GROMACS normal reaction-field electrostatics leads to bad
energy conservation. <b>Reaction-Field-zero</b> solves this
by making the potential zero beyond the cut-off. It can only
-be used with an infinite dielectric constant (<b>epsilon_rf=0</b>),
+be used with an infinite dielectric constant (<b>epsilon-rf=0</b>),
because only for that value the force vanishes at the cut-off.
<b>rlist</b> should be 0.1 to 0.3 nm larger than <b>rcoulomb</b>
to accommodate for the size of charge groups and diffusion
</dl></dd>
<A NAME="el2">
-<dt><b>rcoulomb_switch: (0) [nm]</b></dt>
+<dt><b>rcoulomb-switch: (0) [nm]</b></dt>
<dd>where to start switching the Coulomb potential</dd>
<dt><b>rcoulomb: (1) [nm]</b></dt>
<dd>distance for the Coulomb <!--Idx-->cut-off<!--EIdx--></dd>
-<dt><b>epsilon_r: (1)</b></dt>
+<dt><b>epsilon-r: (1)</b></dt>
<dd>The relative <!--Idx-->dielectric constant<!--EIdx-->.
A value of 0 means infinity.</dd>
-<dt><b>epsilon_rf: (1)</b></dt>
+<dt><b>epsilon-rf: (0)</b></dt>
<dd>The relative dielectric constant of the reaction field.
This is only used with reaction-field electrostatics.
A value of 0 means infinity.</dd>
where <b>rvdw</b> <tt>≥</tt> <b>rlist</b>.</dd>
<dt><b>Shift</b></dt>
<dd>The LJ (not Buckingham) potential is decreased over the whole
-range and the forces decay smoothly to zero between <b>rvdw_switch</b>
+range and the forces decay smoothly to zero between <b>rvdw-switch</b>
and <b>rvdw</b>. The neighbor search cut-off <b>rlist</b> should be
0.1 to 0.3 nm larger than <b>rvdw</b> to accommodate for the size of
charge groups and diffusion between neighbor list
<dt><b>Switch</b></dt>
<dd>The LJ (not Buckingham)
-potential is normal out to <b>rvdw_switch</b>, after which it is switched
+potential is normal out to <b>rvdw-switch</b>, after which it is switched
off to reach zero at <b>rvdw</b>. Both the potential and force functions
are continuously smooth, but be aware that all switch functions will give rise
to a bulge (increase) in the force (since we are switching the potential).
for <tt>f</tt> and <tt>-f'</tt> are ignored.</dd>
</dl></dd>
-<dt><b>rvdw_switch: (0) [nm]</b></dt>
+<dt><b>rvdw-switch: (0) [nm]</b></dt>
<dd>where to start switching the LJ potential</dd>
<dt><b>rvdw: (1) [nm]</b></dt>
which are always tabulated irrespective of the use of
tables for the non-bonded interactions. </dd>
-<dt><b>energygrp_table:</b></dt>
+<dt><b>energygrp-table:</b></dt>
<dd>When user tables are used for electrostatics and/or VdW,
here one can give pairs of energy groups for which seperate
user tables should be used.
The two energy groups will be appended to the table file name,
in order of their definition in <b>energygrps</b>, seperated by underscores.
For example, if <tt>energygrps = Na Cl Sol</tt>
-and <tt>energygrp_table = Na Na Na Cl</tt>, <tt>mdrun</tt> will read
+and <tt>energygrp-table = Na Na Na Cl</tt>, <tt>mdrun</tt> will read
<tt>table_Na_Na.xvg</tt> and <tt>table_Na_Cl.xvg</tt> in addition
to the normal <tt>table.xvg</tt> which will be used for all other
energy group pairs.
For ordinary Ewald the spacing times the box dimensions determines the
highest magnitude to use in each direction. In all cases
each direction can be overridden by entering a non-zero value for
-<b>fourier_n[xyz]</b>.
+<b>fourier-n[xyz]</b>.
For optimizing the relative load of the particle-particle interactions
and the mesh part of PME it is useful to know that
the accuracy of the electrostatics remains nearly constant
when the Coulomb cut-off and the PME grid spacing are scaled
by the same factor.</dd>
-<dt><b>fourier_nx (0) ; fourier_ny (0) ; fourier_nz: (0)</b></dt>
+<dt><b>fourier-nx (0) ; fourier-ny (0) ; fourier-nz: (0)</b></dt>
<dd>Highest magnitude of wave vectors in reciprocal space when using Ewald.</dd>
<dd>Grid size when using PPPM or PME. These values override
<b>fourierspacing</b> per direction. The best choice is powers of
2, 3, 5 and 7. Avoid large primes.</dd>
-<dt><b>pme_order (4)</b></dt>
+<dt><b>pme-order (4)</b></dt>
<dd>Interpolation order for PME. 4 equals cubic interpolation. You might try
6/8/10 when running in parallel and simultaneously decrease grid dimension.</dd>
-<dt><b>ewald_rtol (1e-5)</b></dt>
+<dt><b>ewald-rtol (1e-5)</b></dt>
<dd>The relative strength of the Ewald-shifted direct potential at
-<b>rcoulomb</b> is given by <b>ewald_rtol</b>.
+<b>rcoulomb</b> is given by <b>ewald-rtol</b>.
Decreasing this will give a more accurate direct sum,
but then you need more wave vectors for the reciprocal sum.</dd>
-<dt><b>ewald_geometry: (3d)</b></dt>
+<dt><b>ewald-geometry: (3d)</b></dt>
<dd><dl compact>
<dt><b>3d</b></dt>
<dd>The Ewald sum is performed in all three dimensions.</dd>
and use this option.</dd>
</dl></dd>
-<dt><b>epsilon_surface: (0)</b></dt>
+<dt><b>epsilon-surface: (0)</b></dt>
<dd>This controls the dipole correction to the Ewald summation in 3D. The
default value of zero means it is turned off. Turn it on by setting it to the value
of the relative permittivity of the imaginary surface around your infinite system. Be
This value does not affect the slab 3DC variant of the long range corrections.</dd>
-<dt><b>optimize_fft:</b></dt>
+<dt><b>optimize-fft:</b></dt>
<dd><dl compact>
<dt><b>no</b></dt>
<dd>Don't calculate the optimal FFT plan for the grid at startup.</dd>
<dd>No temperature coupling.</dd>
<dt><b>berendsen</b></dt>
<dd>Temperature coupling with a Berendsen-thermostat to a bath with
-temperature <b>ref_t</b> [K], with time constant <b>tau_t</b> [ps].
+temperature <b>ref-t</b> [K], with time constant <b>tau-t</b> [ps].
Several groups can be coupled separately, these are specified in the
-<b>tc_grps</b> field separated by spaces.</dd>
+<b>tc-grps</b> field separated by spaces.</dd>
<dt><b>nose-hoover</b></dt>
<dd>Temperature coupling using a Nose-Hoover extended
ensemble. The reference temperature and coupling groups are selected
-as above, but in this case <b>tau_t</b> [ps] controls the period
+as above, but in this case <b>tau-t</b> [ps] controls the period
of the temperature fluctuations at equilibrium, which is slightly
different from a relaxation time.
For NVT simulations the conserved energy quantity is written
<dd>Temperature coupling using velocity rescaling with a stochastic term
(JCP 126, 014101).
This thermostat is similar to Berendsen coupling, with the same scaling
-using <b>tau_t</b>, but the stochastic term ensures that a proper
+using <b>tau-t</b>, but the stochastic term ensures that a proper
canonical ensemble is generated. The random seed is set with
-<b><A HREF="#ld">ld_seed</A></b>.
-This thermostat works correctly even for <b>tau_t</b><tt>=0</tt>.
+<b><A HREF="#ld">ld-seed</A></b>.
+This thermostat works correctly even for <b>tau-t</b><tt>=0</tt>.
For NVT simulations the conserved energy quantity is written
to the energy and log file.</dd>
</dl>
</dd>
<dt><b>nh-chain-length (10)</b></dt>
<dd>the number of chained Nose-Hoover thermostats for velocity Verlet integrators, the leap-frog <b>md</b> integrator only supports 1. Data for the NH chain variables is not printed to the .edr, but can be using the <tt>GMX_NOSEHOOVER_CHAINS</tt> environment variable</dd>
-<dt><b>tc_grps:</b></dt>
+<dt><b>tc-grps:</b></dt>
<dd>groups to couple separately to temperature bath</dd>
-<dt><b>tau_t: [ps]</b></dt>
-<dd>time constant for coupling (one for each group in <b>tc_grps</b>),
+<dt><b>tau-t: [ps]</b></dt>
+<dd>time constant for coupling (one for each group in <b>tc-grps</b>),
-1 means no temperature coupling</dd>
-<dt><b>ref_t: [K]</b></dt>
-<dd>reference temperature for coupling (one for each group in <b>tc_grps</b>)</dd>
+<dt><b>ref-t: [K]</b></dt>
+<dd>reference temperature for coupling (one for each group in <b>tc-grps</b>)</dd>
</dl>
<A NAME="pc"><br>
<dd>No pressure coupling. This means a fixed box size.</dd>
<dt><b>berendsen</b></dt>
<dd>Exponential relaxation pressure coupling with time constant
-<b>tau_p</b> [ps]. The box is scaled every timestep. It has been
+<b>tau-p</b> [ps]. The box is scaled every timestep. It has been
argued that this does not yield a correct thermodynamic ensemble,
but it is the most efficient way to scale a box at the beginning
of a run.</dd>
<dd>Extended-ensemble pressure coupling where the box vectors are
subject to an equation of motion. The equation of motion for the atoms
is coupled to this. No instantaneous scaling takes place. As for
-Nose-Hoover temperature coupling the time constant <b>tau_p</b> [ps]
+Nose-Hoover temperature coupling the time constant <b>tau-p</b> [ps]
is the period of pressure fluctuations at equilibrium. This is
probably a better method when you want to apply pressure scaling
during data collection, but beware that you can get very large
<dt><b>MTTK</b></dt>
<dd>Martyna-Tuckerman-Tobias-Klein implementation, only useable with <b>md-vv</b>
or <b>md-vv-avek</b>, very similar to Parrinello-Rahman.
-As for Nose-Hoover temperature coupling the time constant <b>tau_p</b>
+As for Nose-Hoover temperature coupling the time constant <b>tau-p</b>
[ps] is the period of pressure fluctuations at equilibrium. This is
probably a better method when you want to apply pressure scaling
during data collection, but beware that you can get very large
<dt><b>pcoupltype:</b></dt>
<dd><dl compact>
<dt><b>isotropic</b></dt>
-<dd>Isotropic pressure coupling with time constant <b>tau_p</b> [ps].
+<dd>Isotropic pressure coupling with time constant <b>tau-p</b> [ps].
The compressibility and reference pressure are set with
-<b>compressibility</b> [bar<sup>-1</sup>] and <b>ref_p</b> [bar], one
+<b>compressibility</b> [bar<sup>-1</sup>] and <b>ref-p</b> [bar], one
value is needed.</dd>
<dt><b>semiisotropic</b></dt>
<dd>Pressure coupling which is isotropic in the <tt>x</tt> and <tt>y</tt> direction,
<dd>Surface tension coupling for surfaces parallel to the xy-plane.
Uses normal pressure coupling for the <tt>z</tt>-direction, while the surface tension
is coupled to the <tt>x/y</tt> dimensions of the box.
-The first <b>ref_p</b> value is the reference surface tension times
+The first <b>ref-p</b> value is the reference surface tension times
the number of surfaces [bar nm],
the second value is the reference <tt>z</tt>-pressure [bar].
The two <b>compressibility</b> [bar<sup>-1</sup>] values are the compressibility
For velocity Verlet integrators <b>nstpcouple</b> is set to 1.</dd>
</dd>
-<dt><b>tau_p: (1) [ps]</b></dt>
+<dt><b>tau-p: (1) [ps]</b></dt>
<dd>time constant for coupling</dd>
<dt><b>compressibility: [bar<sup>-1</sup>]</b></dt>
<dd>compressibility (NOTE: this is now really in bar<sup>-1</sup>)
For water at 1 atm and 300 K the compressibility is 4.5e-5 [bar<sup>-1</sup>].</dd>
-<dt><b>ref_p: [bar]</b></dt>
+<dt><b>ref-p: [bar]</b></dt>
<dd>reference pressure for coupling</dd>
-<dt><b>refcoord_scaling:</b></dt>
+<dt><b>refcoord-scaling:</b></dt>
<dd><dl compact>
<dt><b>no</b></dt>
<dd>The reference coordinates for position restraints are not modified.
</dd>
</dl>
-<dt><b>annealing_npoints:</b></dt>
+<dt><b>annealing-npoints:</b></dt>
<dd>A list with the number of annealing reference/control points used for
each temperature group. Use 0 for groups that are not annealed. The number of entries should equal the number of temperature groups.</dd>
-<dt><b>annealing_time:</b></dt>
-<dd>List of times at the annealing reference/control points for each group. If you are using periodic annealing, the times will be used modulo the last value, i.e. if the values are 0, 5, 10, and 15, the coupling will restart at the 0ps value after 15ps, 30ps, 45ps, etc. The number of entries should equal the sum of the numbers given in <tt>annealing_npoints</tt>.</dd>
+<dt><b>annealing-time:</b></dt>
+<dd>List of times at the annealing reference/control points for each group. If you are using periodic annealing, the times will be used modulo the last value, i.e. if the values are 0, 5, 10, and 15, the coupling will restart at the 0ps value after 15ps, 30ps, 45ps, etc. The number of entries should equal the sum of the numbers given in <tt>annealing-npoints</tt>.</dd>
-<dt><b>annealing_temp:</b></dt>
-<dd>List of temperatures at the annealing reference/control points for each group. The number of entries should equal the sum of the numbers given in <tt>annealing_npoints</tt>.</dd>
+<dt><b>annealing-temp:</b></dt>
+<dd>List of temperatures at the annealing reference/control points for each group. The number of entries should equal the sum of the numbers given in <tt>annealing-npoints</tt>.</dd>
<br>
-Confused? OK, let's use an example. Assume you have two temperature groups, set the group selections to <tt>annealing = single periodic</tt>, the number of points of each group to <tt>annealing_npoints = 3 4</tt>, the times to <tt>annealing_time = 0 3 6 0 2 4 6</tt> and finally temperatures to <tt>annealing_temp = 298 280 270 298 320 320 298</tt>.
+Confused? OK, let's use an example. Assume you have two temperature groups, set the group selections to <tt>annealing = single periodic</tt>, the number of points of each group to <tt>annealing-npoints = 3 4</tt>, the times to <tt>annealing-time = 0 3 6 0 2 4 6</tt> and finally temperatures to <tt>annealing-temp = 298 280 270 298 320 320 298</tt>.
The first group will be coupled to 298K at 0ps, but the reference temperature will drop linearly to reach 280K at 3ps, and then linearly between 280K and 270K from 3ps to 6ps. After this is stays constant, at 270K. The second group is coupled to 298K at 0ps, it increases linearly to 320K at 2ps, where it stays constant until 4ps. Between 4ps and 6ps it decreases to 298K, and then it starts over with the same pattern again, i.e. rising linearly from 298K to 320K between 6ps and 8ps. Check the summary printed by <tt>grompp</tt> if you are unsure!
</dl>
<h3>Velocity generation</h3>
<dl>
-<dt><b>gen_vel:</b></dt>
+<dt><b>gen-vel:</b></dt>
<dd><dl compact>
<dt><b>no</b></dt>
<dd> Do not generate velocities. The velocities are set to zero
when there are no velocities in the input structure file.</dd>
<dt><b>yes</b></dt>
<dd>Generate velocities in <tt>grompp</tt> according to a Maxwell distribution at
-temperature <b>gen_temp</b> [K], with random seed <b>gen_seed</b>.
+temperature <b>gen-temp</b> [K], with random seed <b>gen-seed</b>.
This is only meaningful with integrator <b><A HREF="#run">md</A></b>.</dd>
</dl></dd>
-<dt><b>gen_temp: (300) [K]</b></dt>
+<dt><b>gen-temp: (300) [K]</b></dt>
<dd>temperature for Maxwell distribution</dd>
-<dt><b>gen_seed: (173529) [integer]</b></dt>
+<dt><b>gen-seed: (173529) [integer]</b></dt>
<dd>used to initialize random generator for random velocities,
-when <b>gen_seed</b> is set to -1, the seed is calculated from
+when <b>gen-seed</b> is set to -1, the seed is calculated from
the process ID number.
</dl>
<dd>Convert all bonds and angles to bond-constraints.</dd>
</dl>
-<dt><b>constraint_algorithm:</b></dt>
+<dt><b>constraint-algorithm:</b></dt>
<dd><dl compact>
<dt><b><!--Idx-->LINCS<!--EIdx--></b></dt>
<dd>LINear Constraint Solver.
With domain decomposition the parallel version P-LINCS is used.
The accuracy in set with
-<b>lincs_order</b>, which sets the number of matrices in the expansion
+<b>lincs-order</b>, which sets the number of matrices in the expansion
for the matrix inversion.
After the matrix inversion correction the algorithm does
an iterative correction to compensate for lengthening due to rotation.
The number of such iterations can be controlled with
-<b>lincs_iter</b>. The root mean square relative constraint deviation
+<b>lincs-iter</b>. The root mean square relative constraint deviation
is printed to the log file every <b>nstlog</b> steps.
-If a bond rotates more than <b>lincs_warnangle</b> [degrees] in one step,
+If a bond rotates more than <b>lincs-warnangle</b> [degrees] in one step,
a warning will be printed both to the log file and to <TT>stderr</TT>.
LINCS should not be used with coupled angle constraints.
</dd>
<dt><b><!--Idx-->SHAKE<!--EIdx--></b></dt>
<dd>SHAKE is slightly slower and less stable than LINCS, but does work with
angle constraints.
-The relative tolerance is set with <b>shake_tol</b>, 0.0001 is a good value
+The relative tolerance is set with <b>shake-tol</b>, 0.0001 is a good value
for ``normal'' MD. SHAKE does not support constraints between atoms
on different nodes, thus it can not be used with domain decompositon
when inter charge-group constraints are present.
</dd>
</dl></dd>
<dt><b>continuation:</b></dt>
-<dd>This option was formerly known as <tt>unconstrained_start</tt>.</dd>
+<dd>This option was formerly known as <tt>unconstrained-start</tt>.</dd>
<dd><dl compact>
<dt><b>no</b></dt>
<dd>apply constraints to the start configuration and reset shells</dd>
</dl></dd>
<A NAME="bond2">
-<dt><b>shake_tol: (0.0001)</b></dt>
+<dt><b>shake-tol: (0.0001)</b></dt>
<dd>relative tolerance for SHAKE</dd>
-<dt><b>lincs_order: (4)</b></dt>
+<dt><b>lincs-order: (4)</b></dt>
<dd>Highest order in the expansion of the constraint coupling matrix.
When constraints form triangles, an additional expansion of the same
order is applied on top of the normal expansion only for the couplings
needed for large time-steps with virtual sites or BD.
For accurate energy minimization an order of 8 or more might be required.
With domain decomposition, the cell size is limited by the distance
-spanned by <b>lincs_order</b>+1 constraints. When one wants to scale
-further than this limit, one can decrease <b>lincs_order</b> and increase
-<b>lincs_iter</b>, since the accuracy does not deteriorate
-when (1+<b>lincs_iter</b>)*<b>lincs_order</b> remains constant.</dd>
-<dt><b>lincs_iter: (1)</b></dt>
+spanned by <b>lincs-order</b>+1 constraints. When one wants to scale
+further than this limit, one can decrease <b>lincs-order</b> and increase
+<b>lincs-iter</b>, since the accuracy does not deteriorate
+when (1+<b>lincs-iter</b>)*<b>lincs-order</b> remains constant.</dd>
+<dt><b>lincs-iter: (1)</b></dt>
<dd>Number of iterations to correct for rotational lengthening in LINCS.
For normal runs a single step is sufficient, but for NVE
runs where you want to conserve energy accurately or for accurate
energy minimization you might want to increase it to 2.
-<dt><b>lincs_warnangle: </b>(30) [degrees]</dt>
+<dt><b>lincs-warnangle: </b>(30) [degrees]</dt>
<dd>maximum angle that a bond can rotate before LINCS will complain</dd>
<dt><b>morse:</b></dt>
<hr>
<h3>Energy group <!--Idx-->exclusions<!--EIdx--></h3>
<dl>
-<dt><b>energygrp_excl: </b></dt>
+<dt><b>energygrp-excl: </b></dt>
<dd>Pairs of energy groups for which all non-bonded interactions are
excluded. An example: if you have two energy groups <tt>Protein</tt>
and <tt>SOL</tt>, specifying
<br>
-<tt>energygrp_excl = Protein Protein SOL SOL</tt>
+<tt>energygrp-excl = Protein Protein SOL SOL</tt>
<br>
would give only the non-bonded interactions between the protein and the
solvent. This is especially useful for speeding up energy calculations with
<dl>
<dt><b>nwall: 0</b></dt>
<dd>When set to <b>1</b> there is a wall at <tt>z=0</tt>, when set to <b>2</b>
-there is also a wall at <tt>z=z_box</tt>. Walls can only be used with <b>pbc=xy</b>.
+there is also a wall at <tt>z=z-box</tt>. Walls can only be used with <b>pbc=xy</b>.
When set to <b>2</b> pressure coupling and Ewald summation can be used
(it is usually best to use semiisotropic pressure coupling with
the <tt>x/y</tt> compressibility set to 0, as otherwise the surface area will change).
-Walls interact wit the rest of the system through an optional <tt>wall_atomtype</tt>.
+Walls interact wit the rest of the system through an optional <tt>wall-atomtype</tt>.
Energy groups <tt>wall0</tt> and <tt>wall1</tt> (for <b>nwall=2</b>) are
added automatically to monitor the interaction of energy groups
with each wall.
The <A HREF="#run">center of mass motion removal</A> will be turned
off in the <tt>z</tt>-direction.</dd>
-<dt><b>wall_atomtype:</b></dt>
+<dt><b>wall-atomtype:</b></dt>
<dd>the atom type name in the force field for each wall.
By (for example) defining a special wall atom type in the topology with its
own combination rules, this allows for independent tuning of the interaction
of each atomtype with the walls.</dd>
-<dt><b>wall_type:</b></dt>
+<dt><b>wall-type:</b></dt>
<dd><dl compact>
<dt><b>9-3</b></dt>
<dd>LJ integrated over the volume behind the wall: 9-3 potential</dd>
<dt><b>12-6</b></dt>
<dd>direct LJ potential with the z distance from the wall</dd>
<dt><b>table</b></dt><dd>user defined potentials indexed with the z distance from the wall, the tables are read analogously to
-the <b><A HREF="#table">energygrp_table</A></b> option,
+the <b><A HREF="#table">energygrp-table</A></b> option,
where the first name is for a ``normal'' energy group and the second name
is <tt>wall0</tt> or <tt>wall1</tt>,
only the dispersion and repulsion columns are used</dd>
</dl></dd>
-<dt><b>wall_r_linpot: -1 (nm)</b></dt>
+<dt><b>wall-r-linpot: -1 (nm)</b></dt>
<dd>Below this distance from the wall the potential is continued
linearly and thus the force is constant. Setting this option to
a postive value is especially useful for equilibration when some atoms
are beyond a wall.
-When the value is ≤0 (<0 for <b>wall_type=table</b>),
+When the value is ≤0 (<0 for <b>wall-type=table</b>),
a fatal error is generated when atoms are beyond a wall.
</dd>
-<dt><b>wall_density: [nm<sup>-3</sup>/nm<sup>-2</sup>]</b></dt>
+<dt><b>wall-density: [nm<sup>-3</sup>/nm<sup>-2</sup>]</b></dt>
<dd>the number density of the atoms for each wall for wall types
<b>9-3</b> and <b>10-4</b>
-<dt><b>wall_ewald_zfac: 3</b></dt>
+<dt><b>wall-ewald-zfac: 3</b></dt>
<dd>The scaling factor for the third box vector for Ewald summation only,
the minimum is 2.
Ewald summation can only be used with <b>nwall=2</b>, where one
-should use <b><A HREF="#ewald">ewald_geometry</A><tt>=3dc</tt></b>.
+should use <b><A HREF="#ewald">ewald-geometry</A><tt>=3dc</tt></b>.
The empty layer in the box serves to decrease the unphysical Coulomb
interaction between periodic images.
</dl>
between the reference group and one or more groups.
The setup is identical to the option <b>umbrella</b>, except for the fact
that a rigid constraint is applied instead of a harmonic potential.</dd>
-<dt><b>constant_force</b></dt>
+<dt><b>constant-force</b></dt>
<dd>Center of mass pulling using a linear potential and therefore
a constant force. For this option there is no reference position
-and therefore the parameters <b>pull_init</b> and <b>pull_rate</b>
+and therefore the parameters <b>pull-init</b> and <b>pull-rate</b>
are not used.</dd>
</dl></dd>
-<dt><b>pull_geometry:</b></dt>
+<dt><b>pull-geometry:</b></dt>
<dd><dl compact>
<dt><b>distance</b></dt>
<dd>Pull along the vector connecting the two groups.
-Components can be selected with <b>pull_dim</b>.</dd>
+Components can be selected with <b>pull-dim</b>.</dd>
<dt><b>direction</b></dt>
-<dd>Pull in the direction of <b>pull_vec</b>.</dd>
-<dt><b>direction_periodic</b></dt>
+<dd>Pull in the direction of <b>pull-vec</b>.</dd>
+<dt><b>direction-periodic</b></dt>
<dd>As <b>direction</b>, but allows the distance to be larger than
half the box size. With this geometry the box should not be dynamic
(e.g. no pressure scaling) in the pull dimensions and the pull force
<dt><b>cylinder</b></dt>
<dd>Designed for pulling with respect to a layer where the reference COM
is given by a local cylindrical part of the reference group.
-The pulling is in the direction of <b>pull_vec</b>.
+The pulling is in the direction of <b>pull-vec</b>.
From the reference group a cylinder is selected around the axis going
-through the pull group with direction <b>pull_vec</b> using two radii.
-The radius <b>pull_r1</b> gives the radius within which all
-the relative weights are one, between <b>pull_r1</b> and
-<b>pull_r0</b> the weights are switched to zero. Mass weighting is also used.
+through the pull group with direction <b>pull-vec</b> using two radii.
+The radius <b>pull-r1</b> gives the radius within which all
+the relative weights are one, between <b>pull-r1</b> and
+<b>pull-r0</b> the weights are switched to zero. Mass weighting is also used.
Note that the radii should be smaller than half the box size.
For tilted cylinders they should be even smaller than half the box size
since the distance of an atom in the reference group
from the COM of the pull group has both a radial and an axial component.
<dt><b>position</b></dt>
<dd>Pull to the position of the reference group plus
-<b>pull_init</b> + time*<b>pull_rate</b>*<b>pull_vec</b>.</dd>
+<b>pull-init</b> + time*<b>pull-rate</b>*<b>pull-vec</b>.</dd>
</dl></dd>
-<dt><b>pull_dim: (Y Y Y)</b></dt>
+<dt><b>pull-dim: (Y Y Y)</b></dt>
<dd>the distance components to be used with geometry <b>distance</b>
and <b>position</b>, and also sets which components are printed
to the output files</dd>
-<dt><b>pull_r1: (1) [nm]</b></dt>
+<dt><b>pull-r1: (1) [nm]</b></dt>
<dd>the inner radius of the cylinder for geometry <b>cylinder</b></dd>
-<dt><b>pull_r0: (1) [nm]</b></dt>
+<dt><b>pull-r0: (1) [nm]</b></dt>
<dd>the outer radius of the cylinder for geometry <b>cylinder</b></dd>
-<dt><b>pull_constr_tol: (1e-6)</b></dt>
+<dt><b>pull-constr-tol: (1e-6)</b></dt>
<dd>the relative constraint tolerance for constraint pulling</dd>
-<dt><b>pull_start:</b></dt>
+<dt><b>pull-start:</b></dt>
<dd><dl compact>
<dt><b>no</b></dt>
-<dd>do not modify <b>pull_init</b>
+<dd>do not modify <b>pull-init</b>
<dt><b>yes</b></dt>
-<dd>add the COM distance of the starting conformation to <b>pull_init</b></dd>
+<dd>add the COM distance of the starting conformation to <b>pull-init</b></dd>
</dl>
-<dt><b>pull_nstxout: (10)</b></dt>
+<dt><b>pull-nstxout: (10)</b></dt>
<dd>frequency for writing out the COMs of all the pull group</dd>
-<dt><b>pull_nstfout: (1)</b></dt>
+<dt><b>pull-nstfout: (1)</b></dt>
<dd>frequency for writing out the force of all the pulled group</dd>
-<dt><b>pull_ngroups: (1)</b></dt>
+<dt><b>pull-ngroups: (1)</b></dt>
<dd>The number of pull groups, not including the reference group.
If there is only one group, there is no difference in treatment
of the reference and pulled group (except with the cylinder geometry).
and the first group (ending on 1) are given,
further groups work analogously, but with the number 1 replaced
by the group number.</dd>
-<dt><b>pull_group0: </b></dt>
+<dt><b>pull-group0: </b></dt>
<dd>The name of the reference group. When this is empty an absolute reference
of (0,0,0) is used. With an absolute reference the system is no longer
translation invariant and one should think about what to do with
the <A HREF="#run">center of mass motion</A>.</dd>
-<dt><b>pull_weights0: </b></dt>
-<dd>see <b>pull_weights1</b></dd>
-<dt><b>pull_pbcatom0: (0)</b></dt>
-<dd>see <b>pull_pbcatom1</b></dd>
-<dt><b>pull_group1: </b></dt>
+<dt><b>pull-weights0: </b></dt>
+<dd>see <b>pull-weights1</b></dd>
+<dt><b>pull-pbcatom0: (0)</b></dt>
+<dd>see <b>pull-pbcatom1</b></dd>
+<dt><b>pull-group1: </b></dt>
<dd>The name of the pull group.</dd>
-<dt><b>pull_weights1: </b></dt>
+<dt><b>pull-weights1: </b></dt>
<dd>Optional relative weights which are multiplied with the masses of the atoms
to give the total weight for the COM. The number should be 0, meaning all 1,
or the number of atoms in the pull group.</dd>
-<dt><b>pull_pbcatom1: (0)</b></dt>
+<dt><b>pull-pbcatom1: (0)</b></dt>
<dd>The reference atom for the treatment of periodic boundary conditions
inside the group
(this has no effect on the treatment of the pbc between groups).
This option is only important when the diameter of the pull group
is larger than half the shortest box vector.
For determining the COM, all atoms in the group are put at their periodic image
-which is closest to <b>pull_pbcatom1</b>.
+which is closest to <b>pull-pbcatom1</b>.
A value of 0 means that the middle atom (number wise) is used.
This parameter is not used with geometry <b>cylinder</b>.
A value of -1 turns on cosine weighting, which is useful for a group
of molecules in a periodic system, e.g. a water slab (see Engin et al.
J. Chem. Phys. B 2010).</dd>
-<dt><b>pull_vec1: (0.0 0.0 0.0)</b></dt>
+<dt><b>pull-vec1: (0.0 0.0 0.0)</b></dt>
<dd>The pull direction. <tt>grompp</tt> normalizes the vector.</dd>
-<dt><b>pull_init1: (0.0) / (0.0 0.0 0.0) [nm]</b></dt>
+<dt><b>pull-init1: (0.0) / (0.0 0.0 0.0) [nm]</b></dt>
<dd>The reference distance at t=0. This is a single value,
except for geometry <b>position</b> which uses a vector.</dd>
-<dt><b>pull_rate1: (0) [nm/ps]</b></dt>
+<dt><b>pull-rate1: (0) [nm/ps]</b></dt>
<dd>The rate of change of the reference position.</dd>
-<dt><b>pull_k1: (0) [kJ mol<sup>-1</sup> nm<sup>-2</sup>] / [kJ mol<sup>-1</sup> nm<sup>-1</sup>]</b></dt>
+<dt><b>pull-k1: (0) [kJ mol<sup>-1</sup> nm<sup>-2</sup>] / [kJ mol<sup>-1</sup> nm<sup>-1</sup>]</b></dt>
<dd>The force constant. For umbrella pulling this is the harmonic force
constant in [kJ mol<sup>-1</sup> nm<sup>-2</sup>]. For constant force pulling
this is the force constant of the linear potential, and thus minus (!)
the constant force in [kJ mol<sup>-1</sup> nm<sup>-1</sup>].</dd>
-<dt><b>pull_kB1: (pull_k1) [kJ mol<sup>-1</sup> nm<sup>-2</sup>] / [kJ mol<sup>-1</sup> nm<sup>-1</sup>]</b></dt>
-<dd>As <b>pull_k1</b>, but for state B. This is only used when
-<A HREF="#free"><b>free_energy</b></A> is turned on.
-The force constant is then (1 - lambda)*<b>pull_k1</b> + lambda*<b>pull_kB1</b>.
+<dt><b>pull-kB1: (pull-k1) [kJ mol<sup>-1</sup> nm<sup>-2</sup>] / [kJ mol<sup>-1</sup> nm<sup>-1</sup>]</b></dt>
+<dd>As <b>pull-k1</b>, but for state B. This is only used when
+<A HREF="#free"><b>free-energy</b></A> is turned on.
+The force constant is then (1 - lambda)*<b>pull-k1</b> + lambda*<b>pull-kB1</b>.
</dl>
<A NAME="nmr"><br>
should only be used for special cases, such as dimers
(this option is not fuctional in the current version of GROMACS)</dd>
</dl></dd>
-<dt><b>disre_weighting:</b></dt>
+<dt><b>disre-weighting:</b></dt>
<dd><dl compact>
<dt><b>conservative</b></dt>
<dd>the forces are the derivative of the restraint potential,
<dt><b>equal</b></dt>
<dd>divide the restraint force equally over all atom pairs in the restraint</dd>
</dl></dd>
-<dt><b>disre_mixed:</b></dt>
+<dt><b>disre-mixed:</b></dt>
<dd><dl compact>
<dt><b>no</b></dt>
<dd>the violation used in the calculation of the restraint force is the
square root of the time averaged violation times the instantaneous violation </dd>
</dl></dd>
-<dt><b>disre_fc: (1000) [kJ mol<sup>-1</sup> nm<sup>-2</sup>]</b></dt>
+<dt><b>disre-fc: (1000) [kJ mol<sup>-1</sup> nm<sup>-2</sup>]</b></dt>
<dd>force constant for distance restraints, which is multiplied by a
(possibly) different factor for each restraint</dd>
-<dt><b>disre_tau: (0) [ps]</b></dt>
+<dt><b>disre-tau: (0) [ps]</b></dt>
<dd>time constant for distance restraints running average</dd>
<dt><b>nstdisreout: (100) [steps]</b></dt>
<dd>use orientation restraints, ensemble averaging can be performed
with <tt>mdrun -multi</tt></dd>
</dl>
-<dt><b>orire_fc: (0) [kJ mol]</b></dt>
+<dt><b>orire-fc: (0) [kJ mol]</b></dt>
<dd>force constant for orientation restraints, which is multiplied by a
(possibly) different factor for each restraint, can be set to zero to
obtain the orientations from a free simulation</dd>
-<dt><b>orire_tau: (0) [ps]</b></dt>
+<dt><b>orire-tau: (0) [ps]</b></dt>
<dd>time constant for orientation restraints running average</dd>
-<dt><b>orire_fitgrp: </b></dt>
+<dt><b>orire-fitgrp: </b></dt>
<dd>fit group for orientation restraining, for a protein backbone is a good
choice</dd>
<dt><b>nstorireout: (100) [steps]</b></dt>
<h3><!--Idx-->Free energy calculations<!--EIdx--></h3>
<dl>
-<dt><b>free_energy:</b></dt>
+<dt><b>free-energy:</b></dt>
<dd><dl compact>
<dt><b>no</b></dt>
<dd>Only use topology A.</dd>
<dt><b>yes</b></dt>
<dd>Interpolate between topology A (lambda=0) to topology B (lambda=1)
-and write the derivative of the Hamiltonian with respect to lambda (as specified with <b>dhdl_derivatives</b>), or the Hamiltonian differences with respect to other lambda values (as specified with <b>foreign_lambda</b>) to
+and write the derivative of the Hamiltonian with respect to lambda (as specified with <b>dhdl-derivatives</b>), or the Hamiltonian differences with respect to other lambda values (as specified with <b>foreign-lambda</b>) to
the energy file and/or to <tt>dhdl.xvg</tt>, where they can be processed by, for example <tt>g_bar</tt>.
The potentials, bond-lengths and angles are interpolated linearly as
-described in the manual. When <b>sc_alpha</b> is larger than zero, soft-core
+described in the manual. When <b>sc-alpha</b> is larger than zero, soft-core
potentials are used for the LJ and Coulomb interactions.</dd>
</dl></dd>
-<dt><b>init_lambda: (0)</b></dt>
+<dt><b>init-lambda: (0)</b></dt>
<dd>starting value for lambda</dd>
-<dt><b>delta_lambda: (0)</b></dt>
+<dt><b>delta-lambda: (0)</b></dt>
<dd>increment per time step for lambda</dd>
-<dt><b>foreign_lambda: ()</b></dt>
+<dt><b>foreign-lambda: ()</b></dt>
<dd>Zero, one or more lambda values for which Delta H values will
be determined and written to dhdl.xvg every <b>nstdhdl</b> steps.
Free energy differences between different lambda values can then
be determined with <tt>g_bar</tt>.</dd>
-<dt><b>dhdl_derivatives: (yes)</b></dt>
+<dt><b>dhdl-derivatives: (yes)</b></dt>
<dd>If yes (the default), the derivatives of the Hamiltonian with respect to lambda at each <b>nstdhdl</b> step are written out. These values are needed for interpolation of linear energy differences with <tt>g_bar</tt> (although the same can also be achieved with the right <b>foreign lambda</b> setting, that may not be as flexible), or with thermodynamic integration</dd>
-<dt><b>sc_alpha: (0)</b></dt>
+<dt><b>sc-alpha: (0)</b></dt>
<dd>the soft-core parameter, a value of 0 results in linear interpolation of
the LJ and Coulomb interactions</dd>
-<dt><b>sc_power: (0)</b></dt>
+<dt><b>sc-power: (0)</b></dt>
<dd>the power for lambda in the soft-core function,
only the values 1 and 2 are supported</dd>
-<dt><b>sc_sigma: (0.3) [nm]</b></dt>
+<dt><b>sc-sigma: (0.3) [nm]</b></dt>
<dd>the soft-core sigma for particles which have a C6 or C12 parameter equal
-to zero or a sigma smaller than <b>sc_sigma</b></dd>
+to zero or a sigma smaller than <b>sc-sigma</b></dd>
<dt><b>couple-moltype:</b></dt>
<dd>Here one can supply a molecule type (as defined in the topology)
for calculating solvation or coupling free energies.
There is a special option <b>system</b> that couples all molecule types
in the system. This can be useful for equilibrating a system
starting from (nearly) random coordinates.
-<b>free_energy</b> has to be turned on.
+<b>free-energy</b> has to be turned on.
The Van der Waals interactions and/or charges in this molecule type can be
turned on or off between lambda=0 and lambda=1, depending on the settings
of <b>couple-lambda0</b> and <b>couple-lambda1</b>. If you want to decouple
<dt><b>nstdhdl: (10)</b></dt>
<dd>the frequency for writing dH/dlambda and possibly Delta H to dhdl.xvg,
0 means no ouput, should be a multiple of <b>nstcalcenergy</b></dd>
-<dt><b>separate_dhdl_file: (yes)</b></dt>
+<dt><b>separate-dhdl-file: (yes)</b></dt>
<dd><dl compact>
<dt><b>yes</b></dt>
-<dd>the free energy values that are calculated (as specified with the <b>foreign-lambda</b> and <b>dhdl_derivatives</b> settings) are written out to a separate file, with the default name <tt>dhdl.xvg</tt>. This file can be used directly with <tt>g_bar</tt>.</dd>
+<dd>the free energy values that are calculated (as specified with the <b>foreign-lambda</b> and <b>dhdl-derivatives</b> settings) are written out to a separate file, with the default name <tt>dhdl.xvg</tt>. This file can be used directly with <tt>g_bar</tt>.</dd>
<dt><b>no</b></dt>
<dd>The free energy values are written out to the energy output file (<tt>ener.edr</tt>, in accumulated blocks at every <b>nstenergy</b> steps), where they can be extracted with <tt>g_energy</tt> or used directly with <tt>g_bar</tt>.</dd>
</dl>
-<dt><b>dh_hist_size: (0)</b></dt>
-<dd>If nonzero, specifies the size of the histogram into which the Delta H values (specified with <b>foreign_lambda</b>) and the derivative dH/dl values are binned, and written to ener.edr. This can be used to save disk space while calculating free energy differences. One histogram gets written for each <b>foreign lambda</b> and two for the dH/dl, at every <b>nstenergy</b> step. Be aware that incorrect histogram settings (too small size or too wide bins) can introduce errors. Do not use histograms unless you're certain you need it.</dd>
-<dt><b>dh_hist_spacing (0.1)</b></dt>
-<dd>Specifies the bin width of the histograms, in energy units. Used in conjunction with <b>dh_hist_size</b>. This size limits the accuracy with which free energies can be calculated. Do not use histograms unless you're certain you need it.</dd>
+<dt><b>dh-hist-size: (0)</b></dt>
+<dd>If nonzero, specifies the size of the histogram into which the Delta H values (specified with <b>foreign-lambda</b>) and the derivative dH/dl values are binned, and written to ener.edr. This can be used to save disk space while calculating free energy differences. One histogram gets written for each <b>foreign lambda</b> and two for the dH/dl, at every <b>nstenergy</b> step. Be aware that incorrect histogram settings (too small size or too wide bins) can introduce errors. Do not use histograms unless you're certain you need it.</dd>
+<dt><b>dh-hist-spacing (0.1)</b></dt>
+<dd>Specifies the bin width of the histograms, in energy units. Used in conjunction with <b>dh-hist-size</b>. This size limits the accuracy with which free energies can be calculated. Do not use histograms unless you're certain you need it.</dd>
</dl>
<h3><!--Idx-->Non-equilibrium MD<!--EIdx--></h3>
<dl>
-<dt><b>acc_grps: </b></dt>
+<dt><b>acc-grps: </b></dt>
<dd>groups for constant acceleration (e.g.: <tt>Protein Sol</tt>)
all atoms in groups Protein and Sol will experience constant acceleration
as specified in the <b>accelerate</b> line</dd>
<dt><b>accelerate: (0) [nm ps<sup>-2</sup>]</b></dt>
-<dd>acceleration for <b>acc_grps</b>; x, y and z for each group
+<dd>acceleration for <b>acc-grps</b>; x, y and z for each group
(e.g. <tt>0.1 0.0 0.0 -0.1 0.0 0.0</tt> means that first group has constant
acceleration of 0.1 nm ps<sup>-2</sup> in X direction, second group the
opposite).</dd>
(e.g. <tt>Y Y N N N N</tt> means that particles in the first group
can move only in Z direction. The particles in the second group can
move in any direction).</dd>
-<dt><b>cos_acceleration: (0) [nm ps<sup>-2</sup>]</b></dt>
+<dt><b>cos-acceleration: (0) [nm ps<sup>-2</sup>]</b></dt>
<dd>the amplitude of the acceleration profile for calculating the
<!--Idx-->viscosity<!--EIdx-->.
The acceleration is in the X-direction and the magnitude is
-<b>cos_acceleration</b> cos(2 pi z/boxheight).
+<b>cos-acceleration</b> cos(2 pi z/boxheight).
Two terms are added to the energy file:
the amplitude of the velocity profile and 1/viscosity.</dd>
<dt><b><!--Idx-->deform<!--EIdx-->: (0 0 0 0 0 0) [nm ps<sup>-1</sup>]</b></dt>
<h3><!--Idx-->Electric field<!--EIdx-->s</h3>
<dl>
-<dt><b>E_x ; E_y ; E_z:</b></dt>
+<dt><b>E-x ; E-y ; E-z:</b></dt>
<dd>If you want to use an electric field in a direction, enter 3 numbers
-after the appropriate <b>E_*</b>, the first number: the number of cosines,
+after the appropriate <b>E-*</b>, the first number: the number of cosines,
only 1 is implemented (with frequency 0) so enter 1,
the second number: the strength of the electric field in
<b>V nm<sup>-1</sup></b>,
the third number: the phase of the cosine, you can enter any number here
since a cosine of frequency zero has no phase.</dd>
-<dt><b>E_xt; E_yt; E_zt: </b></dt>
+<dt><b>E-xt; E-yt; E-zt: </b></dt>
<dd>not implemented yet</dd>
</dl>
<br>
<h3>Implicit solvent</h3>
<dl>
-<dt><b>implicit_solvent:</b></dt>
+<dt><b>implicit-solvent:</b></dt>
<dd><dl compact="compact">
<dt><b>no</b></dt>
<dd>No implicit solvent</dd>
<dt><b>GBSA</b></dt>
<dd>Do a simulation with implicit solvent using the Generalized Born formalism.
Three different methods for calculating the Born radii are available, Still, HCT and
-OBC. These are specified with the <b>gb_algorithm</b> field. The non-polar solvation
-is specified with the <b>sa_algorithm</b> field.</dd>
+OBC. These are specified with the <b>gb-algorithm</b> field. The non-polar solvation
+is specified with the <b>sa-algorithm</b> field.</dd>
</dl>
-<dt><b>gb_algorithm:</b></dt>
+<dt><b>gb-algorithm:</b></dt>
<dd><dl compact="compact">
<dt><b>Still</b></dt>
<dd>Use the Still method to calculate the Born radii</dd>
<dt><b>rgbradii: (1.0) [nm]</b></dt>
<dd>Cut-off for the calculation of the Born radii. Currently must be equal to rlist</dd>
-<dt><b>gb_epsilon_solvent: (80)</b></dt>
+<dt><b>gb-epsilon-solvent: (80)</b></dt>
<dd>Dielectric constant for the implicit solvent</dd>
-<dt><b>gb_saltconc: (0) [M]</b></dt>
+<dt><b>gb-saltconc: (0) [M]</b></dt>
<dd>Salt concentration for implicit solvent models, currently not used</dd>
-<dt><b>gb_obc_alpha (1); gb_obc_beta (0.8); gb_obc_gamma (4.85);</b></dt>
+<dt><b>gb-obc-alpha (1); gb-obc-beta (0.8); gb-obc-gamma (4.85);</b></dt>
<dd>Scale factors for the OBC model. Default values are OBC(II).
Values for OBC(I) are 0.8, 0 and 2.91 respectively</dd>
-<dt><b>gb_dielectric_offset: (0.009) [nm]</b></dt>
+<dt><b>gb-dielectric-offset: (0.009) [nm]</b></dt>
<dd>Distance for the di-electric offset when calculating the Born radii. This is
the offset between the center of each atom the center of the polarization energy
for the corresponding atom</dd>
-<dt><b>sa_algorithm</b></dt>
+<dt><b>sa-algorithm</b></dt>
<dd><dl compact="compact">
<dt><b>Ace-approximation</b></dt>
<dd>Use an Ace-type approximation (default)</dd>
calculated</dd>
</dl>
-<dt><b>sa_surface_tension: [kJ mol<sup>-1</sup> nm<sup>-2</sup>]</b></dt>
+<dt><b>sa-surface-tension: [kJ mol<sup>-1</sup> nm<sup>-2</sup>]</b></dt>
<dd>Default value for surface tension with SA algorithms. The default value is -1;
Note that if this default value is not changed
it will be overridden by <tt>grompp</tt> using values that are specific for the choice
of radii algorithm (0.0049 kcal/mol/Angstrom<sup>2</sup> for Still, 0.0054 kcal/mol/Angstrom<sup>2</sup>
for HCT/OBC)
-Setting it to 0 will while using an sa_algorithm other than None means
+Setting it to 0 will while using an sa-algorithm other than None means
no non-polar calculations are done.
</dd>
</dl>
+<A NAME="adress"><br>
+<hr>
+<h3>Adaptive Resolution Simulation</h3>
+
+<dl>
+<dt><b>adress: (no)</b></dt>
+<dd>Decide whether the AdResS feature is turned on.</dd>
+<dt><b>adress-type: (Off)</b></dt>
+<dd><dl compact>
+<dt><b>Off</b></dt>
+<dd>Do an AdResS simulation with weight equal 1, which is equivalent to an explicit (normal) MD simulation. The difference to disabled AdResS is that the AdResS variables are still read-in and hence are defined.</dd>
+<dt><b>Constant</b></dt>
+<dd>Do an AdResS simulation with a constant weight, <b>adress-const-wf</b> defines the value of the weight</dd>
+<dt><b>XSplit</b></dt>
+<dd>Do an AdResS simulation with simulation box split in x-direction, so basically the weight is only a function of the x coordinate and all distances are measured using the x coordinate only.</dd>
+<dt><b>Sphere</b></dt>
+<dd>Do an AdResS simulation with spherical explicit zone.</dd>
+</dl></dd>
+<dt><b>adress-const-wf: (1)</b></dt>
+<dd>Provides the weight for a constant weight simulation (<b>adress-type</b>=Constant)</dd>
+<dt><b>adress-ex-width: (0)</b></dt>
+<dd>Width of the explicit zone, measured from <b>adress-reference-coords</b>.</dd>
+<dt><b>adress-hy-width: (0)</b></dt>
+<dd>Width of the hybrid zone.</dd>
+<dt><b>adress-reference-coords: (0,0,0)</b></dt>
+<dd>Position of the center of the explicit zone. Periodic boundary conditions apply for measuring the distance from it.</dd>
+<dt><b>adress-cg-grp-names</b></dt>
+<dd>The names of the coarse-grained energy groups. All other energy groups are considered explicit and their interactions will be automatically excluded with the coarse-grained groups.</dd>
+<dt><b>adress-site: (COM)</b>The mapping point from which the weight is calculated.</dt>
+<dd><dl compact>
+<dt><b>COM</b></dt>
+<dd>The weight is calculated from the center of mass of each charge group.</dd>
+<dt><b>COG</b></dt>
+<dd>The weight is calculated from the center of geometry of each charge group.</dd>
+<dt><b>Atom</b></dt>
+<dd>The weight is calculated from the position of 1st atom of each charge group.</dd>
+<dt><b>AtomPerAtom</b></dt>
+<dd>The weight is calculated from the position of each individual atom.</dd>
+</dl></dd>
+<dt><b>adress-interface-correction: (Off)</b></dt>
+<dd><dl compact>
+<dt><b>Off</b></dt>
+<dd>Do not a apply any interface correction.</dd>
+<dt><b>thermoforce</b></dt>
+<dd>Apply thermodynamic force interface correction. The table can be specified using the <tt>-tabletf</tt> option of <tt>mdrun</tt>. The table should contain the potential and force (acting on molecules) as function of the distance from <b>adress-reference-coords</b>.</dd>
+</dl></dd>
+<dt><b>adress-tf-grp-names</b></dt>
+<dd>The names of the energy groups to which the <b>thermoforce</b> is applied if enabled in <b>adress-interface-correction</b>. If no group is given the default table is applied.</dd>
+<dt><b>adress-ex-forcecap: (0)</b></dt>
+<dd>Cap the force in the hybrid region, useful for big molecules. 0 disables force capping.</dd>
+</dl>
+
<A NAME="user"><br>
<hr>
<h3>User defined thingies</h3>
<dl>
-<dt><b>user1_grps; user2_grps: </b></dt>
+<dt><b>user1-grps; user2-grps: </b></dt>
<dt><b>userint1 (0); userint2 (0); userint3 (0); userint4 (0)</b></dt>
<dt><b>userreal1 (0); userreal2 (0); userreal3 (0); userreal4 (0)</b></dt>
<dd>These you can use if you modify code. You can pass integers and
<P>
<multicol cols=4>
-<A HREF="#neq">acc_grps</A><br>
+<A HREF="#neq">acc-grps</A><br>
<A HREF="#neq">accelerate</A><br>
<A HREF="#sa">annealing</A><br>
-<A HREF="#sa">annealing_npoints</A><br>
-<A HREF="#sa">annealing_time</A><br>
-<A HREF="#sa">annealing_temp</A><br>
-<A HREF="#ld">bd_fric</A><br>
+<A HREF="#sa">annealing-npoints</A><br>
+<A HREF="#sa">annealing-time</A><br>
+<A HREF="#sa">annealing-temp</A><br>
+<A HREF="#ld">bd-fric</A><br>
<A HREF="#vdw">bDispCorr</A><br>
-<A HREF="#run">comm_mode</A><br>
-<A HREF="#run">comm_grps</A><br>
+<A HREF="#run">comm-mode</A><br>
+<A HREF="#run">comm-grps</A><br>
<A HREF="#pc">compressibility</A><br>
-<A HREF="#bond">constraint_algorithm</A><br>
+<A HREF="#bond">constraint-algorithm</A><br>
<A HREF="#bond">constraints</A><br>
-<A HREF="#neq">cos_acceleration</A><br>
+<A HREF="#neq">cos-acceleration</A><br>
<A HREF="#el">coulombtype</A><br>
<A HREF="#free">couple-intramol</A><br>
<A HREF="#free">couple-lambda0</A><br>
<A HREF="#free">couple-moltype</A><br>
<A HREF="#pp">define</A><br>
<A HREF="#neq">deform</A><br>
-<A HREF="#free">delta_lambda</A><br>
+<A HREF="#free">delta-lambda</A><br>
<A HREF="#nmr">disre</A><br>
-<A HREF="#nmr">disre_weighting</A><br>
-<A HREF="#nmr">disre_mixed</A><br>
-<A HREF="#nmr">disre_fc</A><br>
-<A HREF="#nmr">disre_tau</A><br>
+<A HREF="#nmr">disre-weighting</A><br>
+<A HREF="#nmr">disre-mixed</A><br>
+<A HREF="#nmr">disre-fc</A><br>
+<A HREF="#nmr">disre-tau</A><br>
<A HREF="#run">dt</A><br>
<A HREF="#em">emstep</A><br>
<A HREF="#em">emtol</A><br>
-<A HREF="#egexcl">energygrp_excl</A><br>
-<A HREF="#table">energygrp_table</A><br>
+<A HREF="#egexcl">energygrp-excl</A><br>
+<A HREF="#table">energygrp-table</A><br>
<A HREF="#out">energygrps</A><br>
-<A HREF="#el2">epsilon_r</A><br>
-<A HREF="#el2">epsilon_rf</A><br>
-<A HREF="#ewald">ewald_rtol</A><br>
-<A HREF="#ewald">ewald_geometry</A><br>
-<A HREF="#ewald">epsilon_surface</A><br>
-<A HREF="#ef">E_x</A><br>
-<A HREF="#ef">E_xt</A><br>
-<A HREF="#ef">E_y</A><br>
-<A HREF="#ef">E_yt</A><br>
-<A HREF="#ef">E_z</A><br>
-<A HREF="#ef">E_zt </A><br>
+<A HREF="#el2">epsilon-r</A><br>
+<A HREF="#el2">epsilon-rf</A><br>
+<A HREF="#ewald">ewald-rtol</A><br>
+<A HREF="#ewald">ewald-geometry</A><br>
+<A HREF="#ewald">epsilon-surface</A><br>
+<A HREF="#ef">E-x</A><br>
+<A HREF="#ef">E-xt</A><br>
+<A HREF="#ef">E-y</A><br>
+<A HREF="#ef">E-yt</A><br>
+<A HREF="#ef">E-z</A><br>
+<A HREF="#ef">E-zt </A><br>
<A HREF="#xmdrun">fcstep</A><br>
-<A HREF="#ewald">fourier_nx</A><br>
-<A HREF="#ewald">fourier_ny</A><br>
-<A HREF="#ewald">fourier_nz</A><br>
+<A HREF="#ewald">fourier-nx</A><br>
+<A HREF="#ewald">fourier-ny</A><br>
+<A HREF="#ewald">fourier-nz</A><br>
<A HREF="#ewald">fourierspacing</A><br>
-<A HREF="#free">free_energy</A><br>
+<A HREF="#free">free-energy</A><br>
<A HREF="#neq">freezedim </A><br>
<A HREF="#neq">freezegrps</A><br>
-<A HREF="#vel">gen_seed</A><br>
-<A HREF="#vel">gen_temp</A><br>
-<A HREF="#vel">gen_vel</A><br>
+<A HREF="#vel">gen-seed</A><br>
+<A HREF="#vel">gen-temp</A><br>
+<A HREF="#vel">gen-vel</A><br>
<A HREF="#pp">include</A><br>
-<A HREF="#free">init_lambda</A><br>
-<A HREF="#run">init_step</A><br>
+<A HREF="#free">init-lambda</A><br>
+<A HREF="#run">init-step</A><br>
<A HREF="#run">integrator</A><br>
-<A HREF="#ld">ld_seed</A><br>
-<A HREF="#bond2">lincs_iter</A><br>
-<A HREF="#bond2">lincs_order</A><br>
-<A HREF="#bond2">lincs_warnangle</A><br>
+<A HREF="#ld">ld-seed</A><br>
+<A HREF="#bond2">lincs-iter</A><br>
+<A HREF="#bond2">lincs-order</A><br>
+<A HREF="#bond2">lincs-warnangle</A><br>
<A HREF="#bond2">morse</A><br>
<A HREF="#em">nbfgscorr</A><br>
<A HREF="#xmdrun">niter</A><br>
<A HREF="#out">nstvout</A><br>
<A HREF="#out">nstxout</A><br>
<A HREF="#out">nstxtcout</A><br>
-<A HREF="#nl">ns_type</A><br>
+<A HREF="#nl">ns-type</A><br>
<A HREF="#wall">nwall</A><br>
-<A HREF="#ewald">optimize_fft</A><br>
+<A HREF="#ewald">optimize-fft</A><br>
<A HREF="#nmr2">orire</A><br>
-<A HREF="#nmr2">orire_fc</A><br>
-<A HREF="#nmr2">orire_tau</A><br>
-<A HREF="#nmr2">orire_fitgrp</A><br>
+<A HREF="#nmr2">orire-fc</A><br>
+<A HREF="#nmr2">orire-tau</A><br>
+<A HREF="#nmr2">orire-fitgrp</A><br>
<A HREF="#nmr2">nstorireout</A><br>
<A HREF="#nl">pbc</A><br>
<A HREF="#pc">pcoupl</A><br>
<A HREF="#pc">pcoupltype</A><br>
-<A HREF="#nl">periodic_molecules</A><br>
-<A HREF="#ewald">pme_order</A><br>
+<A HREF="#nl">periodic-molecules</A><br>
+<A HREF="#ewald">pme-order</A><br>
<A HREF="#pull">pull</A><br>
-<A HREF="#pc">refcoord_scaling</A><br>
-<A HREF="#pc">ref_p</A><br>
-<A HREF="#tc">ref_t</A><br>
-<A HREF="#el2">rcoulomb_switch</A><br>
+<A HREF="#pc">refcoord-scaling</A><br>
+<A HREF="#pc">ref-p</A><br>
+<A HREF="#tc">ref-t</A><br>
+<A HREF="#el2">rcoulomb-switch</A><br>
<A HREF="#el2">rcoulomb</A><br>
<A HREF="#nl">rlist</A><br>
<A HREF="#nl">rlistlong</A><br>
<A HREF="#tpi">rtpi</A><br>
-<A HREF="#vdw">rvdw_switch</A><br>
+<A HREF="#vdw">rvdw-switch</A><br>
<A HREF="#vdw">rvdw</A><br>
-<A HREF="#free">sc_alpha</A><br>
-<A HREF="#free">sc_power</A><br>
-<A HREF="#free">sc_sigma</A><br>
-<A HREF="#bond2">shake_tol</A><br>
+<A HREF="#free">sc-alpha</A><br>
+<A HREF="#free">sc-power</A><br>
+<A HREF="#free">sc-sigma</A><br>
+<A HREF="#bond2">shake-tol</A><br>
<A HREF="#table">table-extension</A><br>
-<A HREF="#pc">tau_p</A><br>
-<A HREF="#tc">tau_t</A><br>
-<A HREF="#tc">tc_grps</A><br>
+<A HREF="#pc">tau-p</A><br>
+<A HREF="#tc">tau-t</A><br>
+<A HREF="#tc">tc-grps</A><br>
<A HREF="#tc">tcoupl</A><br>
<A HREF="#run">tinit</A><br>
<A HREF="#bond">continuation</A><br>
-<A HREF="#user">user1_grps</A><br>
-<A HREF="#user">user2_grps</A><br>
+<A HREF="#user">user1-grps</A><br>
+<A HREF="#user">user2-grps</A><br>
<A HREF="#user">userint1</A><br>
<A HREF="#user">userint2</A><br>
<A HREF="#user">userint3</A><br>
<A HREF="#user">userreal3</A><br>
<A HREF="#user">userreal4</A><br>
<A HREF="#el">vdwtype</A><br>
-<A HREF="#out">xtc_grps</A><br>
-<A HREF="#out">xtc_precision</A><br>
-<A HREF="#sa">zero_temp_time</A><br>
-<A HREF="#walls">wall_atomtype</A><br>
-<A HREF="#walls">wall_density</A><br>
-<A HREF="#walls">wall_ewald_zfac</A><br>
-<A HREF="#walls">wall_r_linpot</A><br>
-<A HREF="#walls">wall_type</A><br>
+<A HREF="#out">xtc-grps</A><br>
+<A HREF="#out">xtc-precision</A><br>
+<A HREF="#sa">zero-temp-time</A><br>
+<A HREF="#walls">wall-atomtype</A><br>
+<A HREF="#walls">wall-density</A><br>
+<A HREF="#walls">wall-ewald-zfac</A><br>
+<A HREF="#walls">wall-r-linpot</A><br>
+<A HREF="#walls">wall-type</A><br>
</multicol>
<hr>
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-templatedir = ${pkgdatadir}/template
-
-# we don't build this, it's meant for the user to play with.
-# Since a Makefile is used for the installation, we call the
-# template makefile Template.mak, and rename it to Makefile when installing.
-# We add the GMX_DOUBLE define to CPPFLAGS, so users can do without config.h
-XLDFLAGS = -L@libdir@ @LDFLAGS@
-XLIBS = -lmd@LIBSUFFIX@ -lgmx@LIBSUFFIX@ @FFT_LIBS@ @XML_LIBS@ @GSL_LIBS@ @LIBS@
-XCC = @CC@
-if GMX_DOUBLE
-MYCFLAGS = @CFLAGS@ @INCLUDES@ -I@includedir@ -DGMX_DOUBLE
-else
-MYCFLAGS = @CFLAGS@ @INCLUDES@ -I@includedir@
-endif
-
-if GMX_DOUBLE
-template_DATA = template.c README Makefile.@host@_double Makefile.pkg
-else
-template_DATA = template.c README Makefile.@host@ Makefile.pkg
-endif
-EXTRA_DIST = template.c README Template.mak Makefile.pkg CMakeLists.txt.template
-
-BUILT_SOURCES = gromacs
-
-gromacs:
- $(LN_S) $(top_srcdir)/include gromacs
-
-Makefile.@host@ Makefile.@host@_double: Template.mak Makefile
- cat $(srcdir)/Template.mak | \
- sed 's,@LDFLAGS\@,$(XLDFLAGS),' | \
- sed 's,@LIBS\@,$(XLIBS),' | \
- sed 's,@CFLAGS\@,$(MYCFLAGS),' | \
- sed 's,@CC\@,$(XCC),' | \
- sed 's,@host\@,@host@,' >$@
-
-CLEANFILES = Makefile.@host@ Makefile.@host@_double *~ \\\#*
-
-template_SOURCES = template.c
-noinst_PROGRAMS = template
-LDADD = ../../src/mdlib/libmd@LIBSUFFIX@.la ../../src/gmxlib/libgmx@LIBSUFFIX@.la
-#template.$(OBJEXT): gromacs
-
-clean-local:
- rm -rf gromacs
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top
-
-SUBDIRS = \
-encads.ff \
-encadv.ff \
-gmx.ff \
-gmx2.ff \
-gromos43a1.ff \
-gromos43a2.ff \
-gromos45a3.ff \
-gromos53a5.ff \
-gromos53a6.ff \
-oplsaa.ff \
-charmm27.ff \
-amber94.ff \
-amber96.ff \
-amberGS.ff \
-amber99.ff \
-amber99sb.ff \
-amber99sb-ildn.ff \
-amber03.ff
-
-
-topol_DATA = \
- flexspc.itp \
- flexspce.itp flexwat-ferguson.itp ions.itp \
- spc.itp spce.itp tip3p.itp tip4p.itp \
- dgsolv.dat electroneg.dat \
- spc216.gro tip4p.gro \
- residuetypes.dat atommass.dat bromacs.dat ca-shift.dat \
- cb-shift.dat co-shift.dat edissoc.dat \
- gurgle.dat ha-shift.dat links.dat phbres.dat \
- random.dat refi_aa.dat specbond.dat surface.dat \
- vdwradii.dat xlateat.dat highway.dat sfactor.dat \
- export.dlg bonds.dlg ss.map ps.m2p \
- table6-10.xvg table6-11.xvg table6-12.xvg table6-8.xvg \
- table6-9.xvg atom_nom.tbl tip5p.gro \
- sw.itp elements.dat defselection.dat \
- ffG43a1.itp ffG53a5.itp ffencads.itp ffgmx2.itp \
- ffG43a2.itp ffG53a6.itp ffencadv.itp ffoplsaa-n.tst \
- ffG45a3.itp ffgmx.itp ffoplsaa.itp
-
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/amber03.ff
-
-topol_DATA = \
- aminoacids.arn aminoacids.vsd \
- aminoacids.c.tdb atomtypes.atp ffnonbonded.itp \
- aminoacids.hdb forcefield.doc dna.rtp dna.r2b dna.arn dna.hdb \
- aminoacids.n.tdb forcefield.itp rna.rtp rna.r2b rna.arn rna.hdb \
- aminoacids.r2b ffbonded.itp tip3p.itp urea.itp \
- aminoacids.rtp ions.itp tip4p.itp \
- tip4pew.itp tip5p.itp watermodels.dat gbsa.itp \
- spc.itp spce.itp
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
-
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/amber94.ff
-
-topol_DATA = \
- aminoacids.arn aminoacids.vsd \
- aminoacids.c.tdb atomtypes.atp ffnonbonded.itp \
- aminoacids.hdb forcefield.doc dna.rtp dna.r2b dna.arn dna.hdb \
- aminoacids.n.tdb forcefield.itp rna.rtp rna.r2b rna.arn rna.hdb \
- aminoacids.r2b ffbonded.itp tip3p.itp urea.itp \
- aminoacids.rtp ions.itp tip4p.itp \
- tip4pew.itp tip5p.itp watermodels.dat gbsa.itp \
- spc.itp spce.itp
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
-
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/amber96.ff
-
-topol_DATA = \
- aminoacids.arn aminoacids.vsd \
- aminoacids.c.tdb atomtypes.atp ffnonbonded.itp \
- aminoacids.hdb forcefield.doc dna.rtp dna.r2b dna.arn dna.hdb \
- aminoacids.n.tdb forcefield.itp rna.rtp rna.r2b rna.arn rna.hdb \
- aminoacids.r2b ffbonded.itp tip3p.itp urea.itp \
- aminoacids.rtp ions.itp tip4p.itp \
- tip4pew.itp tip5p.itp watermodels.dat gbsa.itp \
- spc.itp spce.itp
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
-
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/amber99.ff
-
-topol_DATA = \
- aminoacids.arn aminoacids.vsd \
- aminoacids.c.tdb atomtypes.atp ffnonbonded.itp \
- aminoacids.hdb forcefield.doc dna.rtp dna.r2b dna.arn dna.hdb \
- aminoacids.n.tdb forcefield.itp rna.rtp rna.r2b rna.arn rna.hdb \
- aminoacids.r2b ffbonded.itp tip3p.itp urea.itp \
- aminoacids.rtp ions.itp tip4p.itp \
- tip4pew.itp tip5p.itp watermodels.dat gbsa.itp \
- spc.itp spce.itp
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
-
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/amber99sb-ildn.ff
-
-topol_DATA = \
- aminoacids.arn aminoacids.vsd \
- aminoacids.c.tdb atomtypes.atp ffnonbonded.itp \
- aminoacids.hdb forcefield.doc dna.rtp dna.r2b dna.arn dna.hdb \
- aminoacids.n.tdb forcefield.itp rna.rtp rna.r2b rna.arn rna.hdb \
- aminoacids.r2b ffbonded.itp tip3p.itp urea.itp \
- aminoacids.rtp ions.itp tip4p.itp \
- tip4pew.itp tip5p.itp watermodels.dat gbsa.itp \
- spc.itp spce.itp
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
-
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/amber99sb.ff
-
-topol_DATA = \
- aminoacids.arn aminoacids.vsd \
- aminoacids.c.tdb atomtypes.atp ffnonbonded.itp \
- aminoacids.hdb forcefield.doc dna.rtp dna.r2b dna.arn dna.hdb \
- aminoacids.n.tdb forcefield.itp rna.rtp rna.r2b rna.arn rna.hdb \
- aminoacids.r2b ffbonded.itp tip3p.itp urea.itp \
- aminoacids.rtp ions.itp tip4p.itp \
- tip4pew.itp tip5p.itp watermodels.dat gbsa.itp \
- spc.itp spce.itp
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
-
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/amberGS.ff
-
-topol_DATA = \
- aminoacids.arn aminoacids.vsd \
- aminoacids.c.tdb atomtypes.atp ffnonbonded.itp \
- aminoacids.hdb forcefield.doc dna.rtp dna.r2b dna.arn dna.hdb \
- aminoacids.n.tdb forcefield.itp rna.rtp rna.r2b rna.arn rna.hdb \
- aminoacids.r2b ffbonded.itp tip3p.itp urea.itp \
- aminoacids.rtp ions.itp tip4p.itp \
- tip4pew.itp tip5p.itp watermodels.dat gbsa.itp \
- spc.itp spce.itp
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
-
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/charmm27.ff
-
-topol_DATA = \
-aminoacids.arn aminoacids.vsd ffnanonbonded.itp lipids.hdb \
-aminoacids.c.tdb atomtypes.atp ffnonbonded.itp lipids.rtp \
-aminoacids.hdb cmap.itp forcefield.doc rna.rtp \
-aminoacids.n.tdb dna.rtp forcefield.itp spc.itp \
-aminoacids.r2b ffbonded.itp gb.itp tip3p.itp \
-aminoacids.rtp ffnabonded.itp ions.itp tip4p.itp \
-spce.itp tips3p.itp watermodels.dat tip5p.itp \
-dna.hdb dna.n.tdb dna.c.tdb dna.arn \
-rna.hdb rna.n.tdb rna.c.tdb rna.arn \
-rna.r2b
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
-
[ constrainttypes ]
-; this section is copied from OPLS. In theory we could recalculate
-; optimal geometries from charmm values, but since pratical equilibrium
-; geometries do not correspond exactly to these values anyway it is not
-; worth the effort...
#ifdef HEAVY_H
; account for larger inertia with heavy hydrogens
; constraints for the rigid NH3 groups
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/encads.ff
-
-topol_DATA = \
-aminoacids.c.tdb atomtypes.atp f3c.itp \
-aminoacids.hdb ffbonded.itp \
-aminoacids.n.tdb ffnonbonded.itp \
-aminoacids.rtp forcefield.doc \
-aminoacids.r2b forcefield.itp watermodels.dat
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/encadv.ff
-
-topol_DATA = \
-aminoacids.c.tdb atomtypes.atp \
-aminoacids.hdb ffbonded.itp \
-aminoacids.n.tdb ffnonbonded.itp \
-aminoacids.rtp forcefield.doc \
-aminoacids.r2b forcefield.itp watermodels.dat
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/gmx.ff
-
-topol_DATA = \
-aminoacids.c.tdb atomtypes.atp ions.itp \
-aminoacids.hdb ffbonded.itp spc.itp \
-aminoacids.n.tdb ffnonbonded.itp spce.itp \
-aminoacids.rtp forcefield.doc tip3p.itp \
-aminoacids.vsd forcefield.itp tip4p.itp \
-h2p4o13.itp h2p8o25.itp h2po4.itp \
-1mlg.itp 2mlg.itp decane.itp \
-dlg.itp fa.itp tfe.itp \
-decane50.gro watermodels.dat ff_dum.itp
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/gmx2.ff
-
-topol_DATA = \
-aminoacids.c.tdb atomtypes.atp ions.itp \
-aminoacids.hdb ffbonded.itp spc.itp \
-aminoacids.n.tdb ffnonbonded.itp spce.itp \
-aminoacids.rtp forcefield.doc tip3p.itp \
-aminoacids.vsd forcefield.itp tip4p.itp \
-watermodels.dat ff_dum.itp
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/gromos43a1.ff
-
-topol_DATA = \
-aminoacids.c.tdb atomtypes.atp ions.itp \
-aminoacids.hdb ffbonded.itp spc.itp \
-aminoacids.n.tdb ffnonbonded.itp spce.itp \
-aminoacids.rtp forcefield.doc tip3p.itp \
-aminoacids.vsd forcefield.itp tip4p.itp \
-aminoacids.r2b methanol.itp methanol216.gro \
-watermodels.dat ff_dum.itp
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/gromos43a2.ff
-
-topol_DATA = \
-aminoacids.c.tdb atomtypes.atp ions.itp \
-aminoacids.hdb ffbonded.itp spc.itp \
-aminoacids.n.tdb ffnonbonded.itp spce.itp \
-aminoacids.rtp forcefield.doc tip3p.itp \
-aminoacids.vsd forcefield.itp tip4p.itp \
-aminoacids.r2b watermodels.dat ff_dum.itp
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/gromos45a3.ff
-
-topol_DATA = \
-aminoacids.c.tdb atomtypes.atp ions.itp \
-aminoacids.hdb ffbonded.itp spc.itp \
-aminoacids.n.tdb ffnonbonded.itp spce.itp \
-aminoacids.rtp forcefield.doc tip3p.itp \
-aminoacids.vsd forcefield.itp tip4p.itp \
-aminoacids.r2b watermodels.dat ff_dum.itp
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/gromos53a5.ff
-
-topol_DATA = \
-aminoacids.c.tdb atomtypes.atp ions.itp \
-aminoacids.hdb ffbonded.itp spc.itp \
-aminoacids.n.tdb ffnonbonded.itp spce.itp \
-aminoacids.rtp forcefield.doc tip3p.itp \
-aminoacids.vsd forcefield.itp tip4p.itp \
-aminoacids.r2b atomname2type.n2t watermodels.dat \
-ff_dum.itp
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/gromos53a6.ff
-
-topol_DATA = \
-aminoacids.c.tdb atomtypes.atp ions.itp \
-aminoacids.hdb ffbonded.itp spc.itp \
-aminoacids.n.tdb ffnonbonded.itp spce.itp \
-aminoacids.rtp forcefield.doc tip3p.itp \
-aminoacids.vsd forcefield.itp tip4p.itp \
-aminoacids.r2b watermodels.dat ff_dum.itp
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
--- /dev/null
+; Neutron scattering factors for elements. Numbers taken from:
+; http://www.ncnr.nist.gov/resources/n-lengths/
+; All data was taken from the
+; Special Feature section of neutron scattering lengths and cross sections of the elements and their isotopes in Neutron News
+; Vol. 3, No. 3, 1992, pp. 29-37.
+; Scattering lenth are in fm (1e-15m)
+; Elem P N Coh_b
+ H 1 0 -3.7406
+ D 1 1 6.6710
+ C 6 6 6.6460
+ N 7 7 9.3600
+ O 8 8 5.8030
+ Na 11 11 3.6300
+ Mg 12 12 5.3750
+ Al 13 14 3.4490
+ P 15 16 5.1300
+ S 16 16 2.8470
+ Cl 17 17 9.5770
+ K 19 20 3.6700
+ Ca 20 20 4.7000
+ Mn 25 30 -3.7300
+ Fe 26 30 9.4500
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-topoldir = ${pkgdatadir}/top/oplsaa.ff
-
-topol_DATA = \
-aminoacids.c.tdb atomtypes.atp ions.itp \
-aminoacids.hdb ffbonded.itp spc.itp \
-aminoacids.n.tdb ffnonbonded.itp spce.itp \
-aminoacids.rtp forcefield.doc tip3p.itp \
-aminoacids.vsd forcefield.itp tip4p.itp \
-aminoacids.r2b tip5p.itp \
-methanol.itp ethanol.itp 1propanol.itp \
-atomname2type.n2t watermodels.dat gbsa.itp
-
-EXTRA_DIST = ${topol_DATA}
-
-CLEANFILES = *~ \\\#*
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-SUBDIRS = nmr1 nmr2 speptide water gmxdemo methanol mixed
-
-EXTRA_DIST = cleanit
-
-CLEANFILES = *~ \\\#*
-
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-gmxdemodir = ${pkgdatadir}/tutor/gmxdemo
-
-gmxdemo_DATA = cpeptide.pdb
-gmxdemo_SCRIPTS = demo
-
-EXTRA_DIST = ${gmxdemo_DATA} ${gmxdemo_SCRIPTS}
-
-CLEANFILES = *~ \\\#* *top *mdp *itp *gro *.ene *.hat *.tr? *.xtc *.edr *.ene *.xvg core *.log mdout.mdp *.tp? mon.out confout.gro deshuf.ndx output.* *.gz *.ps *.dat *.g87 *~ \\\#*
-
-
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-methdir = ${pkgdatadir}/tutor/methanol
-
-meth_DATA = index.ndx conf.gro methanol.pdb grompp.mdp topol.top methanol.itp
-
-EXTRA_DIST = ${meth_DATA}
-
-CLEANFILES = *~ \\\#* *.ene *.hat *.tr? *.xtc *.edr *.ene *.xvg core *.log mdout.mdp *.tp? mon.out confout.gro deshuf.ndx output.* *.gz *.ps *.dat *.g87 *~ \\\#*
-
-
dt = 0.002
nsteps = 10000
; For exact run continuation or redoing part of a run
-init_step = 0
+init-step = 0
; mode for center of mass motion removal
comm-mode = Linear
; number of steps for center of mass motion removal
; Force tolerance and initial step-size
emtol = 100
emstep = 0.01
-; Max number of iterations in relax_shells
+; Max number of iterations in relax-shells
niter = 20
; Step size (1/ps^2) for minimization of flexible constraints
fcstep = 0
; nblist update frequency
nstlist = 5
; ns algorithm (simple or grid)
-ns_type = grid
+ns-type = grid
; Periodic boundary conditions: xyz (default), no (vacuum)
; or full (infinite systems only)
pbc = xyz
; Spacing for the PME/PPPM FFT grid
fourierspacing = 0.12
; FFT grid size, when a value is 0 fourierspacing will be used
-fourier_nx = 0
-fourier_ny = 0
-fourier_nz = 0
+fourier-nx = 0
+fourier-ny = 0
+fourier-nz = 0
; EWALD/PME/PPPM parameters
-pme_order = 4
-ewald_rtol = 1e-05
-ewald_geometry = 3d
-epsilon_surface = 0
-optimize_fft = no
+pme-order = 4
+ewald-rtol = 1e-05
+ewald-geometry = 3d
+epsilon-surface = 0
+optimize-fft = no
; GENERALIZED BORN ELECTROSTATICS
; Algorithm for calculating Born radii
-gb_algorithm = Still
+gb-algorithm = Still
; Frequency of calculating the Born radii inside rlist
nstgbradii = 1
; Cutoff for Born radii calculation; the contribution from atoms
; between rlist and rgbradii is updated every nstlist steps
rgbradii = 2
; Salt concentration in M for Generalized Born models
-gb_saltconc = 0
+gb-saltconc = 0
; IMPLICIT SOLVENT (for use with Generalized Born electrostatics)
-implicit_solvent = No
+implicit-solvent = No
; OPTIONS FOR WEAK COUPLING ALGORITHMS
; Temperature coupling
; Groups to couple separately
tc-grps = System
; Time constant (ps) and reference temperature (K)
-tau_t = 0.1
-ref_t = 300
+tau-t = 0.1
+ref-t = 300
; Pressure coupling
Pcoupl = berendsen
Pcoupltype = isotropic
; Time constant (ps), compressibility (1/bar) and reference P (bar)
-tau_p = 1.0
+tau-p = 1.0
compressibility = 4.5e-5
-ref_p = 1.0
+ref-p = 1.0
; Random seed for Andersen thermostat
-andersen_seed = 815131
+andersen-seed = 815131
; SIMULATED ANNEALING
; Type of annealing for each temperature group (no/single/periodic)
annealing = no
; Number of time points to use for specifying annealing in each group
-annealing_npoints =
+annealing-npoints =
; List of times at the annealing points for each group
-annealing_time =
+annealing-time =
; Temp. at each annealing point, for each group.
-annealing_temp =
+annealing-temp =
; GENERATE VELOCITIES FOR STARTUP RUN
-gen_vel = yes
-gen_temp = 300
-gen_seed = 1993
+gen-vel = yes
+gen-temp = 300
+gen-seed = 1993
; OPTIONS FOR BONDS
constraints = all-bonds
; ENERGY GROUP EXCLUSIONS
; Pairs of energy groups for which all non-bonded interactions are excluded
-energygrp_excl =
+energygrp-excl =
; NMR refinement stuff
; Distance restraints type: No, Simple or Ensemble
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-mixeddir = ${pkgdatadir}/tutor/mixed
-
-mixed_DATA = index.ndx conf.gro mixed.pdb grompp.mdp topol.top
-
-EXTRA_DIST = ${mixed_DATA}
-
-CLEANFILES = *~ \\\#* *.ene *.hat *.tr? *.xtc *.edr *.ene *.xvg core *.log mdout.mdp *.tp? mon.out confout.gro deshuf.ndx output.* *.gz *.ps *.dat *.g87 *~ \\\#*
-
-
dt = 0.002
nsteps = 500000
; For exact run continuation or redoing part of a run
-init_step = 0
+init-step = 0
; mode for center of mass motion removal
comm-mode = Linear
; number of steps for center of mass motion removal
; Force tolerance and initial step-size
emtol = 100
emstep = 0.01
-; Max number of iterations in relax_shells
+; Max number of iterations in relax-shells
niter = 20
; Step size (1/ps^2) for minimization of flexible constraints
fcstep = 0
; nblist update frequency
nstlist = 5
; ns algorithm (simple or grid)
-ns_type = grid
+ns-type = grid
; Periodic boundary conditions: xyz (default), no (vacuum)
; or full (infinite systems only)
pbc = xyz
; Spacing for the PME/PPPM FFT grid
fourierspacing = 0.12
; FFT grid size, when a value is 0 fourierspacing will be used
-fourier_nx = 0
-fourier_ny = 0
-fourier_nz = 0
+fourier-nx = 0
+fourier-ny = 0
+fourier-nz = 0
; EWALD/PME/PPPM parameters
-pme_order = 4
-ewald_rtol = 1e-05
-ewald_geometry = 3d
-epsilon_surface = 0
-optimize_fft = no
+pme-order = 4
+ewald-rtol = 1e-05
+ewald-geometry = 3d
+epsilon-surface = 0
+optimize-fft = no
; GENERALIZED BORN ELECTROSTATICS
; Algorithm for calculating Born radii
-gb_algorithm = Still
+gb-algorithm = Still
; Frequency of calculating the Born radii inside rlist
nstgbradii = 1
; Cutoff for Born radii calculation; the contribution from atoms
; between rlist and rgbradii is updated every nstlist steps
rgbradii = 2
; Salt concentration in M for Generalized Born models
-gb_saltconc = 0
+gb-saltconc = 0
; IMPLICIT SOLVENT (for use with Generalized Born electrostatics)
-implicit_solvent = No
+implicit-solvent = No
; OPTIONS FOR WEAK COUPLING ALGORITHMS
; Temperature coupling
; Groups to couple separately
tc-grps = MeOH SOL
; Time constant (ps) and reference temperature (K)
-tau_t = 0.1 0.1
-ref_t = 300 300
+tau-t = 0.1 0.1
+ref-t = 300 300
; Pressure coupling
Pcoupl = berendsen
Pcoupltype = anisotropic
; Time constant (ps), compressibility (1/bar) and reference P (bar)
-tau_p = 2.0
+tau-p = 2.0
compressibility = 5e-5 5e-5 5e-5 0 0 0
-ref_p = 1 1 1 0 0 0
+ref-p = 1 1 1 0 0 0
; Random seed for Andersen thermostat
-andersen_seed = 815131
+andersen-seed = 815131
; SIMULATED ANNEALING
; Type of annealing for each temperature group (no/single/periodic)
annealing = no no
; Number of time points to use for specifying annealing in each group
-annealing_npoints =
+annealing-npoints =
; List of times at the annealing points for each group
-annealing_time =
+annealing-time =
; Temp. at each annealing point, for each group.
-annealing_temp =
+annealing-temp =
; GENERATE VELOCITIES FOR STARTUP RUN
-gen_vel = yes
-gen_temp = 300
-gen_seed = 1993
+gen-vel = yes
+gen-temp = 300
+gen-seed = 1993
; OPTIONS FOR BONDS
constraints = all-bonds
; ENERGY GROUP EXCLUSIONS
; Pairs of energy groups for which all non-bonded interactions are excluded
-energygrp_excl =
+energygrp-excl =
; NMR refinement stuff
; Distance restraints type: No, Simple or Ensemble
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-nmr1dir = ${pkgdatadir}/tutor/nmr1
-
-nmr1_DATA = conf.gro grompp.mdp pep.pdb topol.top
-
-EXTRA_DIST = ${nmr1_DATA}
-
-CLEANFILES = *~ \\\#* *.ene *.hat *.tr? *.xtc *.edr *.ene *.xvg core *.log mdout.mdp *.tp? mon.out confout.gro deshuf.ndx output.* *.gz *.ps *.dat *.g87 *~ \\\#*
-
-
; Force tolerance and initial step-size =
emtol = 0.001
emstep = 0.1
-; Max number of iterations in relax_shells =
+; Max number of iterations in relax-shells =
niter = 0
; Frequency of steepest descents steps when doing CG =
nstcgsteep = 1000
nstenergy = 100
; Output frequency and precision for xtc file =
nstxtcout = 10
-xtc_precision = 1000
+xtc-precision = 1000
; This selects the subset of atoms for the xtc file. You can =
; select multiple groups. By default all atoms will be written. =
xtc-grps =
; nblist update frequency =
nstlist = 100
; ns algorithm (simple or grid) =
-ns_type = simple
+ns-type = simple
; Periodic boundary conditions: xyz or none =
pbc = xyz
; nblist cut-off =
rcoulomb-switch = 0
rcoulomb = 1
; Dielectric constant (DC) for cut-off or DC of reaction field =
-epsilon_r = 1.0
+epsilon-r = 1.0
; Method for doing Van der Waals =
vdw-type = Cut-off
; cut-off lengths =
; Spacing for the PME/PPPM FFT grid =
fourierspacing = 0.12
; FFT grid size, when a value is 0 fourierspacing will be used =
-fourier_nx = 0
-fourier_ny = 0
-fourier_nz = 0
+fourier-nx = 0
+fourier-ny = 0
+fourier-nz = 0
; EWALD/PME/PPPM parameters =
-pme_order = 4
-ewald_rtol = 1e-05
-epsilon_surface = 0
-optimize_fft = no
+pme-order = 4
+ewald-rtol = 1e-05
+epsilon-surface = 0
+optimize-fft = no
; OPTIONS FOR WEAK COUPLING ALGORITHMS =
; Temperature coupling =
; Groups to couple separately =
tc-grps = System
; Time constant (ps) and reference temperature (K) =
-tau_t = 0.1
-ref_t = 300
+tau-t = 0.1
+ref-t = 300
; Pressure coupling =
Pcoupl = no
Pcoupltype = Isotropic
; Time constant (ps), compressibility (1/bar) and reference P (bar) =
-tau_p = 1
+tau-p = 1
compressibility =
-ref_p = 1.0 1.0 1.0
+ref-p = 1.0 1.0 1.0
; SIMULATED ANNEALING CONTROL =
annealing = no
; Time at which temperature should be zero (ps) =
-zero-temp_time = 0
+zero-temp-time = 0
; GENERATE VELOCITIES FOR STARTUP RUN =
-gen_vel = yes
-gen_temp = 300.0
-gen_seed = 173529
+gen-vel = yes
+gen-temp = 300.0
+gen-seed = 173529
; OPTIMIZATIONS FOR SOLVENT MODELS =
; Solvent molecule name (blank: no optimization) =
disre-weighting = Equal
; Use sqrt of the time averaged times the instantaneous violation =
disre-mixed = no
-disre_fc = 1000
-disre_tau = 0.0
+disre-fc = 1000
+disre-tau = 0.0
; Output frequency for pair distances to energy file =
nstdisreout = 100
freezegrps =
freezedim =
cos-acceleration = 0
-energygrp_excl =
+energygrp-excl =
; Electric fields =
; Format is number of terms (int) and for all terms an amplitude (real) =
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-nmr2dir = ${pkgdatadir}/tutor/nmr2
-
-nmr2_DATA = conf.gro genconf.gcp grompp.mdp pep.pdb topol.top
-
-EXTRA_DIST = ${nmr2_DATA}
-
-CLEANFILES = *~ \\\#* *.ene *.hat *.tr? *.xtc *.edr *.ene *.xvg core *.log mdout.mdp *.tp? mon.out confout.gro deshuf.ndx output.* *.gz *.ps *.dat *.g87 *~ \\\#*
-
-
; Force tolerance and initial step-size =
emtol = 0.001
emstep = 0.1
-; Max number of iterations in relax_shells =
+; Max number of iterations in relax-shells =
niter = 0
; Frequency of steepest descents steps when doing CG =
nstcgsteep = 1000
nstenergy = 100
; Output frequency and precision for xtc file =
nstxtcout = 10
-xtc_precision = 1000
+xtc-precision = 1000
; This selects the subset of atoms for the xtc file. You can =
; select multiple groups. By default all atoms will be written. =
xtc-grps =
; nblist update frequency =
nstlist = 100
; ns algorithm (simple or grid) =
-ns_type = simple
+ns-type = simple
; Periodic boundary conditions: xyz or none =
pbc = xyz
; nblist cut-off =
rcoulomb-switch = 0
rcoulomb = 1
; Dielectric constant (DC) for cut-off or DC of reaction field =
-epsilon_r = 1.0
+epsilon-r = 1.0
; Method for doing Van der Waals =
vdw-type = Cut-off
; cut-off lengths =
; Spacing for the PME/PPPM FFT grid =
fourierspacing = 0.12
; FFT grid size, when a value is 0 fourierspacing will be used =
-fourier_nx = 0
-fourier_ny = 0
-fourier_nz = 0
+fourier-nx = 0
+fourier-ny = 0
+fourier-nz = 0
; EWALD/PME/PPPM parameters =
-pme_order = 4
-ewald_rtol = 1e-05
-epsilon_surface = 0
-optimize_fft = no
+pme-order = 4
+ewald-rtol = 1e-05
+epsilon-surface = 0
+optimize-fft = no
; OPTIONS FOR WEAK COUPLING ALGORITHMS =
; Temperature coupling =
; Groups to couple separately =
tc-grps = System
; Time constant (ps) and reference temperature (K) =
-tau_t = 0.1
-ref_t = 300
+tau-t = 0.1
+ref-t = 300
; Pressure coupling =
Pcoupl = no
Pcoupltype = Isotropic
; Time constant (ps), compressibility (1/bar) and reference P (bar) =
-tau_p = 1
+tau-p = 1
compressibility =
-ref_p = 1.0 1.0 1.0
+ref-p = 1.0 1.0 1.0
; SIMULATED ANNEALING CONTROL =
annealing = no
; Time at which temperature should be zero (ps) =
-zero-temp_time = 0
+zero-temp-time = 0
; GENERATE VELOCITIES FOR STARTUP RUN =
-gen_vel = yes
-gen_temp = 300.0
-gen_seed = 173529
+gen-vel = yes
+gen-temp = 300.0
+gen-seed = 173529
; OPTIONS FOR BONDS =
constraints = none
disre-weighting = Equal
; Use sqrt of the time averaged times the instantaneous violation =
disre-mixed = no
-disre_fc = 1000
-disre_tau = 0.0
+disre-fc = 1000
+disre-tau = 0.0
; Output frequency for pair distances to energy file =
nstdisreout = 100
freezegrps =
freezedim =
cos-acceleration = 0
-energygrp_excl =
+energygrp-excl =
; Electric fields =
; Format is number of terms (int) and for all terms an amplitude (real) =
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-speptidedir = ${pkgdatadir}/tutor/speptide
-
-speptide_DATA = em.mdp full.mdp pr.mdp speptide.pdb
-
-EXTRA_DIST = ${speptide_DATA}
-
-CLEANFILES = *~ \\\#* *.ene *.hat *.tr? *.xtc *.edr *.ene *.xvg core *.log mdout.mdp *.tp? mon.out confout.gro deshuf.ndx output.* *.gz *.ps *.dat *.g87 *~ \\\#*
-
-
; Input file
;
cpp = /usr/bin/cpp
-define = -DFLEX_SPC
+define = -DFLEX-SPC
constraints = none
integrator = steep
nsteps = 100
emstep = 0.01
nstcomm = 1
-ns_type = grid
+ns-type = grid
rlist = 1
rcoulomb = 1.0
rvdw = 1.0
Tcoupl = no
Pcoupl = no
-gen_vel = no
+gen-vel = no
nstlog = 100
nstenergy = 100
nstlist = 10
-ns_type = grid
+ns-type = grid
rlist = 1.0
rcoulomb = 1.0
rvdw = 1.0
; Berendsen temperature coupling is on in two groups
Tcoupl = berendsen
tc-grps = Protein SOL
-tau_t = 0.1 0.1
-ref_t = 300 300
+tau-t = 0.1 0.1
+ref-t = 300 300
; Energy monitoring
energygrps = Protein SOL
; Isotropic pressure coupling is now on
Pcoupl = berendsen
Pcoupltype = isotropic
-tau_p = 0.5
+tau-p = 0.5
compressibility = 4.5e-5
-ref_p = 1.0
+ref-p = 1.0
; Generate velocites is off at 300 K.
-gen_vel = no
-gen_temp = 300.0
-gen_seed = 173529
+gen-vel = no
+gen-temp = 300.0
+gen-seed = 173529
nstlog = 10
nstenergy = 10
nstlist = 10
-ns_type = grid
+ns-type = grid
rlist = 1.0
rcoulomb = 1.0
rvdw = 1.0
; Berendsen temperature coupling is on in two groups
Tcoupl = berendsen
tc-grps = Protein SOL
-tau_t = 0.1 0.1
-ref_t = 300 300
+tau-t = 0.1 0.1
+ref-t = 300 300
; Energy monitoring
energygrps = Protein SOL
; Pressure coupling is not on
Pcoupl = no
-tau_p = 0.5
+tau-p = 0.5
compressibility = 4.5e-5
-ref_p = 1.0
+ref-p = 1.0
; Generate velocites is on at 300 K.
-gen_vel = yes
-gen_temp = 300.0
-gen_seed = 173529
+gen-vel = yes
+gen-temp = 300.0
+gen-seed = 173529
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-#
-# Don't edit - this file is generated automatically from Makefile.am
-#
-
-waterdir = ${pkgdatadir}/tutor/water
-
-water_DATA = index.ndx conf.gro spc216.pdb grompp.mdp topol.top
-
-EXTRA_DIST = ${water_DATA}
-
-CLEANFILES = *~ \\\#* *.ene *.hat *.tr? *.xtc *.edr *.ene *.xvg core *.log mdout.mdp *.tp? mon.out confout.gro deshuf.ndx output.* *.gz *.ps *.dat *.g87 *~ \\\#*
-
-
;
; File 'mdout.mdp' was generated
-; By user: spoel (291)
-; On host: chagall
-; At date: Mon Dec 15 13:13:06 2003
+; By user: alexxy (1000)
+; On host: x201
+; At date: Wed Oct 12 02:06:35 2011
;
; VARIOUS PREPROCESSING OPTIONS
-title = Yo
-cpp = /usr/bin/cpp
+; Preprocessor information: use cpp syntax.
+; e.g.: -I/home/joe/doe -I/home/mary/roe
include =
+; e.g.: -DPOSRES -DFLEXIBLE (note these variable names are case sensitive)
define =
; RUN CONTROL PARAMETERS
dt = 0.002
nsteps = 10000
; For exact run continuation or redoing part of a run
-init_step = 0
+init-step = 0
+; Part index is updated automatically on checkpointing (keeps files separate)
+simulation-part = 1
; mode for center of mass motion removal
comm-mode = Linear
; number of steps for center of mass motion removal
-nstcomm = 1
+nstcomm = 10
; group(s) for center of mass motion removal
comm-grps =
; LANGEVIN DYNAMICS OPTIONS
-; Temperature, friction coefficient (amu/ps) and random seed
-bd-temp = 300
+; Friction coefficient (amu/ps) and random seed
bd-fric = 0
ld-seed = 1993
; Force tolerance and initial step-size
emtol = 100
emstep = 0.01
-; Max number of iterations in relax_shells
+; Max number of iterations in relax-shells
niter = 20
-; Step size (1/ps^2) for minimization of flexible constraints
+; Step size (ps^2) for minimization of flexible constraints
fcstep = 0
; Frequency of steepest descents steps when doing CG
nstcgsteep = 1000
nbfgscorr = 10
+; TEST PARTICLE INSERTION OPTIONS
+rtpi = 0.05
+
; OUTPUT CONTROL OPTIONS
; Output frequency for coords (x), velocities (v) and forces (f)
nstxout = 0
nstvout = 0
nstfout = 0
-; Checkpointing helps you continue after crashes
-nstcheckpoint = 1000
; Output frequency for energies to log file and energy file
nstlog = 50
+nstcalcenergy = -1
nstenergy = 50
-; Output frequency and precision for xtc file
+; Output frequency and precision for .xtc file
nstxtcout = 50
xtc-precision = 1000
-; This selects the subset of atoms for the xtc file. You can
+; This selects the subset of atoms for the .xtc file. You can
; select multiple groups. By default all atoms will be written.
xtc-grps =
; Selection of energy groups
; nblist update frequency
nstlist = 5
; ns algorithm (simple or grid)
-ns_type = grid
-; Periodic boundary conditions: xyz (default), no (vacuum)
-; or full (infinite systems only)
+ns-type = grid
+; Periodic boundary conditions: xyz, no, xy
pbc = xyz
+periodic-molecules = no
; nblist cut-off
rlist = 0.9
-domain-decomposition = no
+; long-range cut-off for switched potentials
+rlistlong = -1
; OPTIONS FOR ELECTROSTATICS AND VDW
; Method for doing electrostatics
coulombtype = Cut-off
rcoulomb-switch = 0
rcoulomb = 0.9
-; Dielectric constant (DC) for cut-off or DC of reaction field
+; Relative dielectric constant for the medium and the reaction field
epsilon-r = 1
+epsilon-rf = 1
; Method for doing Van der Waals
vdw-type = Cut-off
; cut-off lengths
DispCorr = EnerPres
; Extension of the potential lookup tables beyond the cut-off
table-extension = 1
+; Seperate tables between energy group pairs
+energygrp-table =
; Spacing for the PME/PPPM FFT grid
fourierspacing = 0.12
; FFT grid size, when a value is 0 fourierspacing will be used
-fourier_nx = 0
-fourier_ny = 0
-fourier_nz = 0
+fourier-nx = 0
+fourier-ny = 0
+fourier-nz = 0
; EWALD/PME/PPPM parameters
-pme_order = 4
-ewald_rtol = 1e-05
-ewald_geometry = 3d
-epsilon_surface = 0
-optimize_fft = no
+pme-order = 4
+ewald-rtol = 1e-05
+ewald-geometry = 3d
+epsilon-surface = 0
+optimize-fft = no
+
+; IMPLICIT SOLVENT ALGORITHM
+implicit-solvent = No
; GENERALIZED BORN ELECTROSTATICS
; Algorithm for calculating Born radii
-gb_algorithm = Still
+gb-algorithm = Still
; Frequency of calculating the Born radii inside rlist
nstgbradii = 1
; Cutoff for Born radii calculation; the contribution from atoms
; between rlist and rgbradii is updated every nstlist steps
rgbradii = 2
+; Dielectric coefficient of the implicit solvent
+gb-epsilon-solvent = 80
; Salt concentration in M for Generalized Born models
-gb_saltconc = 0
-
-; IMPLICIT SOLVENT (for use with Generalized Born electrostatics)
-implicit_solvent = No
+gb-saltconc = 0
+; Scaling factors used in the OBC GB model. Default values are OBC(II)
+gb-obc-alpha = 1
+gb-obc-beta = 0.8
+gb-obc-gamma = 4.85
+gb-dielectric-offset = 0.009
+sa-algorithm = Ace-approximation
+; Surface tension (kJ/mol/nm^2) for the SA (nonpolar surface) part of GBSA
+; The value -1 will set default value for Still/HCT/OBC GB-models.
+sa-surface-tension = -1
; OPTIONS FOR WEAK COUPLING ALGORITHMS
; Temperature coupling
Tcoupl = berendsen
+nsttcouple = -1
+nh-chain-length = 10
; Groups to couple separately
tc-grps = System
; Time constant (ps) and reference temperature (K)
-tau_t = 0.1
-ref_t = 300
+tau-t = 0.1
+ref-t = 300
; Pressure coupling
Pcoupl = berendsen
Pcoupltype = isotropic
+nstpcouple = -1
; Time constant (ps), compressibility (1/bar) and reference P (bar)
-tau_p = 0.5
+tau-p = 0.5
compressibility = 4.5e-5
-ref_p = 1.0
+ref-p = 1.0
+; Scaling of reference coordinates, No, All or COM
+refcoord-scaling = No
; Random seed for Andersen thermostat
-andersen_seed = 815131
+andersen-seed = 815131
+
+; OPTIONS FOR QMMM calculations
+QMMM = no
+; Groups treated Quantum Mechanically
+QMMM-grps =
+; QM method
+QMmethod =
+; QMMM scheme
+QMMMscheme = normal
+; QM basisset
+QMbasis =
+; QM charge
+QMcharge =
+; QM multiplicity
+QMmult =
+; Surface Hopping
+SH =
+; CAS space options
+CASorbitals =
+CASelectrons =
+SAon =
+SAoff =
+SAsteps =
+; Scale factor for MM charges
+MMChargeScaleFactor = 1
+; Optimization of QM subsystem
+bOPT =
+bTS =
; SIMULATED ANNEALING
; Type of annealing for each temperature group (no/single/periodic)
annealing = no
; Number of time points to use for specifying annealing in each group
-annealing_npoints =
+annealing-npoints =
; List of times at the annealing points for each group
-annealing_time =
+annealing-time =
; Temp. at each annealing point, for each group.
-annealing_temp =
+annealing-temp =
; GENERATE VELOCITIES FOR STARTUP RUN
-gen_vel = yes
-gen_temp = 300
-gen_seed = 1993
+gen-vel = yes
+gen-temp = 300
+gen-seed = 1993
; OPTIONS FOR BONDS
constraints = none
; Type of constraint algorithm
constraint-algorithm = Lincs
; Do not constrain the start configuration
-unconstrained-start = no
+continuation = no
; Use successive overrelaxation to reduce the number of shake iterations
Shake-SOR = no
; Relative tolerance of shake
; ENERGY GROUP EXCLUSIONS
; Pairs of energy groups for which all non-bonded interactions are excluded
-energygrp_excl =
+energygrp-excl =
+
+; WALLS
+; Number of walls, type, atom types, densities and box-z scale factor for Ewald
+nwall = 0
+wall-type = 9-3
+wall-r-linpot = -1
+wall-atomtype =
+wall-density =
+wall-ewald-zfac = 3
+
+; COM PULLING
+; Pull type: no, umbrella, constraint or constant-force
+pull = no
; NMR refinement stuff
; Distance restraints type: No, Simple or Ensemble
orire-fc = 0
orire-tau = 0
orire-fitgrp =
-; Output frequency for trace(SD) to energy file
+; Output frequency for trace(SD) and S to energy file
nstorireout = 100
-; Dihedral angle restraints: No, Simple or Ensemble
+; Dihedral angle restraints: No or Yes
dihre = No
dihre-fc = 1000
-dihre-tau = 0
-; Output frequency for dihedral values to energy file
-nstdihreout = 100
; Free energy control stuff
free-energy = no
init-lambda = 0
delta-lambda = 0
+foreign-lambda =
sc-alpha = 0
+sc-power = 0
sc-sigma = 0.3
+nstdhdl = 10
+separate-dhdl-file = yes
+dhdl-derivatives = yes
+dh-hist-size = 0
+dh-hist-spacing = 0.1
+couple-moltype =
+couple-lambda0 = vdw-q
+couple-lambda1 = vdw-q
+couple-intramol = no
; Non-equilibrium MD stuff
acc-grps =
freezegrps =
freezedim =
cos-acceleration = 0
+deform =
; Electric fields
; Format is number of terms (int) and for all terms an amplitude (real)
+++ /dev/null
-.deps
-.libs
if(NOT GMX_FAHCORE)
add_subdirectory(tools)
add_subdirectory(ngmx)
+ add_subdirectory(contrib)
endif(NOT GMX_FAHCORE)
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-# Note: Makefile is automatically generated from Makefile.in by the configure
-# script, and Makefile.in is automatically from Makefile.am by automake.
-
-SUBDIRS = gmxlib mdlib kernel tools ngmx contrib
-# don't do anything for the local directory
-
-#EXTRA_DIST = config.win
-
-mdrun:
- (cd $(top_builddir)/src/gmxlib && $(MAKE))
- (cd $(top_builddir)/src/mdlib && $(MAKE))
- (cd $(top_builddir)/src/kernel && $(MAKE) mdrun)
-
-install-mdrun:
- (cd $(top_builddir)/src/gmxlib && $(MAKE) install ; exit 0)
- (cd $(top_builddir)/src/mdlib && $(MAKE) install ; exit 0)
- (cd $(top_builddir)/src/kernel && $(MAKE) install-libLTLIBRARIES ; exit 0)
- (cd $(top_builddir)/src/kernel && $(MAKE) install-mdrun)
-
-CLEANFILES = *~ \\\#*
/* As F77_FUNC, but for C identifiers containing underscores. */
#define F77_FUNC_(name,NAME) @F77_FUNCDEF_@
-/* Use the d prefix on fftw2 includes */
-#cmakedefine FFTW2_NAME_DFFTW
-
-/* Dont use any prefix on fftw2 includes */
-#cmakedefine FFTW2_NAME_FFTW
-
-/* Use the s prefix on fftw2 includes */
-#cmakedefine FFTW2_NAME_SFFTW
-
/* IEEE754 floating-point format. Memory layout is defined by macros
* GMX_IEEE754_BIG_ENDIAN_BYTE_ORDER and GMX_IEEE754_BIG_ENDIAN_WORD_ORDER.
*/
/* Use Built-in FFTPACK FFT library */
#cmakedefine GMX_FFT_FFTPACK
-/* Use FFTW2 FFT library */
-#cmakedefine GMX_FFT_FFTW2
-
/* Use FFTW3 FFT library */
#cmakedefine GMX_FFT_FFTW3
#cmakedefine GMX_MPI
/* Use threads for parallelization */
-#cmakedefine GMX_THREADS
+#cmakedefine GMX_THREAD_MPI
/* Use old threading (domain decomp force calc) code */
#cmakedefine GMX_THREAD_SHM_FDECOMP
/* Use the PowerPC hardware 1/sqrt(x) */
#cmakedefine GMX_POWERPC_INVSQRT
-/* Compile with dlopen */
-#cmakedefine GMX_DLOPEN
+/* Compile with plugin support */
+#cmakedefine GMX_USE_PLUGINS
+
+/* Fallback path for VMD plug-ins */
+#define GMX_VMD_PLUGIN_PATH "@GMX_VMD_PLUGIN_PATH@"
/* Define when pthreads are used */
#cmakedefine THREAD_PTHREADS
order! Only relevant when FLOAT_FORMAT_IEEE754 is defined. */
#cmakedefine GMX_IEEE754_BIG_ENDIAN_WORD_ORDER
-/* Define as the return type of signal handlers (int or void). */
-#cmakedefine RETSIGTYPE @RETSIGTYPE@
-
/* Define if SIGUSR1 is present */
#cmakedefine HAVE_SIGUSR1
--- /dev/null
+set(CONTRIB_PROGRAMS
+ #add here any programs you want to compile
+)
+
+foreach(PROG ${CONTRIB_PROGRAMS})
+ add_executable(${PROG} ${PROG}.c ${NGMX_COMMON_SOURCE})
+ set_target_properties(${PROG} PROPERTIES OUTPUT_NAME "${PROG}${GMX_BINARY_SUFFIX}")
+endforeach(PROG)
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-# Note: Makefile is automatically generated from Makefile.in by the configure
-# script, and Makefile.in is generated from Makefile.am by automake.
-
-AM_CPPFLAGS = -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\" -I/sw/include
-
-LDADD = ../kernel/libgmxpreprocess@LIBSUFFIX@.la ../mdlib/libmd@LIBSUFFIX@.la ../gmxlib/libgmx@LIBSUFFIX@.la ../tools/libgmxana@LIBSUFFIX@.la
-
-
-EXTRA_DIST = README
-
-# These programs are not compiled or installed by default - you will have to
-# issue "make <program>" and copy the binary to the correct location yourself!
-# Add new entries in Makefile.am!
-
-EXTRA_PROGRAMS = copyrgt \
- hrefify \
- addquote compnl \
- gen_table ehole g_sdf\
- do_multiprot
-
-compnl_SOURCES = compnl.c
-compnl_LDADD = ../mdlib/libmd@LIBSUFFIX@.la ../gmxlib/libgmx@LIBSUFFIX@.la
-
-g_sdf_SOURCES = gmx_sdf.c g_sdf.c
-
-ehole_SOURCES = ehdata.c ehdata.h ehanal.c ehole.c
-
-# Note: you don't have to list sources for "prog" if it is the single file prog.c
-
-CLEANFILES = *~ \\\#*
or documented, so if there are problems your best bet is probably
either the mailing lists or to contact the author listed in the file.
-To add a program, you should edit Makefile.am. Have a look at
-www.gromacs.org/developer if you are unfamiliar with automake/autoconf.
-Since gromacs uses both assembly, fortran, shared libraries and
-dynamic dependency tracking on all platforms we rely on features in
-the prereleases of autoconf 1.5. Until this is released,
-you can get version 1.4j or later from ftp.gromacs.org/developer
-
-The EXTRA_PROGRAMS tag used here means they are not compiled and
-installed for the default package configuration setup.
-
-You should always be able to execute the program in this directory,
-but it is not installed automatically. Since we use libtool to handle
-shared/static libraries the "program file" you see is actually a libtool
-wrapper script, and if you move this script it will not work. To install
-e.g. "options" as "/usr/local/gromacs/i686-pc-linux-gnu/bin/options"
-you should give the command:
-
-../../libtool install options /usr/local/gromacs/i686-pc-linux-gnu/bin/options
+To add a program, you should edit CMakeLists.txt.
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
if(USE_VERSION_H)
add_custom_target(gmx_version ALL
COMMAND ${CMAKE_COMMAND}
- -D Git_EXECUTABLE="${Git_EXECUTABLE}"
- -D Git_VERSION="${Git_VERSION}"
+ -D GIT_EXECUTABLE="${GIT_EXECUTABLE}"
+ -D GIT_VERSION="${GIT_VERSION}"
-D PROJECT_VERSION="${PROJECT_VERSION}"
-D PROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}"
-D VERSION_C_CMAKEIN="${CMAKE_SOURCE_DIR}/src/gmxlib/version.c.cmakein"
# conditionally built, so we cannot use a GLOB_RECURSE here.
file(GLOB GMXLIB_SOURCES *.c
selection/*.c trajana/*.c
- statistics/*.c nonbonded/*.c nonbonded/nb_kernel_c/*.c)
+ statistics/*.c nonbonded/*.c nonbonded/nb_kernel_c/*.c
+ nonbonded/nb_kernel_adress_c/*.c)
+
+if(NOT GMX_USE_PLUGINS)
+ list(REMOVE_ITEM GMXLIB_SOURCES vmdio.c vmddlopen.c)
+endif()
# This source file is generated
file(GLOB VERSION_SOURCE version.c)
# This would be the standard way to include thread_mpi, but we want libgmx
# to link the functions directly
-#if(GMX_THREADS)
+#if(GMX_THREAD_MPI)
# add_subdirectory(thread_mpi)
-#endif(GMX_THREADS)
+#endif(GMX_THREAD_MPI)
#target_link_libraries(gmx ${GMX_EXTRA_LIBRARIES} ${THREAD_MPI_LIB})
# Files called xxx_test.c are test drivers with a main() function for module xxx.c,
+++ /dev/null
-
-## Process this file with automake to produce Makefile.in
-# Note: Makefile is automatically generated from Makefile.in by the configure
-# script, and Makefile.in is generated from Makefile.am by automake.
-
-if !GMX_EXTERNAL_BLAS
- BLAS_DIR = gmx_blas
- BLAS_LIBOBJS = gmx_blas/libblas.la
-endif
-
-if !GMX_EXTERNAL_LAPACK
- LAPACK_DIR = gmx_lapack
- LAPACK_LIBOBJS = gmx_lapack/liblapack.la
-endif
-
-if THREAD_PARALLEL
- THREAD_MPI_LIBOBJS = thread_mpi/libthread_mpi.la
- THREAD_MPI_DIR = thread_mpi
-endif
-
-
-SUBDIRS = nonbonded selection statistics trajana $(THREAD_MPI_DIR) \
- $(BLAS_DIR) $(LAPACK_DIR)
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-lib_LTLIBRARIES = libgmx@LIBSUFFIX@.la
-
-#
-# Use a utility library for all the nonbonded kernels and wrapper routines.
-#
-libgmx@LIBSUFFIX@_la_LIBADD = nonbonded/libnonbonded.la \
- selection/libselection.la \
- statistics/libstatistics.la \
- trajana/libtrajana.la \
- $(THREAD_MPI_LIBOBJS) \
- $(BLAS_LIBOBJS) $(LAPACK_LIBOBJS)
-
-libgmx@LIBSUFFIX@_la_DEPENDENCIES = nonbonded/libnonbonded.la \
- selection/libselection.la \
- statistics/libstatistics.la \
- trajana/libtrajana.la \
- $(THREAD_MPI_LIBOBJS) \
- $(BLAS_LIBOBJS) $(LAPACK_LIBOBJS)
-
-#
-#
-libgmx@LIBSUFFIX@_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@ @DLOPEN_LIBS@ $(PTHREAD_LIBS)
-
-libgmx@LIBSUFFIX@_la_SOURCES = \
- 3dview.c atomprop.c bondfree.c \
- calcgrid.c calch.c chargegroup.c checkpoint.c \
- confio.c copyrite.c disre.c do_fit.c \
- enxio.c ewald_util.c ffscanf.c \
- filenm.c futil.c gbutil.c gmx_fatal.c \
- gmx_sort.c gmxcpp.c \
- gmxfio.c ifunc.c index.c inputrec.c \
- cinvsqrtdata.c \
- invblock.c macros.c orires.c sparsematrix.c \
- main.c maths.c matio.c mshift.c \
- mtop_util.c mtxio.c mvdata.c names.c \
- network.c nrama.c nrjac.c nrnb.c \
- pargs.c pbc.c pdbio.c princ.c \
- rando.c random.c gmx_random.c rbin.c \
- readinp.c replace.c rmpbc.c shift_util.c \
- sortwater.c smalloc.c statutil.c sfactor.c \
- strdb.c string2.c symtab.c \
- topsort.c tpxio.c \
- trnio.c trxio.c txtdump.c typedefs.c \
- viewit.c warninp.c \
- wgms.c wman.c writeps.c \
- xdrd.c xtcio.c xvgr.c replace.h \
- libxdrf.c gmx_arpack.c gmx_matrix.c \
- dihres.c gmx_random_gausstable.h gmxfio_int.h\
- tcontrol.c splitter.c gmx_cyclecounter.c \
- gmx_system_xdr.c md5.c vmdio.c vmddlopen.c sighandler.c \
- oenv.c gmxfio_rw.c gmxfio_asc.c gmxfio_bin.c \
- gmxfio_xdr.c
-
-pkgconfigdir = ${libdir}/pkgconfig
-pkgconfig_DATA = libgmx@LIBSUFFIX@.pc
-
-# clean all libtool libraries, since the target names might have changed
-CLEANFILES = *.la *~ \\\#* innerc.c innerf.f mkinl
-
-if USE_VERSION_H
-#version.c contains generated git version information
-libgmx@LIBSUFFIX@_la_SOURCES += version.c
-CLEANFILES += version.c
-#The empty target FORCE forces make to run the command every time. But
-#version.c is only changed if the version actually has changed, and hence
-#rebuilds are only triggered when they are needed.
-version.c: FORCE
- $(top_srcdir)/src/gmxlib/genversion.sh @VERSION@ $(top_srcdir)
-FORCE:
-endif
-
-EXTRA_DIST = version.h libgmx.pc.cmakein
return vtot;
}
+real anharm_polarize(int nbonds,
+ const t_iatom forceatoms[],const t_iparams forceparams[],
+ const rvec x[],rvec f[],rvec fshift[],
+ const t_pbc *pbc,const t_graph *g,
+ real lambda,real *dvdlambda,
+ const t_mdatoms *md,t_fcdata *fcd,
+ int *global_atom_index)
+{
+ int i,m,ki,ai,aj,type;
+ real dr,dr2,fbond,vbond,fij,vtot,ksh,khyp,drcut,ddr,ddr3;
+ rvec dx;
+ ivec dt;
+
+ vtot = 0.0;
+ for(i=0; (i<nbonds); ) {
+ type = forceatoms[i++];
+ ai = forceatoms[i++];
+ aj = forceatoms[i++];
+ ksh = sqr(md->chargeA[aj])*ONE_4PI_EPS0/forceparams[type].anharm_polarize.alpha; /* 7*/
+ khyp = forceparams[type].anharm_polarize.khyp;
+ drcut = forceparams[type].anharm_polarize.drcut;
+ if (debug)
+ fprintf(debug,"POL: local ai = %d aj = %d ksh = %.3f\n",ai,aj,ksh);
+
+ ki = pbc_rvec_sub(pbc,x[ai],x[aj],dx); /* 3 */
+ dr2 = iprod(dx,dx); /* 5 */
+ dr = dr2*gmx_invsqrt(dr2); /* 10 */
+
+ *dvdlambda += harmonic(ksh,ksh,0,0,dr,lambda,&vbond,&fbond); /* 19 */
+
+ if (dr2 == 0.0)
+ continue;
+
+ if (dr > drcut) {
+ ddr = dr-drcut;
+ ddr3 = ddr*ddr*ddr;
+ vbond += khyp*ddr*ddr3;
+ fbond -= 4*khyp*ddr3;
+ }
+ fbond *= gmx_invsqrt(dr2); /* 6 */
+ vtot += vbond;/* 1*/
+
+ if (g) {
+ ivec_sub(SHIFT_IVEC(g,ai),SHIFT_IVEC(g,aj),dt);
+ ki=IVEC2IS(dt);
+ }
+ for (m=0; (m<DIM); m++) { /* 15 */
+ fij=fbond*dx[m];
+ f[ai][m]+=fij;
+ f[aj][m]-=fij;
+ fshift[ki][m]+=fij;
+ fshift[CENTRAL][m]-=fij;
+ }
+ } /* 72 TOTAL */
+ return vtot;
+}
+
real water_pol(int nbonds,
const t_iatom forceatoms[],const t_iparams forceparams[],
const rvec x[],rvec f[],rvec fshift[],
return vtot;
}
+real linear_angles(int nbonds,
+ const t_iatom forceatoms[],const t_iparams forceparams[],
+ const rvec x[],rvec f[],rvec fshift[],
+ const t_pbc *pbc,const t_graph *g,
+ real lambda,real *dvdlambda,
+ const t_mdatoms *md,t_fcdata *fcd,
+ int *global_atom_index)
+{
+ int i,m,ai,aj,ak,t1,t2,type;
+ rvec f_i,f_j,f_k;
+ real L1,kA,kB,aA,aB,dr,dr2,va,vtot,a,b,klin,dvdl;
+ ivec jt,dt_ij,dt_kj;
+ rvec r_ij,r_kj,r_ik,dx;
+
+ L1 = 1-lambda;
+ vtot = 0.0;
+ dvdl = 0.0;
+ for(i=0; (i<nbonds); ) {
+ type = forceatoms[i++];
+ ai = forceatoms[i++];
+ aj = forceatoms[i++];
+ ak = forceatoms[i++];
+
+ kA = forceparams[type].linangle.klinA;
+ kB = forceparams[type].linangle.klinB;
+ klin = L1*kA + lambda*kB;
+
+ aA = forceparams[type].linangle.aA;
+ aB = forceparams[type].linangle.aB;
+ a = L1*aA+lambda*aB;
+ b = 1-a;
+
+ t1 = pbc_rvec_sub(pbc,x[ai],x[aj],r_ij);
+ t2 = pbc_rvec_sub(pbc,x[ak],x[aj],r_kj);
+ rvec_sub(r_ij,r_kj,r_ik);
+
+ dr2 = 0;
+ for(m=0; (m<DIM); m++)
+ {
+ dr = - a * r_ij[m] - b * r_kj[m];
+ dr2 += dr*dr;
+ dx[m] = dr;
+ f_i[m] = a*klin*dr;
+ f_k[m] = b*klin*dr;
+ f_j[m] = -(f_i[m]+f_k[m]);
+ f[ai][m] += f_i[m];
+ f[aj][m] += f_j[m];
+ f[ak][m] += f_k[m];
+ }
+ va = 0.5*klin*dr2;
+ dvdl += 0.5*(kB-kA)*dr2 + klin*(aB-aA)*iprod(dx,r_ik);
+
+ vtot += va;
+
+ if (g) {
+ copy_ivec(SHIFT_IVEC(g,aj),jt);
+
+ ivec_sub(SHIFT_IVEC(g,ai),jt,dt_ij);
+ ivec_sub(SHIFT_IVEC(g,ak),jt,dt_kj);
+ t1=IVEC2IS(dt_ij);
+ t2=IVEC2IS(dt_kj);
+ }
+ rvec_inc(fshift[t1],f_i);
+ rvec_inc(fshift[CENTRAL],f_j);
+ rvec_inc(fshift[t2],f_k);
+ } /* 57 TOTAL */
+ *dvdlambda = dvdl;
+ return vtot;
+}
+
real urey_bradley(int nbonds,
const t_iatom forceatoms[],const t_iparams forceparams[],
const rvec x[],rvec f[],rvec fshift[],
/* Loop over all bonded force types to calculate the bonded forces */
for(ftype=0; (ftype<F_NRE); ftype++) {
if(ftype<F_GB12 || ftype>F_GB14) {
- if (interaction_function[ftype].flags & IF_BOND &&
+ if ((interaction_function[ftype].flags & IF_BOND) &&
!(ftype == F_CONNBONDS || ftype == F_POSRES)) {
nbonds=idef->il[ftype].nr;
if (nbonds > 0) {
for(ftype=0; (ftype<F_NRE); ftype++) {
if(ftype<F_GB12 || ftype>F_GB14) {
- if (interaction_function[ftype].flags & IF_BOND &&
+ if ((interaction_function[ftype].flags & IF_BOND) &&
!(ftype == F_CONNBONDS || ftype == F_POSRES))
{
nbonds_np = idef->il[ftype].nr_nonperturbed;
#include "gmx_fatal.h"
#include "calcgrid.h"
-#define facNR 4
-const int factor[facNR] = {2,3,5,7};
+/* The grid sizes below are based on timing of a 3D cubic grid in fftw
+ * compiled with SSE using 4 threads in fft5d.c.
+ * A grid size is removed when a larger grid is faster.
+ */
-static void make_list(int start_fac,int *ng,int ng_max,int *n_list,int **list)
-{
- int i,fac;
-
- if (*ng < ng_max)
- {
- if (*n_list % 100 == 0)
- {
- srenew(*list,*n_list+100);
- }
- (*list)[*n_list] = *ng;
- (*n_list)++;
-
- for(i=start_fac; i<facNR; i++)
- {
- fac = factor[i];
- /* The choice of grid size is based on benchmarks of fftw
- * and the need for a lot of factors for nice DD decomposition.
- * The base criterion is that a grid size is not included
- * when there is a larger grid size that produces a faster 3D FFT.
- * Allow any power for 2, two for 3 and 5, but only one for 7.
- * Three for 3 are ok when there is also a factor of 2.
- * Two factors of 5 are not allowed with a factor of 3 or 7.
- * A factor of 7 does not go with a factor of 5, 7 or 9.
- */
- if ((fac == 2) ||
- (fac == 3 && (*ng % 9 != 0 ||
- (*ng % 2 == 0 && *ng % 27 != 0))) ||
- (fac == 5 && *ng % 15 != 0 && *ng % 25 != 0) ||
- (fac == 7 && *ng % 5 != 0 && *ng % 7 != 0 && *ng % 9 != 0))
- {
- *ng *= fac;
- make_list(i,ng,ng_max,n_list,list);
- *ng /= fac;
- }
- }
- }
-}
+/* Small grid size array */
+#define g_initNR 15
+const int grid_init[g_initNR] = { 6,8,10,12,14,16,20,24,25,28,32,36,40,42,44 };
-static int list_comp(const void *a,const void *b)
-{
- return (*((int *)a) - *((int *)b));
-}
+/* For larger grid sizes, a prefactor with any power of 2 can be added.
+ * Only sizes divisible by 4 should be used, 90 is allowed, 140 not.
+ */
+#define g_baseNR 14
+const int grid_base[g_baseNR] = { 45,48,50,52,54,56,60,64,70,72,75,80,81,84 };
real calc_grid(FILE *fp,matrix box,real gr_sp,
int *nx,int *ny,int *nz)
{
int d,n[DIM];
- int i,j,nmin[DIM];
- rvec box_size,spacing;
+ int i;
+ rvec box_size;
+ int nmin,fac2,try;
+ rvec spacing;
real max_spacing;
- int ng_max,ng;
- int n_list,*list;
if (gr_sp <= 0)
{
gmx_fatal(FARGS,"invalid fourier grid spacing: %g",gr_sp);
}
+ if (grid_base[g_baseNR-1] % 4 != 0)
+ {
+ gmx_incons("the last entry in grid_base is not a multiple of 4");
+ }
+
/* New grid calculation setup:
*
* To maintain similar accuracy for triclinic PME grids as for rectangular
n[XX] = *nx;
n[YY] = *ny;
n[ZZ] = *nz;
-
- ng = 1;
- ng_max = 1;
- for(d=0; d<DIM; d++)
- {
- nmin[d] = (int)(box_size[d]/gr_sp + 0.999);
- if (2*nmin[d] > ng_max)
- {
- ng_max = 2*nmin[d];
- }
- }
- n_list=0;
- list=NULL;
- make_list(0,&ng,ng_max,&n_list,&list);
-
+
if ((*nx<=0) || (*ny<=0) || (*nz<=0))
{
if (NULL != fp)
}
}
- qsort(list,n_list,sizeof(list[0]),list_comp);
- if (debug)
- {
- for(i=0; i<n_list; i++)
- fprintf(debug,"grid: %d\n",list[i]);
- }
-
+ max_spacing = 0;
for(d=0; d<DIM; d++)
{
- for(i=0; (i<n_list) && (n[d]<=0); i++)
+ if (n[d] <= 0)
{
- if (list[i] >= nmin[d])
+ nmin = (int)(box_size[d]/gr_sp + 0.999);
+
+ i = g_initNR - 1;
+ if (grid_init[i] >= nmin)
{
- n[d] = list[i];
+ /* Take the smallest possible grid in the list */
+ while (i > 0 && grid_init[i-1] >= nmin)
+ {
+ i--;
+ }
+ n[d] = grid_init[i];
+ }
+ else
+ {
+ /* Determine how many pre-factors of 2 we need */
+ fac2 = 1;
+ i = g_baseNR - 1;
+ while (fac2*grid_base[i-1] < nmin)
+ {
+ fac2 *= 2;
+ }
+ /* Find the smallest grid that is >= nmin */
+ do
+ {
+ try = fac2*grid_base[i];
+ /* We demand a factor of 4, avoid 140, allow 90 */
+ if (((try % 4 == 0 && try != 140) || try == 90) &&
+ try >= nmin)
+ {
+ n[d] = try;
+ }
+ i--;
+ }
+ while (i > 0);
}
}
- }
-
- sfree(list);
-
- max_spacing = 0;
- for(d=0; d<DIM; d++)
- {
+
spacing[d] = box_size[d]/n[d];
if (spacing[d] > max_spacing)
{
cp_error();
}
*bReadEkin = ((flags_eks & (1<<eeksEKINH)) || (flags_eks & (1<<eeksEKINF)) || (flags_eks & (1<<eeksEKINO)) ||
- (flags_eks & (1<<eeksEKINSCALEF)) | (flags_eks & (1<<eeksEKINSCALEH)) | (flags_eks & (1<<eeksVSCALE)));
+ ((flags_eks & (1<<eeksEKINSCALEF)) | (flags_eks & (1<<eeksEKINSCALEH)) | (flags_eks & (1<<eeksVSCALE))));
ret = do_cpt_enerhist(gmx_fio_getxdr(fp),TRUE,
flags_enh,&state->enerhist,NULL);
#include "typedefs.h"
#include "smalloc.h"
#include "sysstuff.h"
-#include "errno.h"
+#include <errno.h>
#include "macros.h"
#include "string2.h"
#include "confio.h"
"Found more coordinates (%d) in %s than expected %d\n",
natoms,infile,nwanted);
if (atoms) {
- if (atoms && fr->bAtoms &&
+ if (fr->bAtoms &&
(sscanf(line,"%5d%c%5s%c%5s%7d",&resnr,&c1,resnm,&c2,anm,&atnr)
!= 6)) {
if (oldres>=0)
gmx_fio_fclose(in);
}
-static void get_conf(FILE *in,char *title,int *natoms,
- rvec x[],rvec *v,matrix box)
-{
- t_atoms atoms;
- int ndec;
-
- atoms.nr=*natoms;
- snew(atoms.atom,*natoms);
- atoms.nres=*natoms;
- snew(atoms.resinfo,*natoms);
- snew(atoms.atomname,*natoms);
-
- get_w_conf(in,title,title,&atoms,&ndec,x,v,box);
-
- sfree(atoms.atom);
- sfree(atoms.resinfo);
- sfree(atoms.atomname);
-}
-
gmx_bool gro_next_x_or_v(FILE *status,t_trxframe *fr)
{
t_atoms atoms;
#include <config.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include <thread_mpi.h>
#endif
#include "smalloc.h"
#include "string2.h"
#include "macros.h"
-#include "time.h"
+#include <time.h>
#include "random.h"
#include "statutil.h"
#include "copyrite.h"
"Driving Forces for Adsorption of Amphiphilic Peptides to Air-Water Interface",
"J. Phys. Chem. B",
0, 2010, "???" },
+ { "Fritsch12",
+ "S. Fritsch, C. Junghans and K. Kremer",
+ "Adaptive molecular simulation study on structure formation of toluene around C60 using Gromacs",
+ "J. Chem. Theo. Comp.",
+ 0, 2012, "doi:10.1021/ct200706f" },
+ { "Junghans10",
+ "C. Junghans and S. Poblete",
+ "A reference implementation of the adaptive resolution scheme in ESPResSo",
+ "Comp. Phys. Comm.",
+ 181, 2010, "1449" },
{ "Wang2010",
"H. Wang, F. Dommert, C.Holm",
"Optimizing working parameters of the smooth particle mesh Ewald algorithm in terms of accuracy and efficiency",
"J. Chem. Phys. B",
- 133, 2010, "034117"
+ 133, 2010, "034117" },
+ { "Kutzner2011",
+ "C. Kutzner and J. Czub and H. Grubmuller",
+ "Keep it Flexible: Driving Macromolecular Rotary Motions in Atomistic Simulations with GROMACS",
+ "J. Chem. Theory Comput.",
+ 7, 2011, "1381-1393" },
+ { "Hoefling2011",
+ "M. Hoefling, N. Lima, D. Haenni, C.A.M. Seidel, B. Schuler, H. Grubmuller",
+ "Structural Heterogeneity and Quantitative FRET Efficiency Distributions of Polyprolines through a Hybrid Atomistic Simulation and Monte Carlo Approach",
+ "PLoS ONE",
+ 6, 2011, "e19791"
}
};
#define NSTR (int)asize(citedb)
fprintf(fp, "Precision: single\n");
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
fprintf(fp, "Parallellization: thread_mpi\n");
#elif defined(GMX_MPI)
fprintf(fp, "Parallellization: MPI\n");
#ifdef GMX_FFT_FFTPACK
fprintf(fp, "FFT Library: fftpack\n");
-#elif defined(GMX_FFT_FFTW2)
- fprintf(fp, "FFT Library: fftw2\n");
#elif defined(GMX_FFT_FFTW3)
fprintf(fp, "FFT Library: fftw3\n");
#elif defined(GMX_FFT_MKL)
}
}
-static void gen_units(int n,char ***units)
-{
- int i;
-
- snew(*units,n);
- for(i=0; i<n; i++)
- {
- (*units)[i] = strdup("kJ/mol");
- }
-}
-
void do_enxnms(ener_file_t ef,int *nre,gmx_enxnm_t **nms)
{
int magic=-55555;
#include "xdrf.h"
#include "macros.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
static char *default_file_name = NULL;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
static tMPI_Thread_mutex_t filenm_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
#endif
void set_default_file_name(const char *name)
{
int i;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&filenm_mutex);
#endif
default_file_name = strdup(name);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&filenm_mutex);
#endif
{
const char *buf = NULL;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&filenm_mutex);
#endif
buf = deffile[ftp].defnm;
}
}
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&filenm_mutex);
#endif
#include "statutil.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
static t_pstack *pstack=NULL;
static gmx_bool bUnbuffered=FALSE;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* this linked list is an intrinsically globally shared object, so we have
to protect it with mutexes */
static tMPI_Thread_mutex_t pstack_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
{
t_pstack *ps;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&pstack_mutex);
#endif
ps->fp = fp;
ps->prev = pstack;
pstack = ps;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
#endif
}
#else
t_pstack *ps,*tmp;
int ret=0;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&pstack_mutex);
#endif
ret = fclose(fp);
}
}
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
#endif
return ret;
void frewind(FILE *fp)
{
t_pstack *ps;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&pstack_mutex);
#endif
while (ps != NULL) {
if (ps->fp == fp) {
fprintf(stderr,"Cannot rewind compressed file!\n");
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
#endif
return;
ps=ps->prev;
}
rewind(fp);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
#endif
}
gmx_bool is_pipe(FILE *fp)
{
t_pstack *ps;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&pstack_mutex);
#endif
ps=pstack;
while (ps != NULL) {
if (ps->fp == fp) {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
#endif
return TRUE;
}
ps=ps->prev;
}
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&pstack_mutex);
#endif
return FALSE;
+++ /dev/null
-#error XXXXXXX
-
low_rotate_conf(natom,v,alfa,beta,gamma);
}
-void rotate_conf_indexed(int nindex,atom_id *index,rvec *x,rvec *v,real alfa, real beta,real gamma)
-{
- if (x)
- low_rotate_conf_indexed(nindex,index,x,alfa,beta,gamma);
- if (v)
- low_rotate_conf_indexed(nindex,index,v,alfa,beta,gamma);
-}
-
void orient(int natom,rvec *x,rvec *v, rvec angle,matrix box)
{
real longest,rij,rzi;
+++ /dev/null
-.libs
-.deps
+++ /dev/null
-# Convenience library for optional built-in BLAS routines - not installed.
-
-AM_CPPFLAGS= -I$(top_srcdir)/include
-
-
-noinst_LTLIBRARIES = libblas.la
-
-libblas_la_SOURCES = \
- dasum.c dcopy.c dgemm.c dger.c \
- drot.c dswap.c dsyr2.c dtrmm.c \
- dtrsm.c daxpy.c ddot.c dgemv.c \
- dnrm2.c dscal.c dsymv.c dsyr2k.c \
- dtrmv.c idamax.c \
- sasum.c scopy.c sgemm.c sger.c \
- srot.c sswap.c ssyr2.c strmm.c \
- strsm.c saxpy.c sdot.c sgemv.c \
- snrm2.c sscal.c ssymv.c ssyr2k.c \
- strmv.c isamax.c
-
-EXTRA_DIST = blas_copyright
-
-CLEANFILES = *.la *~ \\\#*
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
static char *fatal_tmp_file = NULL;
static FILE *log_file = NULL;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
static tMPI_Thread_mutex_t debug_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
static tMPI_Thread_mutex_t where_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
static tMPI_Thread_mutex_t fatal_tmp_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
gmx_bool bDebugMode(void)
{
gmx_bool ret;
-/*#ifdef GMX_THREADS*/
+/*#ifdef GMX_THREAD_MPI*/
#if 0
tMPI_Thread_mutex_lock(&debug_mutex);
#endif
ret=bDebug;
-/*#ifdef GMX_THREADS*/
+/*#ifdef GMX_THREAD_MPI*/
#if 0
tMPI_Thread_mutex_unlock(&debug_mutex);
#endif
char *temp;
if ( bFirst ) {
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&where_mutex);
if (bFirst) /* we repeat the check in the locked section because things
might have changed */
if ((temp=getenv("WHERE")) != NULL)
nskip = strtol(temp, NULL, 10);
bFirst = FALSE;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
}
tMPI_Thread_mutex_unlock(&where_mutex);
#endif
static void quit_gmx(const char *msg)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&debug_mutex);
#endif
if (fatal_errno == 0)
perror(msg);
}
-#ifndef GMX_THREADS
+#ifndef GMX_THREAD_MPI
if (gmx_parallel_env_initialized())
{
int nnodes;
}
exit(fatal_errno);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&debug_mutex);
#endif
}
*/
static void quit_gmx_noquit(const char *msg)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&debug_mutex);
#endif
if (!fatal_errno)
}
}
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&debug_mutex);
#endif
}
void _set_fatal_tmp_file(const char *fn, const char *file, int line)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&fatal_tmp_mutex);
#endif
if (fatal_tmp_file == NULL)
else
fprintf(stderr,"BUGWARNING: fatal_tmp_file already set at %s:%d",
file,line);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&fatal_tmp_mutex);
#endif
}
void _unset_fatal_tmp_file(const char *fn, const char *file, int line)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&fatal_tmp_mutex);
#endif
if (strcmp(fn,fatal_tmp_file) == 0) {
} else
fprintf(stderr,"BUGWARNING: file %s not set as fatal_tmp_file at %s:%d",
fn,file,line);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&fatal_tmp_mutex);
#endif
}
static void clean_fatal_tmp_file()
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&fatal_tmp_mutex);
#endif
if (fatal_tmp_file) {
sfree(fatal_tmp_file);
fatal_tmp_file = NULL;
}
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&fatal_tmp_mutex);
#endif
}
va_end(ap);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&debug_mutex);
#endif
fatal_errno = f_errno;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&debug_mutex);
#endif
va_end(ap);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&debug_mutex);
#endif
fatal_errno = f_errno;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&debug_mutex);
#endif
void init_debug (const int dbglevel,const char *dbgfile)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&debug_mutex);
#endif
if (!bDebug) /* another thread hasn't already run this*/
if (dbglevel >= 2)
gmx_debug_at = TRUE;
}
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&debug_mutex);
#endif
}
int onoff,en_mask,abort_action,i;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&debug_mutex);
#endif
onoff = _DEBUG;
for(i=0; (i<asize(hs)); i++)
signal(hs[i],handle_signals);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&debug_mutex);
#endif
}
void set_gmx_error_handler(void (*func)(const char *msg))
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&debug_mutex);
#endif
gmx_error_handler = func;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&debug_mutex);
#endif
}
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-# Convenience library for optional built-in LAPACK routines - not installed.
-
-AM_CPPFLAGS= -I$(top_srcdir)/include
-
-
-noinst_LTLIBRARIES = liblapack.la
-
-liblapack_la_SOURCES = \
- dbdsdc.c dgetf2.c dlamrg.c dlarnv.c dlasd0.c dlasda.c dlasq6.c \
- dorgl2.c dormqr.c dbdsqr.c dgetrf.c dlange.c dlasd1.c dtrtri.c \
- dlasdq.c dlasr.c dorglq.c dormtr.c dgebd2.c dlabrd.c dlanst.c \
- dlasd2.c dlasdt.c dlasrt.c dorgqr.c dstebz.c dgebrd.c dsytrd.c \
- dlacpy.c dlapy2.c dlasd3.c dlaset.c dlassq.c dorm2l.c dgetrs.c \
- dstegr.c dgelq2.c dlae2.c dlasd4.c dlasq1.c dtrti2.c dgetri.c \
- dlasv2.c dorm2r.c dstein.c dgelqf.c dlaebz.c dlarf.c dlartg.c \
- dlasd5.c dlasq2.c dlaswp.c dormbr.c dsterf.c dgeqr2.c dlaed6.c \
- dlarfb.c dlaruv.c dlasd6.c dlasq3.c dlatrd.c dorml2.c dstevr.c \
- dgeqrf.c dlagtf.c dlarfg.c dlas2.c dlasd7.c dlasq4.c dorg2r.c \
- dormlq.c dsytd2.c dgesdd.c dlagts.c dlarft.c dlascl.c dlasd8.c \
- dlasq5.c dorgbr.c dormql.c dlaev2.c dsteqr.c dsyevr.c dlasrt2.c \
- dlansy.c \
- dlar1vx.c dlarrbx.c dlarrex.c dlarrfx.c \
- dlarrvx.c \
- sbdsdc.c sgetf2.c slamrg.c slarnv.c slasd0.c slasda.c slasq6.c \
- sorgl2.c sormqr.c sbdsqr.c sgetrf.c slange.c slasd1.c ssytrd.c \
- slasdq.c slasr.c sorglq.c sormtr.c sgebd2.c slabrd.c slanst.c \
- slasd2.c slasdt.c slasrt.c sorgqr.c sstebz.c sgebrd.c sgetrs.c \
- slacpy.c slapy2.c slasd3.c slaset.c slassq.c sorm2l.c sgetri.c \
- sstegr.c sgelq2.c slae2.c slasd4.c slasq1.c strti2.c strtri.c \
- slasv2.c sorm2r.c sstein.c sgelqf.c slaebz.c slarf.c slartg.c \
- slasd5.c slasq2.c slaswp.c sormbr.c ssterf.c sgeqr2.c slaed6.c \
- slarfb.c slaruv.c slasd6.c slasq3.c slatrd.c sorml2.c sstevr.c \
- sgeqrf.c slagtf.c slarfg.c slas2.c slasd7.c slasq4.c sorg2r.c \
- sormlq.c ssytd2.c sgesdd.c slagts.c slarft.c slascl.c slasd8.c \
- slasq5.c sorgbr.c sormql.c slaev2.c ssteqr.c ssyevr.c slasrt2.c \
- slansy.c \
- slar1vx.c slarrbx.c slarrex.c slarrfx.c \
- slarrvx.c \
- ilasrt2.c lapack_limits.h
-
-EXTRA_DIST = lapack_copyright
-
-CLEANFILES = *.la *~ \\\#*
size_t size,
int (*compar)(const void *, const void *))
{
-#define QSORT_EXCH(a, b, t) (t = a, a = b, b = t);
+#define QSORT_EXCH(a, b, t) (t = a, a = b, b = t)
#define QSORT_SWAP(a, b) swaptype != 0 ? qsort_swapfunc(a, b, size, swaptype) : \
(void)QSORT_EXCH(*(int *)(a), *(int *)(b), t)
#include "gmxfio.h"
#include "md5.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
static t_fileio *open_files = NULL;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* this mutex locks the open_files structure so that no two threads can
modify it.
type of access to the fio's elements. */
void gmx_fio_lock(t_fileio *fio)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Lock_lock(&(fio->mtx));
#endif
}
/* unlock the mutex associated with this fio. */
void gmx_fio_unlock(t_fileio *fio)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Lock_unlock(&(fio->mtx));
#endif
}
open_files->fn=NULL;
open_files->next=open_files;
open_files->prev=open_files;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Lock_init(&(open_files->mtx));
#endif
}
static void gmx_fio_insert(t_fileio *fio)
{
t_fileio *prev;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* first lock the big open_files mutex. */
tMPI_Thread_mutex_lock(&open_file_mutex);
#endif
gmx_fio_unlock(open_files);
gmx_fio_unlock(fio);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* now unlock the big open_files mutex. */
tMPI_Thread_mutex_unlock(&open_file_mutex);
#endif
t_fileio *ret;
/* first lock the big open_files mutex and the dummy's mutex */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* first lock the big open_files mutex. */
tMPI_Thread_mutex_lock(&open_file_mutex);
#endif
if (fio->next==open_files)
{
ret=NULL;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&open_file_mutex);
#endif
}
static void gmx_fio_stop_getting_next(t_fileio *fio)
{
gmx_fio_unlock(fio);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&open_file_mutex);
#endif
}
}
snew(fio, 1);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Lock_init(&(fio->mtx));
#endif
bRead = (newmode[0]=='r' && newmode[1]!='+');
{
int rc = 0;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* first lock the big open_files mutex. */
/* We don't want two processes operating on the list at the same time */
tMPI_Thread_mutex_lock(&open_file_mutex);
sfree(fio);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&open_file_mutex);
#endif
#include "gmxfio.h"
#include "md5.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
#include "gmxfio.h"
#include "md5.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
t_fileio *next, *prev; /* next and previous file pointers in the
linked list */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Lock_t mtx; /* content locking mutex. This is a fast lock
for performance reasons: in some cases every
single byte that gets read/written requires
#include "gmxfio.h"
#include "md5.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
#include "gmxfio.h"
#include "md5.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
def_bonded ("RESTRAINTPOT", "Restraint Pot.", 2, 4, 4, eNR_RESTRBONDS, restraint_bonds ),
def_angle ("ANGLES", "Angle", 3, 2, 2, eNR_ANGLES, angles ),
def_angle ("G96ANGLES","G96Angle", 3, 2, 2, eNR_ANGLES, g96angles ),
+ def_angle ("LINEAR_ANGLES", "Lin. Angle", 3, 2, 2, eNR_LINEAR_ANGLES, linear_angles ),
def_bonded ("CROSS_BOND_BOND", "Bond-Cross", 3, 3, 0,0, cross_bond_bond ),
def_bonded ("CROSS_BOND_ANGLE","BA-Cross", 3, 4, 0,0, cross_bond_angle ),
def_angle ("UREY_BRADLEY","U-B", 3, 4, 0, 0, urey_bradley ),
def_bondnb ("POLARIZATION", "Polarization",2, 1, 0, 0, polarize ),
def_bonded ("WATERPOL", "Water Pol.", 5, 6, 0, eNR_WPOL, water_pol ),
def_bonded ("THOLE", "Thole Pol.", 4, 3, 0, eNR_THOLE, thole_pol ),
+ def_bondnb ("ANHARM_POL", "Anharm. Pol.",2, 3, 0, 0, anharm_polarize ),
def_bonded ("POSRES", "Position Rest.", 1, 3, 3, eNR_POSRES, unimplemented ),
def_bonded ("DISRES", "Dis. Rest.", 2, 6, 0, eNR_DISRES, ta_disres ),
def_nofc ("DRVIOL", "D.R.Viol. (nm)" ),
def_nofc ("DK/DL", "dEkin/dlambda" ),
def_nofc ("DH/DL_CON","dH/dl constr." )
};
-
-gmx_bool have_interaction(t_idef *idef,int ftype)
-{
- int i;
-
- for(i=0; (i<idef->ntypes); i++)
- if (idef->functype[i] == ftype)
- return TRUE;
- return FALSE;
-}
+++ /dev/null
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: libgmx
-Description: Gromacs default lib
-URL: http://www.gromacs.org
-Version: @VERSION@
-Requires:
-Libs: -L${libdir} -lgmx@LIBSUFFIX@ @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ -lm
-Cflags: -I${includedir} @PTHREAD_CFLAGS@ @PKG_CFLAGS@
-
static XDR *xdridptr[MAXID];
static char xdrmodes[MAXID];
static unsigned int cnt;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* we need this because of the global variables above for FORTRAN binding.
The I/O operations are going to be slow. */
static tMPI_Thread_mutex_t xdr_fortran_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
static void xdr_fortran_lock(void)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&xdr_fortran_mutex);
#endif
}
static void xdr_fortran_unlock(void)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&xdr_fortran_mutex);
#endif
}
char newtype[5];
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
if (!tMPI_Thread_mutex_trylock( &xdr_fortran_mutex ))
{
tMPI_Thread_mutex_unlock( &xdr_fortran_mutex );
int xdrid;
int rc = 0;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
if (!tMPI_Thread_mutex_trylock( &xdr_fortran_mutex ))
{
tMPI_Thread_mutex_unlock( &xdr_fortran_mutex );
#include "gmxfio.h"
#include "string2.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
of the simulation, once by each thread with the same value. We assume
that writing to an int is atomic.*/
static gmx_bool parallel_env_val;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_t parallel_env_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
#endif
gmx_bool gmx_parallel_env_initialized(void)
{
gmx_bool ret;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(¶llel_env_mutex);
#endif
ret=parallel_env_val;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(¶llel_env_mutex);
#endif
return ret;
static void set_parallel_env(gmx_bool val)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(¶llel_env_mutex);
#endif
if (!parallel_env_val)
/* we only allow it to be set, not unset */
parallel_env_val=val;
}
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(¶llel_env_mutex);
#endif
}
/* Communicate the filename for logfile */
if (cr->nnodes > 1 && !bMasterOnly
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* With thread MPI the non-master log files are opened later
* when the files names are already known on all nodes.
*/
MPI_Comm_create(MPI_COMM_WORLD,ms->mpi_group_masters,
&ms->mpi_comm_masters);
-#if !defined(GMX_THREADS) && !defined(MPI_IN_PLACE_EXISTS)
+#if !defined(GMX_THREAD_MPI) && !defined(MPI_IN_PLACE_EXISTS)
/* initialize the MPI_IN_PLACE replacement buffers */
snew(ms->mpb, 1);
ms->mpb->ibuf=NULL;
cr->duty = (DUTY_PP | DUTY_PME);
/* Communicate arguments if parallel */
-#ifndef GMX_THREADS
+#ifndef GMX_THREAD_MPI
if (PAR(cr))
comm_args(cr,argc,argv_ptr);
-#endif /* GMX_THREADS */
+#endif /* GMX_THREAD_MPI */
#ifdef GMX_MPI
-#if !defined(GMX_THREADS) && !defined(MPI_IN_PLACE_EXISTS)
+#if !defined(GMX_THREAD_MPI) && !defined(MPI_IN_PLACE_EXISTS)
/* initialize the MPI_IN_PLACE replacement buffers */
snew(cr->mpb, 1);
cr->mpb->ibuf=NULL;
t_commrec *init_par_threads(const t_commrec *cro)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
int initialized;
t_commrec *cr;
* ====================================================
*/
-#if (INT_MAX == 2147483647)
+#if ( (defined SIZEOF_INT && SIZEOF_INT==4) || (SIZEOF_INT_MAX == 2147483647) )
typedef int erf_int32_t;
typedef unsigned int erf_u_int32_t;
#elif (LONG_MAX == 2147483647L)
#endif
-float fast_float_erf(float x)
-{
- float t,ans;
-
- t=1.0/(1.0+0.5*x);
- ans=t*exp(-x*x-1.26551223+t*(1.00002368+t*(0.37409196+t*(0.09678418+
- t*(-0.18628806+t*(0.27886807+t*(-1.13520398+t*(1.48851587+
- t*(-0.82215223+t*0.17087277)))))))));
- return 1.0-ans;
-}
-
-float fast_float_erfc(float x)
-{
- float t,ans;
-
- t=1.0/(1.0+0.5*x);
- ans=t*exp(-x*x-1.26551223+t*(1.00002368+t*(0.37409196+t*(0.09678418+
- t*(-0.18628806+t*(0.27886807+t*(-1.13520398+t*(1.48851587+
- t*(-0.82215223+t*0.17087277)))))))));
- return ans;
-}
-
gmx_bool gmx_isfinite(real x)
{
gmx_bool returnval = TRUE;
gmx_fio_fclose(out);
}
-void do_wmap(FILE *out,int i0,int imax,
- int nlevels,t_rgb rlo,t_rgb rhi,real lo,real hi)
-{
- int i,nlo;
- real r,g,b;
-
- for(i=0; (i<imax); i++) {
- nlo=nlevels-i;
- r=(nlo*rlo.r+i*rhi.r)/nlevels;
- g=(nlo*rlo.g+i*rhi.g)/nlevels;
- b=(nlo*rlo.b+i*rhi.b)/nlevels;
- fprintf(out,"%c %10.3g %10g %10g %10g\n",
- mapper[i+i0],(nlo*lo+i*hi)/nlevels,r,g,b);
- }
-}
-
static char *fgetline(char **line,int llmax,int *llalloc,FILE *in)
{
char *fg;
#else
/* Define storage for little-endian or both types of CPUs. */
md5_word_t xbuf[16];
+ /* cppcheck-suppress unassignedVariable */
const md5_word_t *X;
#endif
if (debug) fprintf(debug,"after bc_ilists\n");
}
-static void bc_idef(const t_commrec *cr,t_idef *idef)
-{
- block_bc(cr,idef->ntypes);
- block_bc(cr,idef->atnr);
- snew_bc(cr,idef->functype,idef->ntypes);
- snew_bc(cr,idef->iparams,idef->ntypes);
- nblock_bc(cr,idef->ntypes,idef->functype);
- nblock_bc(cr,idef->ntypes,idef->iparams);
- block_bc(cr,idef->fudgeQQ);
- bc_ilists(cr,idef->il);
- block_bc(cr,idef->ilsort);
-}
-
static void bc_cmap(const t_commrec *cr, gmx_cmap_t *cmap_grid)
{
int i,j,nelem,ngrid;
}
}
+static void bc_rotgrp(const t_commrec *cr,t_rotgrp *rotg)
+{
+ block_bc(cr,*rotg);
+ if (rotg->nat > 0) {
+ snew_bc(cr,rotg->ind,rotg->nat);
+ nblock_bc(cr,rotg->nat,rotg->ind);
+ snew_bc(cr,rotg->x_ref,rotg->nat);
+ nblock_bc(cr,rotg->nat,rotg->x_ref);
+ }
+}
+
+static void bc_rot(const t_commrec *cr,t_rot *rot)
+{
+ int g;
+
+ block_bc(cr,*rot);
+ snew_bc(cr,rot->grp,rot->ngrp);
+ for(g=0; g<rot->ngrp; g++)
+ bc_rotgrp(cr,&rot->grp[g]);
+}
+
+static void bc_adress(const t_commrec *cr,t_adress *adress)
+{
+ block_bc(cr,*adress);
+ if (adress->n_tf_grps > 0) {
+ snew_bc(cr, adress->tf_table_index, adress->n_tf_grps);
+ nblock_bc(cr, adress->n_tf_grps, adress->tf_table_index);
+ }
+ if (adress->n_energy_grps > 0) {
+ snew_bc(cr, adress->group_explicit, adress->n_energy_grps);
+ nblock_bc(cr, adress->n_energy_grps, adress->group_explicit);
+ }
+}
+
static void bc_inputrec(const t_commrec *cr,t_inputrec *inputrec)
{
gmx_bool bAlloc=TRUE;
snew_bc(cr,inputrec->pull,1);
bc_pull(cr,inputrec->pull);
}
+ if (inputrec->bRot) {
+ snew_bc(cr,inputrec->rot,1);
+ bc_rot(cr,inputrec->rot);
+ }
for(i=0; (i<DIM); i++) {
bc_cosines(cr,&(inputrec->ex[i]));
bc_cosines(cr,&(inputrec->et[i]));
}
+ if (inputrec->bAdress) {
+ snew_bc(cr,inputrec->adress,1);
+ bc_adress(cr,inputrec->adress);
+ }
}
static void bc_moltype(const t_commrec *cr,t_symtab *symtab,
};
const char *epull_names[epullNR+1] = {
- "no", "umbrella", "constraint", "constant_force", NULL
+ "no", "umbrella", "constraint", "constant-force", NULL
};
const char *epullg_names[epullgNR+1] = {
- "distance", "direction", "cylinder", "position", "direction_periodic", NULL
+ "distance", "direction", "cylinder", "position", "direction-periodic", NULL
+};
+
+const char *erotg_names[erotgNR+1] = {
+ "iso", "iso-pf", "pm", "pm-pf", "rm", "rm-pf", "rm2", "rm2-pf", "flex", "flex-t", "flex2", "flex2-t", NULL
+};
+
+const char *erotg_fitnames[erotgFitNR+1] = {
+ "rmsd", "norm", "potential", NULL
};
const char *eQMmethod_names[eQMmethodNR+1] = {
"multiple_entries", "no", "use_last", NULL
};
+const char *eAdresstype_names[eAdressNR+1] = {
+ "off","constant", "xsplit", "sphere", NULL
+};
+
+const char *eAdressICtype_names[eAdressICNR+1] = {
+ "off", "thermoforce", NULL
+};
+
+const char *eAdressSITEtype_names[eAdressSITENR+1] = {
+ "com","cog", "atom", "atomperatom", NULL
+};
+
#include "network.h"
#include "copyrite.h"
#include "statutil.h"
-#include "ctype.h"
+#include <ctype.h>
#include "macros.h"
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
#endif
}
+
+int gmx_hostname_num()
+{
+#ifndef GMX_MPI
+ return 0;
+#else
+ int resultlen,hostnum,i,j;
+ char mpi_hostname[MPI_MAX_PROCESSOR_NAME],hostnum_str[MPI_MAX_PROCESSOR_NAME];
+
+ MPI_Get_processor_name(mpi_hostname,&resultlen);
+ /* This procedure can only differentiate nodes with host names
+ * that end on unique numbers.
+ */
+ i = 0;
+ j = 0;
+ /* Only parse the host name up to the first dot */
+ while(i < resultlen && mpi_hostname[i] != '.') {
+ if (isdigit(mpi_hostname[i])) {
+ hostnum_str[j++] = mpi_hostname[i];
+ }
+ i++;
+ }
+ hostnum_str[j] = '\0';
+ if (j == 0) {
+ hostnum = 0;
+ } else {
+ /* Use only the last 9 decimals, so we don't overflow an int */
+ hostnum = strtol(hostnum_str + max(0,j-9), NULL, 10);
+ }
+
+ if (debug) {
+ fprintf(debug,"In gmx_setup_nodecomm: hostname '%s', hostnum %d\n",
+ mpi_hostname,hostnum);
+ }
+ return hostnum;
+#endif
+}
+
void gmx_setup_nodecomm(FILE *fplog,t_commrec *cr)
{
gmx_nodecomm_t *nc;
- int n,rank,resultlen,hostnum,i,j,ng,ni;
-#ifdef GMX_MPI
- char mpi_hostname[MPI_MAX_PROCESSOR_NAME],num[MPI_MAX_PROCESSOR_NAME];
-#endif
+ int n,rank,hostnum,ng,ni;
/* Many MPI implementations do not optimize MPI_Allreduce
* (and probably also other global communication calls)
nc = &cr->nc;
nc->bUse = FALSE;
-#ifndef GMX_THREADS
+#ifndef GMX_THREAD_MPI
if (getenv("GMX_NO_NODECOMM") == NULL) {
#ifdef GMX_MPI
MPI_Comm_size(cr->mpi_comm_mygroup,&n);
MPI_Comm_rank(cr->mpi_comm_mygroup,&rank);
- MPI_Get_processor_name(mpi_hostname,&resultlen);
- /* This procedure can only differentiate nodes with host names
- * that end on unique numbers.
- */
- i = 0;
- j = 0;
- /* Only parse the host name up to the first dot */
- while(i < resultlen && mpi_hostname[i] != '.') {
- if (isdigit(mpi_hostname[i])) {
- num[j++] = mpi_hostname[i];
- }
- i++;
- }
- num[j] = '\0';
- if (j == 0) {
- hostnum = 0;
- } else {
- /* Use only the last 9 decimals, so we don't overflow an int */
- hostnum = strtol(num + max(0,j-9), NULL, 10);
- }
+
+ hostnum = gmx_hostname_num();
if (debug) {
fprintf(debug,
- "In gmx_setup_nodecomm: splitting communicator of size %d\n",
- n);
- fprintf(debug,"In gmx_setup_nodecomm: hostname '%s', hostnum %d\n",
- mpi_hostname,hostnum);
+ "In gmx_setup_nodecomm: splitting communicator of size %d\n",
+ n);
}
+
/* The intra-node communicator, split on node number */
MPI_Comm_split(cr->mpi_comm_mygroup,hostnum,rank,&nc->comm_intra);
MPI_Comm_rank(nc->comm_intra,&nc->rank_intra);
#ifndef GMX_MPI
gmx_call("gmx_abort");
#else
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
fprintf(stderr,"Halting program %s\n",ShortProgram());
thanx(stderr);
exit(1);
#ifndef GMX_MPI
gmx_call("gmx_sumd");
#else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
if (cr->nc.bUse) {
if (cr->nc.rank_intra == 0)
{
#ifndef GMX_MPI
gmx_call("gmx_sumf");
#else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
if (cr->nc.bUse) {
/* Use two step summing. */
if (cr->nc.rank_intra == 0)
#ifndef GMX_MPI
gmx_call("gmx_sumi");
#else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
if (cr->nc.bUse) {
/* Use two step summing */
if (cr->nc.rank_intra == 0)
#ifndef GMX_MPI
gmx_call("gmx_sumli");
#else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
if (cr->nc.bUse) {
/* Use two step summing */
if (cr->nc.rank_intra == 0)
#ifdef GMX_MPI
void gmx_sumd_comm(int nr,double r[],MPI_Comm mpi_comm)
{
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
MPI_Allreduce(MPI_IN_PLACE,r,nr,MPI_DOUBLE,MPI_SUM,mpi_comm);
#else
/* this function is only used in code that is not performance critical,
#ifdef GMX_MPI
void gmx_sumf_comm(int nr,float r[],MPI_Comm mpi_comm)
{
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
MPI_Allreduce(MPI_IN_PLACE,r,nr,MPI_FLOAT,MPI_SUM,mpi_comm);
#else
/* this function is only used in code that is not performance critical,
#ifndef GMX_MPI
gmx_call("gmx_sumi_sim");
#else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
MPI_Allreduce(MPI_IN_PLACE,r,nr,MPI_INT,MPI_SUM,ms->mpi_comm_masters);
#else
/* this is thread-unsafe, but it will do for now: */
#ifndef GMX_MPI
gmx_call("gmx_sumli_sim");
#else
-#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREADS)
+#if defined(MPI_IN_PLACE_EXISTS) || defined(GMX_THREAD_MPI)
MPI_Allreduce(MPI_IN_PLACE,r,nr,GMX_MPI_LARGE_INT,MPI_SUM,
ms->mpi_comm_masters);
#else
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-if GMX_IA32_SSE
- IA32_SSE = nb_kernel_ia32_sse
- IA32_SSE_OBJ = nb_kernel_ia32_sse/libnb_kernel_ia32_sse.la
-endif
-
-if GMX_IA32_SSE2
- IA32_SSE2 = nb_kernel_ia32_sse2
- IA32_SSE2_OBJ = nb_kernel_ia32_sse2/libnb_kernel_ia32_sse2.la
-endif
-
-if GMX_X86_64_SSE
- X86_64_SSE = nb_kernel_x86_64_sse
- X86_64_SSE_OBJ = nb_kernel_x86_64_sse/libnb_kernel_x86_64_sse.la
-endif
-
-if GMX_X86_64_SSE2
- X86_64_SSE2 = nb_kernel_x86_64_sse2
- X86_64_SSE2_OBJ = nb_kernel_x86_64_sse2/libnb_kernel_x86_64_sse2.la
-endif
-
-if GMX_PPC_ALTIVEC
- PPC_ALTIVEC = nb_kernel_ppc_altivec
- PPC_ALTIVEC_OBJ = nb_kernel_ppc_altivec/libnb_kernel_ppc_altivec.la
-endif
-
-if GMX_IA64_ASM
-if GMX_DOUBLE
- IA64_DOUBLE = nb_kernel_ia64_double
- IA64_DOUBLE_OBJ = nb_kernel_ia64_double/libnb_kernel_ia64_double.la
-else
- IA64_SINGLE = nb_kernel_ia64_single
- IA64_SINGLE_OBJ = nb_kernel_ia64_single/libnb_kernel_ia64_single.la
-endif
-endif
-
-if GMX_BLUEGENE
- BLUEGENE = nb_kernel_bluegene
- BLUEGENE_OBJ = nb_kernel_bluegene/libnb_kernel_bluegene.la
-endif
-
-if GMX_POWER6
- POWER6 = nb_kernel_power6
- POWER6_OBJ = nb_kernel_power6/libnb_kernel_power6.la
-endif
-
-
-if GMX_FORTRAN
-if GMX_DOUBLE
- F77_DOUBLE = nb_kernel_f77_double
- F77_DOUBLE_OBJ = nb_kernel_f77_double/libnb_kernel_f77_double.la
-else
- F77_SINGLE = nb_kernel_f77_single
- F77_SINGLE_OBJ = nb_kernel_f77_single/libnb_kernel_f77_single.la
-endif
-endif
-
-
-
-SUBDIRS = $(IA32_SSE) $(IA32_SSE2) $(IA32_3DNOW) \
- $(X86_64_SSE) $(X86_64_SSE2) $(PPC_ALTIVEC) \
- $(IA64_SINGLE) $(IA64_DOUBLE) $(BLUEGENE) \
- $(POWER6) $(F77_DOUBLE) $(F77_SINGLE) \
- nb_kernel_c
-
-
-# Convenience library for nonbonded interactions - not installed.
-
-noinst_LTLIBRARIES = libnonbonded.la
-
-# Subdirectories will contain libtool convenience libraries.
-# These are not installed, but added to the main library.
-# We also add conditional objects directly to the main library.
-libnonbonded_la_LIBADD = \
- nb_kernel_c/libnb_kernel_c.la \
- $(IA32_SSE_OBJ) $(IA32_SSE2_OBJ) $(IA32_3DNOW_OBJ) \
- $(X86_64_SSE_OBJ) $(X86_64_SSE2_OBJ) $(PPC_ALTIVEC_OBJ) \
- $(IA64_SINGLE_OBJ) $(IA64_DOUBLE_OBJ) $(BLUEGENE_OBJ) \
- $(POWER6_OBJ) $(F77_DOUBLE_OBJ) $(F77_SINGLE_OBJ)
-
-
-libnonbonded_la_SOURCES = \
- nb_kerneltype.h nonbonded.c \
- nb_free_energy.c nb_free_energy.h \
- nb_generic.c nb_generic.h \
- nb_generic_cg.c nb_generic_cg.h
-
-
-
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-noinst_PROGRAMS = mknb
-
-
-mknb_SOURCES = \
- mknb.c \
- mknb_metacode.c mknb_metacode.h \
- mknb_common.c mknb_common.h \
- mknb_declarations.c mknb_declarations.h \
- mknb_outerloop.c mknb_outerloop.h \
- mknb_innerloop.c mknb_innerloop.h \
- mknb_interactions.c mknb_interactions.h
-
-
--- /dev/null
+/*
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * VERSION 3.2.0
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2004, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ *
+ * And Hey:
+ * GROningen Mixture of Alchemy and Childrens' Stories
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <math.h>
+
+#include "types/simple.h"
+#include "vec.h"
+#include "typedefs.h"
+#include "nb_generic_adress.h"
+
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+void
+gmx_nb_generic_adress_kernel(t_nblist * nlist,
+ t_forcerec * fr,
+ t_mdatoms * mdatoms,
+ real * x,
+ real * f,
+ real * fshift,
+ real * Vc,
+ real * Vvdw,
+ real tabscale,
+ real * VFtab,
+ int * outeriter,
+ int * inneriter,
+ gmx_bool bCG)
+{
+ int nri,ntype,table_nelements,icoul,ivdw;
+ real facel,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid,nnn,n0;
+ real shX,shY,shZ;
+ real fscal,tx,ty,tz;
+ real rinvsq;
+ real iq;
+ real qq,vcoul,krsq,vctot;
+ int nti,nvdwparam;
+ int tj;
+ real rt,r,eps,eps2,Y,F,Geps,Heps2,VV,FF,Fp,fijD,fijR;
+ real rinvsix;
+ real Vvdwtot;
+ real Vvdw_rep,Vvdw_disp;
+ real ix,iy,iz,fix,fiy,fiz;
+ real jx,jy,jz;
+ real dx,dy,dz,rsq,rinv;
+ real c6,c12,cexp1,cexp2,br;
+ real * charge;
+ real * shiftvec;
+ real * vdwparam;
+ int * shift;
+ int * type;
+
+ real * wf;
+ real weight_cg1;
+ real weight_cg2;
+ real weight_product;
+ real hybscal; /* the multiplicator to the force for hybrid interactions*/
+ gmx_bool bHybrid; /*Are we in the hybrid zone ?*/
+ real force_cap;
+
+ wf = mdatoms->wf;
+
+ force_cap = fr->adress_ex_forcecap;
+
+ icoul = nlist->icoul;
+ ivdw = nlist->ivdw;
+
+ /* avoid compiler warnings for cases that cannot happen */
+ nnn = 0;
+ vcoul = 0.0;
+ eps = 0.0;
+ eps2 = 0.0;
+
+ /* 3 VdW parameters for buckingham, otherwise 2 */
+ nvdwparam = (nlist->ivdw==2) ? 3 : 2;
+ table_nelements = (icoul==3) ? 4 : 0;
+ table_nelements += (ivdw==3) ? 8 : 0;
+
+ charge = mdatoms->chargeA;
+ type = mdatoms->typeA;
+ facel = fr->epsfac;
+ shiftvec = fr->shift_vec[0];
+ vdwparam = fr->nbfp;
+ ntype = fr->ntype;
+
+
+
+
+ for(n=0; (n<nlist->nri); n++)
+ {
+ is3 = 3*nlist->shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = nlist->jindex[n];
+ nj1 = nlist->jindex[n+1];
+ ii = nlist->iinr[n];
+ ii3 = 3*ii;
+ ix = shX + x[ii3+0];
+ iy = shY + x[ii3+1];
+ iz = shZ + x[ii3+2];
+ iq = facel*charge[ii];
+ nti = nvdwparam*ntype*type[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix = 0;
+ fiy = 0;
+ fiz = 0;
+
+ weight_cg1 = wf[ii];
+
+ /* TODO: why does this line her not speed up things ?
+ * if ((!bCG) && weight_cg1 < ALMOST_ZERO) continue;
+ */
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = nlist->jjnr[k];
+ weight_cg2 = wf[jnr];
+
+ weight_product = weight_cg1*weight_cg2;
+
+ if (weight_product < ALMOST_ZERO)
+ {
+ /* if it's a explicit loop, skip this atom */
+ if (!bCG)
+ {
+ continue;
+ }
+ else /* if it's a coarse grained loop, include this atom */
+ {
+ bHybrid = FALSE;
+ hybscal = 1.0;
+ }
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+
+ /* if it's a explicit loop, include this atom */
+ if(!bCG)
+ {
+ bHybrid = FALSE;
+ hybscal = 1.0;
+ }
+ else /* if it's a coarse grained loop, skip this atom */
+ {
+ continue;
+ }
+ }
+ /* both have double identity, get hybrid scaling factor */
+ else
+ {
+ bHybrid = TRUE;
+ hybscal = weight_product;
+
+ if(bCG)
+ {
+ hybscal = 1.0 - hybscal;
+ }
+ }
+
+
+ j3 = 3*jnr;
+ jx = x[j3+0];
+ jy = x[j3+1];
+ jz = x[j3+2];
+ dx = ix - jx;
+ dy = iy - jy;
+ dz = iz - jz;
+ rsq = dx*dx+dy*dy+dz*dz;
+ rinv = gmx_invsqrt(rsq);
+ rinvsq = rinv*rinv;
+
+
+ fscal = 0;
+
+ if(icoul==3 || ivdw==3)
+ {
+ r = rsq*rinv;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = table_nelements*n0;
+ }
+
+ /* Coulomb interaction. icoul==0 means no interaction */
+ if(icoul>0)
+ {
+ qq = iq*charge[jnr];
+
+ switch(icoul)
+ {
+ case 1:
+ /* Vanilla cutoff coulomb */
+ vcoul = qq*rinv;
+ fscal = vcoul*rinvsq;
+ break;
+
+ case 2:
+ /* Reaction-field */
+ krsq = fr->k_rf*rsq;
+ vcoul = qq*(rinv+krsq-fr->c_rf);
+ fscal = qq*(rinv-2.0*krsq)*rinvsq;
+ break;
+
+ case 3:
+ /* Tabulated coulomb */
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ nnn += 4;
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fscal = -qq*FF*tabscale*rinv;
+ break;
+
+ case 4:
+ /* GB */
+ gmx_fatal(FARGS,"Death & horror! GB generic interaction not implemented.\n");
+ break;
+
+ default:
+ gmx_fatal(FARGS,"Death & horror! No generic coulomb interaction for icoul=%d.\n",icoul);
+ break;
+ }
+ vctot = vctot+vcoul;
+ } /* End of coulomb interactions */
+
+
+ /* VdW interaction. ivdw==0 means no interaction */
+ if(ivdw>0)
+ {
+ tj = nti+nvdwparam*type[jnr];
+
+ switch(ivdw)
+ {
+ case 1:
+ /* Vanilla Lennard-Jones cutoff */
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw_disp = c6*rinvsix;
+ Vvdw_rep = c12*rinvsix*rinvsix;
+ fscal += (12.0*Vvdw_rep-6.0*Vvdw_disp)*rinvsq;
+ Vvdwtot = Vvdwtot+Vvdw_rep-Vvdw_disp;
+ break;
+
+ case 2:
+ /* Buckingham */
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw_disp = c6*rinvsix;
+ br = cexp2*rsq*rinv;
+ Vvdw_rep = cexp1*exp(-br);
+ fscal += (br*Vvdw_rep-6.0*Vvdw_disp)*rinvsq;
+ Vvdwtot = Vvdwtot+Vvdw_rep-Vvdw_disp;
+ break;
+
+ case 3:
+ /* Tabulated VdW */
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw_disp = c6*VV;
+ fijD = c6*FF;
+ nnn += 4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw_rep = c12*VV;
+ fijR = c12*FF;
+ fscal += -(fijD+fijR)*tabscale*rinv;
+ Vvdwtot = Vvdwtot + Vvdw_disp + Vvdw_rep;
+ if(!bCG && force_cap>0 && (fabs(fscal)> force_cap))
+ {
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ break;
+
+ default:
+ gmx_fatal(FARGS,"Death & horror! No generic VdW interaction for ivdw=%d.\n",ivdw);
+ break;
+ }
+ } /* end VdW interactions */
+
+ /* force weight is one anyway */
+ if (bHybrid)
+ {
+ fscal *= hybscal;
+ }
+
+ tx = fscal*dx;
+ ty = fscal*dy;
+ tz = fscal*dz;
+ fix = fix + tx;
+ fiy = fiy + ty;
+ fiz = fiz + tz;
+ f[j3+0] = f[j3+0] - tx;
+ f[j3+1] = f[j3+1] - ty;
+ f[j3+2] = f[j3+2] - tz;
+ }
+
+ f[ii3+0] = f[ii3+0] + fix;
+ f[ii3+1] = f[ii3+1] + fiy;
+ f[ii3+2] = f[ii3+2] + fiz;
+ fshift[is3] = fshift[is3]+fix;
+ fshift[is3+1] = fshift[is3+1]+fiy;
+ fshift[is3+2] = fshift[is3+2]+fiz;
+ ggid = nlist->gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ }
+
+ *outeriter = nlist->nri;
+ *inneriter = nlist->jindex[n];
+}
+
-/*
+/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
+ *
*
* This source code is part of
*
*
* GROningen MAchine for Chemical Simulations
*
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
+ * VERSION 4.0.5
+ * Written by Christoph Junghans, Brad Lambeth, and possibly others.
+ * Copyright (c) 2009 Christoph Junghans, Brad Lambeth.
+ * All rights reserved.
+
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* For more info, check our website at http://www.gromacs.org
*
* And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
+ * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
*/
-#ifndef _pinput_h
-#define _pinput_h
+#ifndef _nb_generic_adress_h_
+#define _nb_generic_adress_h_
+#include "types/simple.h"
#include "typedefs.h"
-#include "string2.h"
-
-enum { ptMC, ptREC, ptPTRJ, ptNR };
-typedef struct {
- real step;
- real tol;
- real v0;
- char base[STRLEN];
- char recomb[STRLEN];
- char gamma[STRLEN];
- int funct;
- int nsteps;
- int nframes;
- int nskip;
- int nSel;
- int nev;
-} t_pinp;
-
-extern void read_inp(char *fnin,char *fnout,t_pinp *p);
+void
+gmx_nb_generic_adress_kernel(t_nblist * nlist,
+ t_forcerec * fr,
+ t_mdatoms * mdatoms,
+ real * x,
+ real * f,
+ real * fshift,
+ real * Vc,
+ real * Vvdw,
+ real tabscale,
+ real * VFtab,
+ int * outeriter,
+ int * inneriter,
+ gmx_bool bCG);
#endif
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL010_ADRESS_H_
+#define _NBKERNEL010_ADRESS_H_
+
+/*! \file nb_kernel010.h
+ * \brief Nonbonded kernel adress 010 (LJ)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 010 with forces.
+ *
+ * <b>Coulomb interaction:</b> No <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel010_adress_ex
+ (int * nri, int * iinr,
+ int * jindex, int * jjnr,
+ int * shift, real * shiftvec,
+ real * fshift, int * gid,
+ real * pos, real * faction,
+ real * charge, real * facel,
+ real * krf, real * crf,
+ real * Vc, int * type,
+ int * ntype, real * vdwparam,
+ real * Vvdw, real * tabscale,
+ real * VFtab, real * invsqrta,
+ real * dvda, real * gbtabscale,
+ real * GBtab, int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 010 without forces.
+ *
+ * <b>Coulomb interaction:</b> No <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel010_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL010_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel010_adress_cg
+ * Coulomb interaction: Not calculated
+ * VdW interaction: Lennard-Jones
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel010_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinvsq = 1.0/rsq11;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel010_adress_ex
+ * Coulomb interaction: Not calculated
+ * VdW interaction: Lennard-Jones
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel010_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinvsq = 1.0/rsq11;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL020_ADRESS_H_
+#define _NBKERNEL020_ADRESS_H_
+
+/*! \file nb_kernel020.h
+ * \brief Nonbonded kernel adress 020 (Bham)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 020 with forces.
+ *
+ * <b>Coulomb interaction:</b> No <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel020_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 020 without forces.
+ *
+ * <b>Coulomb interaction:</b> No <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel020_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL020_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel020_adress_cg
+ * Coulomb interaction: Not calculated
+ * VdW interaction: Buckingham
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel020_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ nti = 3*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel020_adress_ex
+ * Coulomb interaction: Not calculated
+ * VdW interaction: Buckingham
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel020_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ nti = 3*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL030_ADRESS_H_
+#define _NBKERNEL030_ADRESS_H_
+
+/*! \file nb_kernel030.h
+ * \brief Nonbonded kernel adress 030 (Tab VdW)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 030 with forces.
+ *
+ * <b>Coulomb interaction:</b> No <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel030_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 030 without forces.
+ *
+ * <b>Coulomb interaction:</b> No <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel030_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL030_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel030_adress_cg
+ * Coulomb interaction: Not calculated
+ * VdW interaction: Tabulated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel030_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel030_adress_ex
+ * Coulomb interaction: Not calculated
+ * VdW interaction: Tabulated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel030_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL100_ADRESS_H_
+#define _NBKERNEL100_ADRESS_H_
+
+/*! \file nb_kernel100.h
+ * \brief Nonbonded kernel adress 100 (Coul)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 100 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel100_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 100 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel100_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL100_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel100_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Not calculated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel100_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel100_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Not calculated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel100_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL101_ADRESS_H_
+#define _NBKERNEL101_ADRESS_H_
+
+/*! \file nb_kernel101.h
+ * \brief Nonbonded kernel adress 101 (Coul, SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 101 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel101_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 101 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel101_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL101_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel101_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Not calculated
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel101_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel101_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Not calculated
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel101_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL102_ADRESS_H_
+#define _NBKERNEL102_ADRESS_H_
+
+/*! \file nb_kernel102.h
+ * \brief Nonbonded kernel adress 102 (Coul, SPC-SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 102 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel102_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 102 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel102_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL102_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel102_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Not calculated
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel102_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ vcoul = qq*rinv12;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ vcoul = qq*rinv13;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel102_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Not calculated
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel102_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ vcoul = qq*rinv12;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ vcoul = qq*rinv13;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL103_ADRESS_H_
+#define _NBKERNEL103_ADRESS_H_
+
+/*! \file nb_kernel103.h
+ * \brief Nonbonded kernel adress 103 (Coul, TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 103 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel103_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 103 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel103_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL103_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel103_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Not calculated
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel103_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ vcoul = qq*rinv41;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel103_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Not calculated
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel103_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ vcoul = qq*rinv41;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL104_ADRESS_H_
+#define _NBKERNEL104_ADRESS_H_
+
+/*! \file nb_kernel104.h
+ * \brief Nonbonded kernel adress 104 (Coul, TIP4p-TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 104 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel104_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 104 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel104_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL104_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel104_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Not calculated
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel104_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ vcoul = qq*rinv24;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ vcoul = qq*rinv34;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ vcoul = qq*rinv42;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ vcoul = qq*rinv43;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ vcoul = qq*rinv44;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel104_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Not calculated
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel104_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ vcoul = qq*rinv24;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ vcoul = qq*rinv34;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ vcoul = qq*rinv42;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ vcoul = qq*rinv43;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ vcoul = qq*rinv44;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL110_ADRESS_H_
+#define _NBKERNEL110_ADRESS_H_
+
+/*! \file nb_kernel110.h
+ * \brief Nonbonded kernel adress 110 (Coul + LJ)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 110 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel110_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 110 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel110_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL110_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel110_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Lennard-Jones
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel110_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (vcoul+12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel110_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Lennard-Jones
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel110_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (vcoul+12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL111_ADRESS_H_
+#define _NBKERNEL111_ADRESS_H_
+
+/*! \file nb_kernel111.h
+ * \brief Nonbonded kernel adress 111 (Coul + LJ, SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 111 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel111_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 111 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel111_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL111_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel111_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Lennard-Jones
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel111_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (vcoul+12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel111_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Lennard-Jones
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel111_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (vcoul+12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL112_ADRESS_H_
+#define _NBKERNEL112_ADRESS_H_
+
+/*! \file nb_kernel112.h
+ * \brief Nonbonded kernel adress 112 (Coul + LJ, SPC-SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 112 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel112_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 112 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel112_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL112_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel112_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Lennard-Jones
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel112_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (vcoul+12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ vcoul = qq*rinv12;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ vcoul = qq*rinv13;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel112_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Lennard-Jones
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel112_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (vcoul+12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ vcoul = qq*rinv12;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ vcoul = qq*rinv13;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL113_ADRESS_H_
+#define _NBKERNEL113_ADRESS_H_
+
+/*! \file nb_kernel113.h
+ * \brief Nonbonded kernel adress 113 (Coul + LJ, TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 113 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel113_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 113 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel113_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL113_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel113_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Lennard-Jones
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel113_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinvsq = 1.0/rsq11;
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ vcoul = qq*rinv41;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel113_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Lennard-Jones
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel113_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinvsq = 1.0/rsq11;
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ vcoul = qq*rinv41;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL114_ADRESS_H_
+#define _NBKERNEL114_ADRESS_H_
+
+/*! \file nb_kernel114.h
+ * \brief Nonbonded kernel adress 114 (Coul + LJ, TIP4p-TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 114 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel114_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 114 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel114_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL114_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel114_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Lennard-Jones
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel114_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinvsq = 1.0/rsq11;
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ vcoul = qq*rinv24;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ vcoul = qq*rinv34;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ vcoul = qq*rinv42;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ vcoul = qq*rinv43;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ vcoul = qq*rinv44;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel114_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Lennard-Jones
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel114_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinvsq = 1.0/rsq11;
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ vcoul = qq*rinv24;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ vcoul = qq*rinv34;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ vcoul = qq*rinv42;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ vcoul = qq*rinv43;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ vcoul = qq*rinv44;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL120_ADRESS_H_
+#define _NBKERNEL120_ADRESS_H_
+
+/*! \file nb_kernel120.h
+ * \brief Nonbonded kernel adress 120 (Coul + Bham)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 120 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel120_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 120 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel120_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL120_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel120_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Buckingham
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel120_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 3*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (vcoul+br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel120_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Buckingham
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel120_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 3*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (vcoul+br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL121_ADRESS_H_
+#define _NBKERNEL121_ADRESS_H_
+
+/*! \file nb_kernel121.h
+ * \brief Nonbonded kernel adress 121 (Coul + Bham, SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 121 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel121_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 121 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel121_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL121_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel121_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Buckingham
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel121_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 3*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (vcoul+br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel121_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Buckingham
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel121_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 3*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (vcoul+br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL122_ADRESS_H_
+#define _NBKERNEL122_ADRESS_H_
+
+/*! \file nb_kernel122.h
+ * \brief Nonbonded kernel adress 122 (Coul + Bham, SPC-SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 122 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel122_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 122 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel122_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL122_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel122_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Buckingham
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel122_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 3*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (vcoul+br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ vcoul = qq*rinv12;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ vcoul = qq*rinv13;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel122_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Buckingham
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel122_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 3*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (vcoul+br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ vcoul = qq*rinv12;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ vcoul = qq*rinv13;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL123_ADRESS_H_
+#define _NBKERNEL123_ADRESS_H_
+
+/*! \file nb_kernel123.h
+ * \brief Nonbonded kernel adress 123 (Coul + Bham, TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 123 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel123_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 123 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel123_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL123_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel123_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Buckingham
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel123_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 3*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ vcoul = qq*rinv41;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel123_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Buckingham
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel123_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 3*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ vcoul = qq*rinv41;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL124_ADRESS_H_
+#define _NBKERNEL124_ADRESS_H_
+
+/*! \file nb_kernel124.h
+ * \brief Nonbonded kernel adress 124 (Coul + Bham, TIP4p-TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 124 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel124_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 124 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel124_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL124_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel124_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Buckingham
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel124_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 3*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ rinvsq = rinv11*rinv11;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ vcoul = qq*rinv24;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ vcoul = qq*rinv34;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ vcoul = qq*rinv42;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ vcoul = qq*rinv43;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ vcoul = qq*rinv44;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel124_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Buckingham
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel124_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 3*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ rinvsq = rinv11*rinv11;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ vcoul = qq*rinv24;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ vcoul = qq*rinv34;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ vcoul = qq*rinv42;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ vcoul = qq*rinv43;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ vcoul = qq*rinv44;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL130_ADRESS_H_
+#define _NBKERNEL130_ADRESS_H_
+
+/*! \file nb_kernel130.h
+ * \brief Nonbonded kernel adress 130 (Coul + Tab VdW)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 130 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel130_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 130 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel130_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL130_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel130_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Tabulated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel130_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = (vcoul)*rinvsq-((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel130_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Tabulated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel130_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = (vcoul)*rinvsq-((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL131_ADRESS_H_
+#define _NBKERNEL131_ADRESS_H_
+
+/*! \file nb_kernel131.h
+ * \brief Nonbonded kernel adress 131 (Coul + Tab VdW, SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 131 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel131_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 131 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel131_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL131_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel131_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Tabulated
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel131_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = (vcoul)*rinvsq-((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel131_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Tabulated
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel131_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = (vcoul)*rinvsq-((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL132_ADRESS_H_
+#define _NBKERNEL132_ADRESS_H_
+
+/*! \file nb_kernel132.h
+ * \brief Nonbonded kernel adress 132 (Coul + Tab VdW, SPC-SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 132 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel132_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 132 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel132_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL132_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel132_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Tabulated
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel132_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = (vcoul)*rinvsq-((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ vcoul = qq*rinv12;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ vcoul = qq*rinv13;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel132_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Tabulated
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel132_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ vcoul = qq*rinv11;
+ vctot = vctot+vcoul;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = (vcoul)*rinvsq-((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ vcoul = qq*rinv12;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ vcoul = qq*rinv13;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL133_ADRESS_H_
+#define _NBKERNEL133_ADRESS_H_
+
+/*! \file nb_kernel133.h
+ * \brief Nonbonded kernel adress 133 (Coul + Tab VdW, TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 133 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel133_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 133 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel133_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL133_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel133_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Tabulated
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel133_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ vcoul = qq*rinv41;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel133_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Tabulated
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel133_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ vcoul = qq*rinv21;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ vcoul = qq*rinv31;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ vcoul = qq*rinv41;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL134_ADRESS_H_
+#define _NBKERNEL134_ADRESS_H_
+
+/*! \file nb_kernel134.h
+ * \brief Nonbonded kernel adress 134 (Coul + Tab VdW, TIP4p-TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 134 with forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel134_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 134 without forces.
+ *
+ * <b>Coulomb interaction:</b> Standard 1/r <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel134_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL134_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel134_adress_cg
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Tabulated
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel134_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ vcoul = qq*rinv24;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ vcoul = qq*rinv34;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ vcoul = qq*rinv42;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ vcoul = qq*rinv43;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ vcoul = qq*rinv44;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel134_adress_ex
+ * Coulomb interaction: Normal Coulomb
+ * VdW interaction: Tabulated
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel134_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ vcoul = qq*rinv22;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ vcoul = qq*rinv23;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ vcoul = qq*rinv24;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ vcoul = qq*rinv32;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ vcoul = qq*rinv33;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ vcoul = qq*rinv34;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ vcoul = qq*rinv42;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ vcoul = qq*rinv43;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ vcoul = qq*rinv44;
+ vctot = vctot+vcoul;
+ fscal = (vcoul)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL200_ADRESS_H_
+#define _NBKERNEL200_ADRESS_H_
+
+/*! \file nb_kernel200.h
+ * \brief Nonbonded kernel adress 200 (RF Coul)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 200 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel200_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 200 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel200_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL200_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel200_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Not calculated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel200_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv11-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel200_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Not calculated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel200_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv11-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL201_ADRESS_H_
+#define _NBKERNEL201_ADRESS_H_
+
+/*! \file nb_kernel201.h
+ * \brief Nonbonded kernel adress 201 (RF Coul, SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 201 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel201_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 201 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel201_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL201_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel201_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Not calculated
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel201_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv11-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel201_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Not calculated
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel201_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv11-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL202_ADRESS_H_
+#define _NBKERNEL202_ADRESS_H_
+
+/*! \file nb_kernel202.h
+ * \brief Nonbonded kernel adress 202 (RF Coul, SPC-SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 202 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel202_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 202 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel202_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL202_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel202_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Not calculated
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel202_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv11-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ krsq = krf*rsq12;
+ vcoul = qq*(rinv12+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv12-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ krsq = krf*rsq13;
+ vcoul = qq*(rinv13+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv13-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel202_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Not calculated
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel202_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv11-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ krsq = krf*rsq12;
+ vcoul = qq*(rinv12+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv12-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ krsq = krf*rsq13;
+ vcoul = qq*(rinv13+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv13-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL203_ADRESS_H_
+#define _NBKERNEL203_ADRESS_H_
+
+/*! \file nb_kernel203.h
+ * \brief Nonbonded kernel adress 203 (RF Coul, TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 203 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel203_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 203 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel203_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL203_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel203_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Not calculated
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel203_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ float krsq;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ krsq = krf*rsq41;
+ vcoul = qq*(rinv41+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv41-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel203_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Not calculated
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel203_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ float krsq;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ krsq = krf*rsq41;
+ vcoul = qq*(rinv41+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv41-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL204_ADRESS_H_
+#define _NBKERNEL204_ADRESS_H_
+
+/*! \file nb_kernel204.h
+ * \brief Nonbonded kernel adress 204 (RF Coul, TIP4p-TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 204 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel204_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 204 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel204_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL204_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel204_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Not calculated
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel204_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ float krsq;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ krsq = krf*rsq24;
+ vcoul = qq*(rinv24+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv24-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ krsq = krf*rsq34;
+ vcoul = qq*(rinv34+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv34-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ krsq = krf*rsq42;
+ vcoul = qq*(rinv42+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv42-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ krsq = krf*rsq43;
+ vcoul = qq*(rinv43+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv43-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ krsq = krf*rsq44;
+ vcoul = qq*(rinv44+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv44-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel204_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Not calculated
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel204_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ float krsq;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ krsq = krf*rsq24;
+ vcoul = qq*(rinv24+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv24-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ krsq = krf*rsq34;
+ vcoul = qq*(rinv34+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv34-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ krsq = krf*rsq42;
+ vcoul = qq*(rinv42+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv42-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ krsq = krf*rsq43;
+ vcoul = qq*(rinv43+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv43-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ krsq = krf*rsq44;
+ vcoul = qq*(rinv44+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv44-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL210_ADRESS_H_
+#define _NBKERNEL210_ADRESS_H_
+
+/*! \file nb_kernel210.h
+ * \brief Nonbonded kernel adress 210 (RF Coul + LJ)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 210 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel210_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 210 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel210_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL210_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel210_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Lennard-Jones
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel210_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (qq*(rinv11-2.0*krsq)+12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel210_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Lennard-Jones
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel210_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (qq*(rinv11-2.0*krsq)+12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL211_ADRESS_H_
+#define _NBKERNEL211_ADRESS_H_
+
+/*! \file nb_kernel211.h
+ * \brief Nonbonded kernel adress 211 (RF Coul + LJ, SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 211 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel211_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 211 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel211_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL211_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel211_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Lennard-Jones
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel211_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (qq*(rinv11-2.0*krsq)+12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel211_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Lennard-Jones
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel211_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (qq*(rinv11-2.0*krsq)+12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL212_ADRESS_H_
+#define _NBKERNEL212_ADRESS_H_
+
+/*! \file nb_kernel212.h
+ * \brief Nonbonded kernel adress 212 (RF Coul + LJ, SPC-SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 212 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel212_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 212 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel212_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL212_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel212_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Lennard-Jones
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel212_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (qq*(rinv11-2.0*krsq)+12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ krsq = krf*rsq12;
+ vcoul = qq*(rinv12+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv12-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ krsq = krf*rsq13;
+ vcoul = qq*(rinv13+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv13-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel212_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Lennard-Jones
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel212_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (qq*(rinv11-2.0*krsq)+12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ krsq = krf*rsq12;
+ vcoul = qq*(rinv12+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv12-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ krsq = krf*rsq13;
+ vcoul = qq*(rinv13+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv13-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL213_ADRESS_H_
+#define _NBKERNEL213_ADRESS_H_
+
+/*! \file nb_kernel213.h
+ * \brief Nonbonded kernel adress 213 (RF Coul + LJ, TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 213 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel213_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 213 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel213_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL213_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel213_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Lennard-Jones
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel213_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinvsq = 1.0/rsq11;
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ krsq = krf*rsq41;
+ vcoul = qq*(rinv41+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv41-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel213_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Lennard-Jones
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel213_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinvsq = 1.0/rsq11;
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ krsq = krf*rsq41;
+ vcoul = qq*(rinv41+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv41-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL214_ADRESS_H_
+#define _NBKERNEL214_ADRESS_H_
+
+/*! \file nb_kernel214.h
+ * \brief Nonbonded kernel adress 214 (RF Coul + LJ, TIP4p-TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 214 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel214_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 214 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel214_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL214_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel214_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Lennard-Jones
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel214_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinvsq = 1.0/rsq11;
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ krsq = krf*rsq24;
+ vcoul = qq*(rinv24+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv24-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ krsq = krf*rsq34;
+ vcoul = qq*(rinv34+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv34-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ krsq = krf*rsq42;
+ vcoul = qq*(rinv42+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv42-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ krsq = krf*rsq43;
+ vcoul = qq*(rinv43+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv43-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ krsq = krf*rsq44;
+ vcoul = qq*(rinv44+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv44-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel214_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Lennard-Jones
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel214_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinvsq = 1.0/rsq11;
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ krsq = krf*rsq24;
+ vcoul = qq*(rinv24+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv24-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ krsq = krf*rsq34;
+ vcoul = qq*(rinv34+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv34-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ krsq = krf*rsq42;
+ vcoul = qq*(rinv42+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv42-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ krsq = krf*rsq43;
+ vcoul = qq*(rinv43+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv43-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ krsq = krf*rsq44;
+ vcoul = qq*(rinv44+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv44-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL220_ADRESS_H_
+#define _NBKERNEL220_ADRESS_H_
+
+/*! \file nb_kernel220.h
+ * \brief Nonbonded kernel adress 220 (RF Coul + Bham)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 220 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel220_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 220 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel220_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL220_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel220_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Buckingham
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel220_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float krsq;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 3*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (qq*(rinv11-2.0*krsq)+br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel220_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Buckingham
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel220_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float krsq;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 3*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (qq*(rinv11-2.0*krsq)+br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL221_ADRESS_H_
+#define _NBKERNEL221_ADRESS_H_
+
+/*! \file nb_kernel221.h
+ * \brief Nonbonded kernel adress 221 (RF Coul + Bham, SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 221 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel221_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 221 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel221_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL221_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel221_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Buckingham
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel221_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float krsq;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 3*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (qq*(rinv11-2.0*krsq)+br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel221_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Buckingham
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel221_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float krsq;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 3*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (qq*(rinv11-2.0*krsq)+br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL222_ADRESS_H_
+#define _NBKERNEL222_ADRESS_H_
+
+/*! \file nb_kernel222.h
+ * \brief Nonbonded kernel adress 222 (RF Coul + Bham, SPC-SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 222 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel222_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 222 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel222_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL222_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel222_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Buckingham
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel222_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float krsq;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 3*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (qq*(rinv11-2.0*krsq)+br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ krsq = krf*rsq12;
+ vcoul = qq*(rinv12+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv12-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ krsq = krf*rsq13;
+ vcoul = qq*(rinv13+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv13-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel222_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Buckingham
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel222_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float krsq;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 3*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (qq*(rinv11-2.0*krsq)+br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ krsq = krf*rsq12;
+ vcoul = qq*(rinv12+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv12-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ krsq = krf*rsq13;
+ vcoul = qq*(rinv13+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv13-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL223_ADRESS_H_
+#define _NBKERNEL223_ADRESS_H_
+
+/*! \file nb_kernel223.h
+ * \brief Nonbonded kernel adress 223 (RF Coul + Bham, TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 223 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel223_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 223 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel223_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL223_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel223_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Buckingham
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel223_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float krsq;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 3*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ krsq = krf*rsq41;
+ vcoul = qq*(rinv41+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv41-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel223_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Buckingham
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel223_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float krsq;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 3*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ krsq = krf*rsq41;
+ vcoul = qq*(rinv41+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv41-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL224_ADRESS_H_
+#define _NBKERNEL224_ADRESS_H_
+
+/*! \file nb_kernel224.h
+ * \brief Nonbonded kernel adress 224 (RF Coul + Bham, TIP4p-TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 224 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel224_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 224 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel224_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL224_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel224_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Buckingham
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel224_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float krsq;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 3*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ rinvsq = rinv11*rinv11;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ krsq = krf*rsq24;
+ vcoul = qq*(rinv24+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv24-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ krsq = krf*rsq34;
+ vcoul = qq*(rinv34+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv34-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ krsq = krf*rsq42;
+ vcoul = qq*(rinv42+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv42-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ krsq = krf*rsq43;
+ vcoul = qq*(rinv43+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv43-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ krsq = krf*rsq44;
+ vcoul = qq*(rinv44+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv44-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel224_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Buckingham
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel224_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float krsq;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 3*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ rinvsq = rinv11*rinv11;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ krsq = krf*rsq24;
+ vcoul = qq*(rinv24+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv24-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ krsq = krf*rsq34;
+ vcoul = qq*(rinv34+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv34-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ krsq = krf*rsq42;
+ vcoul = qq*(rinv42+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv42-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ krsq = krf*rsq43;
+ vcoul = qq*(rinv43+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv43-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ krsq = krf*rsq44;
+ vcoul = qq*(rinv44+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv44-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL230_ADRESS_H_
+#define _NBKERNEL230_ADRESS_H_
+
+/*! \file nb_kernel230.h
+ * \brief Nonbonded kernel adress 230 (RF Coul + Tab VdW)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 230 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel230_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 230 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel230_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL230_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel230_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Tabulated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel230_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = (qq*(rinv11-2.0*krsq))*rinvsq-((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel230_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Tabulated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel230_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = (qq*(rinv11-2.0*krsq))*rinvsq-((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL231_ADRESS_H_
+#define _NBKERNEL231_ADRESS_H_
+
+/*! \file nb_kernel231.h
+ * \brief Nonbonded kernel adress 231 (RF Coul + Tab VdW, SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 231 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel231_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 231 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel231_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL231_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel231_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Tabulated
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel231_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = (qq*(rinv11-2.0*krsq))*rinvsq-((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel231_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Tabulated
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel231_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = (qq*(rinv11-2.0*krsq))*rinvsq-((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL232_ADRESS_H_
+#define _NBKERNEL232_ADRESS_H_
+
+/*! \file nb_kernel232.h
+ * \brief Nonbonded kernel adress 232 (RF Coul + Tab VdW, SPC-SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 232 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel232_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 232 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel232_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL232_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel232_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Tabulated
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel232_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = (qq*(rinv11-2.0*krsq))*rinvsq-((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ krsq = krf*rsq12;
+ vcoul = qq*(rinv12+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv12-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ krsq = krf*rsq13;
+ vcoul = qq*(rinv13+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv13-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel232_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Tabulated
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel232_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ krsq = krf*rsq11;
+ vcoul = qq*(rinv11+krsq-crf);
+ vctot = vctot+vcoul;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = (qq*(rinv11-2.0*krsq))*rinvsq-((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ rinvsq = rinv12*rinv12;
+ krsq = krf*rsq12;
+ vcoul = qq*(rinv12+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv12-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ rinvsq = rinv13*rinv13;
+ krsq = krf*rsq13;
+ vcoul = qq*(rinv13+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv13-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL233_ADRESS_H_
+#define _NBKERNEL233_ADRESS_H_
+
+/*! \file nb_kernel233.h
+ * \brief Nonbonded kernel adress 233 (RF Coul + Tab VdW, TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 233 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel233_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 233 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel233_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL233_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel233_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Tabulated
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel233_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ krsq = krf*rsq41;
+ vcoul = qq*(rinv41+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv41-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel233_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Tabulated
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel233_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ rinvsq = rinv21*rinv21;
+ krsq = krf*rsq21;
+ vcoul = qq*(rinv21+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv21-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ rinvsq = rinv31*rinv31;
+ krsq = krf*rsq31;
+ vcoul = qq*(rinv31+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv31-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ rinvsq = rinv41*rinv41;
+ krsq = krf*rsq41;
+ vcoul = qq*(rinv41+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv41-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL234_ADRESS_H_
+#define _NBKERNEL234_ADRESS_H_
+
+/*! \file nb_kernel234.h
+ * \brief Nonbonded kernel adress 234 (RF Coul + Tab VdW, TIP4p-TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 234 with forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel234_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 234 without forces.
+ *
+ * <b>Coulomb interaction:</b> Reaction-Field <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel234_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL234_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel234_adress_cg
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Tabulated
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel234_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ krsq = krf*rsq24;
+ vcoul = qq*(rinv24+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv24-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ krsq = krf*rsq34;
+ vcoul = qq*(rinv34+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv34-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ krsq = krf*rsq42;
+ vcoul = qq*(rinv42+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv42-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ krsq = krf*rsq43;
+ vcoul = qq*(rinv43+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv43-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ krsq = krf*rsq44;
+ vcoul = qq*(rinv44+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv44-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel234_adress_ex
+ * Coulomb interaction: Reaction field
+ * VdW interaction: Tabulated
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel234_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijD,fijR;
+ float krsq;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ rinvsq = rinv22*rinv22;
+ krsq = krf*rsq22;
+ vcoul = qq*(rinv22+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv22-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ rinvsq = rinv23*rinv23;
+ krsq = krf*rsq23;
+ vcoul = qq*(rinv23+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv23-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ rinvsq = rinv24*rinv24;
+ krsq = krf*rsq24;
+ vcoul = qq*(rinv24+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv24-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ rinvsq = rinv32*rinv32;
+ krsq = krf*rsq32;
+ vcoul = qq*(rinv32+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv32-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ rinvsq = rinv33*rinv33;
+ krsq = krf*rsq33;
+ vcoul = qq*(rinv33+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv33-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ rinvsq = rinv34*rinv34;
+ krsq = krf*rsq34;
+ vcoul = qq*(rinv34+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv34-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ rinvsq = rinv42*rinv42;
+ krsq = krf*rsq42;
+ vcoul = qq*(rinv42+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv42-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ rinvsq = rinv43*rinv43;
+ krsq = krf*rsq43;
+ vcoul = qq*(rinv43+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv43-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ rinvsq = rinv44*rinv44;
+ krsq = krf*rsq44;
+ vcoul = qq*(rinv44+krsq-crf);
+ vctot = vctot+vcoul;
+ fscal = (qq*(rinv44-2.0*krsq))*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL300_ADRESS_H_
+#define _NBKERNEL300_ADRESS_H_
+
+/*! \file nb_kernel300.h
+ * \brief Nonbonded kernel adress 300 (Tab Coul)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 300 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel300_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 300 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel300_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL300_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel300_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Not calculated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel300_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float iq;
+ float qq,vcoul,vctot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel300_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Not calculated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel300_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float iq;
+ float qq,vcoul,vctot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL301_ADRESS_H_
+#define _NBKERNEL301_ADRESS_H_
+
+/*! \file nb_kernel301.h
+ * \brief Nonbonded kernel adress 301 (Tab Coul, SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 301 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel301_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 301 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel301_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL301_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel301_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Not calculated
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel301_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float jq;
+ float qq,vcoul,vctot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel301_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Not calculated
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel301_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float jq;
+ float qq,vcoul,vctot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL302_ADRESS_H_
+#define _NBKERNEL302_ADRESS_H_
+
+/*! \file nb_kernel302.h
+ * \brief Nonbonded kernel adress 302 (Tab Coul, SPC-SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 302 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel302_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 302 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel302_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL302_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel302_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Not calculated
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel302_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float qq,vcoul,vctot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ r = rsq12*rinv12;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv12;
+ fscal *= hybscal;
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ r = rsq13*rinv13;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv13;
+ fscal *= hybscal;
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel302_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Not calculated
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel302_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float qq,vcoul,vctot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ r = rsq12*rinv12;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv12;
+ fscal *= hybscal;
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ r = rsq13*rinv13;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv13;
+ fscal *= hybscal;
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL303_ADRESS_H_
+#define _NBKERNEL303_ADRESS_H_
+
+/*! \file nb_kernel303.h
+ * \brief Nonbonded kernel adress 303 (Tab Coul, TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 303 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel303_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 303 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel303_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL303_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel303_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Not calculated
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel303_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float jq;
+ float qq,vcoul,vctot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ r = rsq41*rinv41;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv41;
+ fscal *= hybscal;
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel303_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Not calculated
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel303_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float jq;
+ float qq,vcoul,vctot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ r = rsq41*rinv41;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv41;
+ fscal *= hybscal;
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL304_ADRESS_H_
+#define _NBKERNEL304_ADRESS_H_
+
+/*! \file nb_kernel304.h
+ * \brief Nonbonded kernel adress 304 (Tab Coul, TIP4p-TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 304 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel304_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 304 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel304_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL304_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel304_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Not calculated
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel304_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float qq,vcoul,vctot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ r = rsq24*rinv24;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv24;
+ fscal *= hybscal;
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ r = rsq34*rinv34;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv34;
+ fscal *= hybscal;
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ r = rsq42*rinv42;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv42;
+ fscal *= hybscal;
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ r = rsq43*rinv43;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv43;
+ fscal *= hybscal;
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ r = rsq44*rinv44;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv44;
+ fscal *= hybscal;
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel304_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Not calculated
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel304_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float qq,vcoul,vctot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ r = rsq24*rinv24;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv24;
+ fscal *= hybscal;
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ r = rsq34*rinv34;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv34;
+ fscal *= hybscal;
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ r = rsq42*rinv42;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv42;
+ fscal *= hybscal;
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ r = rsq43*rinv43;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv43;
+ fscal *= hybscal;
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ r = rsq44*rinv44;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv44;
+ fscal *= hybscal;
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL310_ADRESS_H_
+#define _NBKERNEL310_ADRESS_H_
+
+/*! \file nb_kernel310.h
+ * \brief Nonbonded kernel adress 310 (Tab Coul + LJ)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 310 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel310_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 310 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel310_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL310_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel310_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Lennard-Jones
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel310_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel310_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Lennard-Jones
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel310_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL311_ADRESS_H_
+#define _NBKERNEL311_ADRESS_H_
+
+/*! \file nb_kernel311.h
+ * \brief Nonbonded kernel adress 311 (Tab Coul + LJ, SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 311 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel311_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 311 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel311_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL311_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel311_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Lennard-Jones
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel311_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel311_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Lennard-Jones
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel311_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL312_ADRESS_H_
+#define _NBKERNEL312_ADRESS_H_
+
+/*! \file nb_kernel312.h
+ * \brief Nonbonded kernel adress 312 (Tab Coul + LJ, SPC-SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 312 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel312_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 312 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel312_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL312_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel312_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Lennard-Jones
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel312_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ r = rsq12*rinv12;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv12;
+ fscal *= hybscal;
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ r = rsq13*rinv13;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv13;
+ fscal *= hybscal;
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel312_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Lennard-Jones
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel312_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ r = rsq12*rinv12;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv12;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ r = rsq13*rinv13;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv13;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL313_ADRESS_H_
+#define _NBKERNEL313_ADRESS_H_
+
+/*! \file nb_kernel313.h
+ * \brief Nonbonded kernel adress 313 (Tab Coul + LJ, TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 313 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel313_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 313 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel313_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL313_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel313_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Lennard-Jones
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel313_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinvsq = 1.0/rsq11;
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ r = rsq41*rinv41;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv41;
+ fscal *= hybscal;
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel313_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Lennard-Jones
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel313_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinvsq = 1.0/rsq11;
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ r = rsq41*rinv41;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv41;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL314_ADRESS_H_
+#define _NBKERNEL314_ADRESS_H_
+
+/*! \file nb_kernel314.h
+ * \brief Nonbonded kernel adress 314 (Tab Coul + LJ, TIP4p-TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 314 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel314_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 314 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel314_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL314_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel314_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Lennard-Jones
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel314_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinvsq = 1.0/rsq11;
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ r = rsq24*rinv24;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv24;
+ fscal *= hybscal;
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ r = rsq34*rinv34;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv34;
+ fscal *= hybscal;
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ r = rsq42*rinv42;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv42;
+ fscal *= hybscal;
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ r = rsq43*rinv43;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv43;
+ fscal *= hybscal;
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ r = rsq44*rinv44;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv44;
+ fscal *= hybscal;
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel314_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Lennard-Jones
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel314_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinvsq = 1.0/rsq11;
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ r = rsq24*rinv24;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv24;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ r = rsq34*rinv34;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv34;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ r = rsq42*rinv42;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv42;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ r = rsq43*rinv43;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv43;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ r = rsq44*rinv44;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv44;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL320_ADRESS_H_
+#define _NBKERNEL320_ADRESS_H_
+
+/*! \file nb_kernel320.h
+ * \brief Nonbonded kernel adress 320 (Tab Coul + Bham)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 320 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel320_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 320 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel320_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL320_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel320_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Buckingham
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel320_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 3*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel320_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Buckingham
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel320_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 3*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL321_ADRESS_H_
+#define _NBKERNEL321_ADRESS_H_
+
+/*! \file nb_kernel321.h
+ * \brief Nonbonded kernel adress 321 (Tab Coul + Bham, SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 321 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel321_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 321 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel321_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL321_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel321_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Buckingham
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel321_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 3*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel321_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Buckingham
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel321_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 3*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL322_ADRESS_H_
+#define _NBKERNEL322_ADRESS_H_
+
+/*! \file nb_kernel322.h
+ * \brief Nonbonded kernel adress 322 (Tab Coul + Bham, SPC-SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 322 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel322_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 322 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel322_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL322_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel322_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Buckingham
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel322_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 3*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ r = rsq12*rinv12;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv12;
+ fscal *= hybscal;
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ r = rsq13*rinv13;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv13;
+ fscal *= hybscal;
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel322_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Buckingham
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel322_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 3*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ rinvsq = rinv11*rinv11;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq-((fijC)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ r = rsq12*rinv12;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv12;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ r = rsq13*rinv13;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv13;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL323_ADRESS_H_
+#define _NBKERNEL323_ADRESS_H_
+
+/*! \file nb_kernel323.h
+ * \brief Nonbonded kernel adress 323 (Tab Coul + Bham, TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 323 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel323_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 323 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel323_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL323_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel323_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Buckingham
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel323_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 3*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ r = rsq41*rinv41;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv41;
+ fscal *= hybscal;
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel323_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Buckingham
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel323_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 3*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ r = rsq41*rinv41;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv41;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL324_ADRESS_H_
+#define _NBKERNEL324_ADRESS_H_
+
+/*! \file nb_kernel324.h
+ * \brief Nonbonded kernel adress 324 (Tab Coul + Bham, TIP4p-TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 324 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel324_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 324 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel324_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL324_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel324_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Buckingham
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel324_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 3*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ rinvsq = rinv11*rinv11;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ r = rsq24*rinv24;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv24;
+ fscal *= hybscal;
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ r = rsq34*rinv34;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv34;
+ fscal *= hybscal;
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ r = rsq42*rinv42;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv42;
+ fscal *= hybscal;
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ r = rsq43*rinv43;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv43;
+ fscal *= hybscal;
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ r = rsq44*rinv44;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv44;
+ fscal *= hybscal;
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel324_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Buckingham
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel324_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float qq,vcoul,vctot;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 3*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ rinvsq = rinv11*rinv11;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ r = rsq24*rinv24;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv24;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ r = rsq34*rinv34;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv34;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ r = rsq42*rinv42;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv42;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ r = rsq43*rinv43;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv43;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ r = rsq44*rinv44;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv44;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL330_ADRESS_H_
+#define _NBKERNEL330_ADRESS_H_
+
+/*! \file nb_kernel330.h
+ * \brief Nonbonded kernel adress 330 (Tab Coul + Tab VdW)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 330 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel330_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 330 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel330_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL330_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel330_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Tabulated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel330_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijC+fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel330_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Tabulated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel330_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ qq = iq*charge[jnr];
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijC+fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL331_ADRESS_H_
+#define _NBKERNEL331_ADRESS_H_
+
+/*! \file nb_kernel331.h
+ * \brief Nonbonded kernel adress 331 (Tab Coul + Tab VdW, SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 331 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel331_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 331 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> SPC - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel331_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL331_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel331_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Tabulated
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel331_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijC+fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel331_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Tabulated
+ * water optimization: SPC/TIP3P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel331_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float qO,qH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = facel*charge[ii];
+ qH = facel*charge[ii+1];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ jq = charge[jnr+0];
+ qq = qO*jq;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijC+fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL332_ADRESS_H_
+#define _NBKERNEL332_ADRESS_H_
+
+/*! \file nb_kernel332.h
+ * \brief Nonbonded kernel adress 332 (Tab Coul + Tab VdW, SPC-SPC)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 332 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel332_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 332 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> SPC - SPC <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel332_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL332_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel332_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Tabulated
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel332_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float qq,vcoul,vctot;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijC+fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ r = rsq12*rinv12;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv12;
+ fscal *= hybscal;
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ r = rsq13*rinv13;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv13;
+ fscal *= hybscal;
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel332_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Tabulated
+ * water optimization: pairs of SPC/TIP3P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel332_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float qq,vcoul,vctot;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx12,dy12,dz12,rsq12,rinv12;
+ float dx13,dy13,dz13,rsq13,rinv13;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float qO,qH,qqOO,qqOH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qO = charge[ii];
+ qH = charge[ii+1];
+ qqOO = facel*qO*qO;
+ qqOH = facel*qO*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx12 = ix1 - jx2;
+ dy12 = iy1 - jy2;
+ dz12 = iz1 - jz2;
+ rsq12 = dx12*dx12+dy12*dy12+dz12*dz12;
+ dx13 = ix1 - jx3;
+ dy13 = iy1 - jy3;
+ dz13 = iz1 - jz3;
+ rsq13 = dx13*dx13+dy13*dy13+dz13*dz13;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv12 = 1.0/sqrt(rsq12);
+ rinv13 = 1.0/sqrt(rsq13);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ qq = qqOO;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijC+fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ qq = qqOH;
+ r = rsq12*rinv12;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv12;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx12;
+ ty = fscal*dy12;
+ tz = fscal*dz12;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqOH;
+ r = rsq13*rinv13;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv13;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx13;
+ ty = fscal*dy13;
+ tz = fscal*dz13;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqOH;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqOH;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL333_ADRESS_H_
+#define _NBKERNEL333_ADRESS_H_
+
+/*! \file nb_kernel333.h
+ * \brief Nonbonded kernel adress 333 (Tab Coul + Tab VdW, TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 333 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel333_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 333 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> TIP4p - other atoms <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel333_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL333_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel333_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Tabulated
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel333_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ r = rsq41*rinv41;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv41;
+ fscal *= hybscal;
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel333_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Tabulated
+ * water optimization: TIP4P - other atoms
+ * Calculate forces: yes
+ */
+void nb_kernel333_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float jq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1,fjx1,fjy1,fjz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx21,dy21,dz21,rsq21,rinv21;
+ float dx31,dy31,dz31,rsq31,rinv31;
+ float dx41,dy41,dz41,rsq41,rinv41;
+ float qH,qM;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = facel*charge[ii+1];
+ qM = facel*charge[ii+3];
+ nti = 2*ntype*type[ii];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx21 = ix2 - jx1;
+ dy21 = iy2 - jy1;
+ dz21 = iz2 - jz1;
+ rsq21 = dx21*dx21+dy21*dy21+dz21*dz21;
+ dx31 = ix3 - jx1;
+ dy31 = iy3 - jy1;
+ dz31 = iz3 - jz1;
+ rsq31 = dx31*dx31+dy31*dy31+dz31*dz31;
+ dx41 = ix4 - jx1;
+ dy41 = iy4 - jy1;
+ dz41 = iz4 - jz1;
+ rsq41 = dx41*dx41+dy41*dy41+dz41*dz41;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv21 = 1.0/sqrt(rsq21);
+ rinv31 = 1.0/sqrt(rsq31);
+ rinv41 = 1.0/sqrt(rsq41);
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ fjx1 = faction[j3+0] - tx;
+ fjy1 = faction[j3+1] - ty;
+ fjz1 = faction[j3+2] - tz;
+ jq = charge[jnr+0];
+ qq = qH*jq;
+ r = rsq21*rinv21;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv21;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx21;
+ ty = fscal*dy21;
+ tz = fscal*dz21;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ r = rsq31*rinv31;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv31;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx31;
+ ty = fscal*dy31;
+ tz = fscal*dz31;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx1 = fjx1 - tx;
+ fjy1 = fjy1 - ty;
+ fjz1 = fjz1 - tz;
+ qq = qM*jq;
+ r = rsq41*rinv41;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv41;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx41;
+ ty = fscal*dy41;
+ tz = fscal*dz41;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+0] = fjx1 - tx;
+ faction[j3+1] = fjy1 - ty;
+ faction[j3+2] = fjz1 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL334_ADRESS_H_
+#define _NBKERNEL334_ADRESS_H_
+
+/*! \file nb_kernel334.h
+ * \brief Nonbonded kernel adress 334 (Tab Coul + Tab VdW, TIP4p-TIP4p)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 334 with forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel334_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 334 without forces.
+ *
+ * <b>Coulomb interaction:</b> Tabulated <br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> TIP4p - TIP4p <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel334_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL334_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel334_adress_cg
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Tabulated
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel334_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float qq,vcoul,vctot;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ r = rsq24*rinv24;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv24;
+ fscal *= hybscal;
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ r = rsq34*rinv34;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv34;
+ fscal *= hybscal;
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ r = rsq42*rinv42;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv42;
+ fscal *= hybscal;
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ r = rsq43*rinv43;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv43;
+ fscal *= hybscal;
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ r = rsq44*rinv44;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv44;
+ fscal *= hybscal;
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel334_adress_ex
+ * Coulomb interaction: Tabulated
+ * VdW interaction: Tabulated
+ * water optimization: pairs of TIP4P interactions
+ * Calculate forces: yes
+ */
+void nb_kernel334_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float qq,vcoul,vctot;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float fijD,fijR;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float ix2,iy2,iz2,fix2,fiy2,fiz2;
+ float ix3,iy3,iz3,fix3,fiy3,fiz3;
+ float ix4,iy4,iz4,fix4,fiy4,fiz4;
+ float jx1,jy1,jz1;
+ float jx2,jy2,jz2,fjx2,fjy2,fjz2;
+ float jx3,jy3,jz3,fjx3,fjy3,fjz3;
+ float jx4,jy4,jz4,fjx4,fjy4,fjz4;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float dx22,dy22,dz22,rsq22,rinv22;
+ float dx23,dy23,dz23,rsq23,rinv23;
+ float dx24,dy24,dz24,rsq24,rinv24;
+ float dx32,dy32,dz32,rsq32,rinv32;
+ float dx33,dy33,dz33,rsq33,rinv33;
+ float dx34,dy34,dz34,rsq34,rinv34;
+ float dx42,dy42,dz42,rsq42,rinv42;
+ float dx43,dy43,dz43,rsq43,rinv43;
+ float dx44,dy44,dz44,rsq44,rinv44;
+ float qH,qM,qqMM,qqMH,qqHH;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ ii = iinr[0];
+ qH = charge[ii+1];
+ qM = charge[ii+3];
+ qqMM = facel*qM*qM;
+ qqMH = facel*qM*qH;
+ qqHH = facel*qH*qH;
+ tj = 2*(ntype+1)*type[ii];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ ix2 = shX + pos[ii3+3];
+ iy2 = shY + pos[ii3+4];
+ iz2 = shZ + pos[ii3+5];
+ ix3 = shX + pos[ii3+6];
+ iy3 = shY + pos[ii3+7];
+ iz3 = shZ + pos[ii3+8];
+ ix4 = shX + pos[ii3+9];
+ iy4 = shY + pos[ii3+10];
+ iz4 = shZ + pos[ii3+11];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+ fix2 = 0;
+ fiy2 = 0;
+ fiz2 = 0;
+ fix3 = 0;
+ fiy3 = 0;
+ fiz3 = 0;
+ fix4 = 0;
+ fiy4 = 0;
+ fiz4 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ jx2 = pos[j3+3];
+ jy2 = pos[j3+4];
+ jz2 = pos[j3+5];
+ jx3 = pos[j3+6];
+ jy3 = pos[j3+7];
+ jz3 = pos[j3+8];
+ jx4 = pos[j3+9];
+ jy4 = pos[j3+10];
+ jz4 = pos[j3+11];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ dx22 = ix2 - jx2;
+ dy22 = iy2 - jy2;
+ dz22 = iz2 - jz2;
+ rsq22 = dx22*dx22+dy22*dy22+dz22*dz22;
+ dx23 = ix2 - jx3;
+ dy23 = iy2 - jy3;
+ dz23 = iz2 - jz3;
+ rsq23 = dx23*dx23+dy23*dy23+dz23*dz23;
+ dx24 = ix2 - jx4;
+ dy24 = iy2 - jy4;
+ dz24 = iz2 - jz4;
+ rsq24 = dx24*dx24+dy24*dy24+dz24*dz24;
+ dx32 = ix3 - jx2;
+ dy32 = iy3 - jy2;
+ dz32 = iz3 - jz2;
+ rsq32 = dx32*dx32+dy32*dy32+dz32*dz32;
+ dx33 = ix3 - jx3;
+ dy33 = iy3 - jy3;
+ dz33 = iz3 - jz3;
+ rsq33 = dx33*dx33+dy33*dy33+dz33*dz33;
+ dx34 = ix3 - jx4;
+ dy34 = iy3 - jy4;
+ dz34 = iz3 - jz4;
+ rsq34 = dx34*dx34+dy34*dy34+dz34*dz34;
+ dx42 = ix4 - jx2;
+ dy42 = iy4 - jy2;
+ dz42 = iz4 - jz2;
+ rsq42 = dx42*dx42+dy42*dy42+dz42*dz42;
+ dx43 = ix4 - jx3;
+ dy43 = iy4 - jy3;
+ dz43 = iz4 - jz3;
+ rsq43 = dx43*dx43+dy43*dy43+dz43*dz43;
+ dx44 = ix4 - jx4;
+ dy44 = iy4 - jy4;
+ dz44 = iz4 - jz4;
+ rsq44 = dx44*dx44+dy44*dy44+dz44*dz44;
+ rinv11 = 1.0/sqrt(rsq11);
+ rinv22 = 1.0/sqrt(rsq22);
+ rinv23 = 1.0/sqrt(rsq23);
+ rinv24 = 1.0/sqrt(rsq24);
+ rinv32 = 1.0/sqrt(rsq32);
+ rinv33 = 1.0/sqrt(rsq33);
+ rinv34 = 1.0/sqrt(rsq34);
+ rinv42 = 1.0/sqrt(rsq42);
+ rinv43 = 1.0/sqrt(rsq43);
+ rinv44 = 1.0/sqrt(rsq44);
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ qq = qqHH;
+ r = rsq22*rinv22;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv22;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx22;
+ ty = fscal*dy22;
+ tz = fscal*dz22;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx2 = faction[j3+3] - tx;
+ fjy2 = faction[j3+4] - ty;
+ fjz2 = faction[j3+5] - tz;
+ qq = qqHH;
+ r = rsq23*rinv23;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv23;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx23;
+ ty = fscal*dy23;
+ tz = fscal*dz23;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx3 = faction[j3+6] - tx;
+ fjy3 = faction[j3+7] - ty;
+ fjz3 = faction[j3+8] - tz;
+ qq = qqMH;
+ r = rsq24*rinv24;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv24;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx24;
+ ty = fscal*dy24;
+ tz = fscal*dz24;
+ fix2 = fix2 + tx;
+ fiy2 = fiy2 + ty;
+ fiz2 = fiz2 + tz;
+ fjx4 = faction[j3+9] - tx;
+ fjy4 = faction[j3+10] - ty;
+ fjz4 = faction[j3+11] - tz;
+ qq = qqHH;
+ r = rsq32*rinv32;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv32;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx32;
+ ty = fscal*dy32;
+ tz = fscal*dz32;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx2 = fjx2 - tx;
+ fjy2 = fjy2 - ty;
+ fjz2 = fjz2 - tz;
+ qq = qqHH;
+ r = rsq33*rinv33;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv33;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx33;
+ ty = fscal*dy33;
+ tz = fscal*dz33;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx3 = fjx3 - tx;
+ fjy3 = fjy3 - ty;
+ fjz3 = fjz3 - tz;
+ qq = qqMH;
+ r = rsq34*rinv34;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv34;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx34;
+ ty = fscal*dy34;
+ tz = fscal*dz34;
+ fix3 = fix3 + tx;
+ fiy3 = fiy3 + ty;
+ fiz3 = fiz3 + tz;
+ fjx4 = fjx4 - tx;
+ fjy4 = fjy4 - ty;
+ fjz4 = fjz4 - tz;
+ qq = qqMH;
+ r = rsq42*rinv42;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv42;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx42;
+ ty = fscal*dy42;
+ tz = fscal*dz42;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+3] = fjx2 - tx;
+ faction[j3+4] = fjy2 - ty;
+ faction[j3+5] = fjz2 - tz;
+ qq = qqMH;
+ r = rsq43*rinv43;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv43;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx43;
+ ty = fscal*dy43;
+ tz = fscal*dz43;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+6] = fjx3 - tx;
+ faction[j3+7] = fjy3 - ty;
+ faction[j3+8] = fjz3 - tz;
+ qq = qqMM;
+ r = rsq44*rinv44;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 12*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vcoul = qq*VV;
+ fijC = qq*FF;
+ vctot = vctot + vcoul;
+ fscal = -((fijC)*tabscale)*rinv44;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx44;
+ ty = fscal*dy44;
+ tz = fscal*dz44;
+ fix4 = fix4 + tx;
+ fiy4 = fiy4 + ty;
+ fiz4 = fiz4 + tz;
+ faction[j3+9] = fjx4 - tx;
+ faction[j3+10] = fjy4 - ty;
+ faction[j3+11] = fjz4 - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ faction[ii3+3] = faction[ii3+3] + fix2;
+ faction[ii3+4] = faction[ii3+4] + fiy2;
+ faction[ii3+5] = faction[ii3+5] + fiz2;
+ faction[ii3+6] = faction[ii3+6] + fix3;
+ faction[ii3+7] = faction[ii3+7] + fiy3;
+ faction[ii3+8] = faction[ii3+8] + fiz3;
+ faction[ii3+9] = faction[ii3+9] + fix4;
+ faction[ii3+10] = faction[ii3+10] + fiy4;
+ faction[ii3+11] = faction[ii3+11] + fiz4;
+ fshift[is3] = fshift[is3]+fix1+fix2+fix3+fix4;
+ fshift[is3+1] = fshift[is3+1]+fiy1+fiy2+fiy3+fiy4;
+ fshift[is3+2] = fshift[is3+2]+fiz1+fiz2+fiz3+fiz4;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL400_ADRESS_H_
+#define _NBKERNEL400_ADRESS_H_
+
+/*! \file nb_kernel400.h
+ * \brief Nonbonded kernel adress 400 (GB Coul)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 400 with forces.
+ *
+ * <b>Coulomb interaction:</b> Generalized Born<br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel400_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 400 without forces.
+ *
+ * <b>Coulomb interaction:</b> Generalized Born<br>
+ * <b>VdW interaction:</b> No <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel400_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL400_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel400_adress_cg
+ * Coulomb interaction: Generalized-Born
+ * VdW interaction: Not calculated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel400_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float iq;
+ float qq,vcoul,vctot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float isai,isaj,isaprod,gbscale,vgb;
+ float dvdasum,dvdatmp,dvdaj,fgb;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ gbtabscale = *p_gbtabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ isai = invsqrta[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ dvdasum = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ isaj = invsqrta[jnr];
+ isaprod = isai*isaj;
+ qq = iq*charge[jnr];
+ vcoul = qq*rinv11;
+ fscal = vcoul*rinv11;
+ qq = isaprod*(-qq);
+ gbscale = isaprod*gbtabscale;
+ dvdaj = dvda[jnr];
+ r = rsq11*rinv11;
+ rt = r*gbscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = GBtab[nnn];
+ F = GBtab[nnn+1];
+ Geps = eps*GBtab[nnn+2];
+ Heps2 = eps2*GBtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vgb = qq*VV;
+ fijC = qq*FF*gbscale;
+ dvdatmp = -0.5*(vgb+fijC*r);
+ dvdasum = dvdasum + dvdatmp;
+ dvda[jnr] = dvdaj+dvdatmp*isaj*isaj;
+ vctot = vctot + vcoul;
+ fscal = -(fijC-fscal)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ dvda[ii] = dvda[ii] + dvdasum*isai*isai;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel400_adress_ex
+ * Coulomb interaction: Generalized-Born
+ * VdW interaction: Not calculated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel400_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float iq;
+ float qq,vcoul,vctot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float isai,isaj,isaprod,gbscale,vgb;
+ float dvdasum,dvdatmp,dvdaj,fgb;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ gbtabscale = *p_gbtabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ isai = invsqrta[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ dvdasum = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ isaj = invsqrta[jnr];
+ isaprod = isai*isaj;
+ qq = iq*charge[jnr];
+ vcoul = qq*rinv11;
+ fscal = vcoul*rinv11;
+ qq = isaprod*(-qq);
+ gbscale = isaprod*gbtabscale;
+ dvdaj = dvda[jnr];
+ r = rsq11*rinv11;
+ rt = r*gbscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = GBtab[nnn];
+ F = GBtab[nnn+1];
+ Geps = eps*GBtab[nnn+2];
+ Heps2 = eps2*GBtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vgb = qq*VV;
+ fijC = qq*FF*gbscale;
+ dvdatmp = -0.5*(vgb+fijC*r);
+ dvdasum = dvdasum + dvdatmp;
+ dvda[jnr] = dvdaj+dvdatmp*isaj*isaj;
+ vctot = vctot + vcoul;
+ fscal = -(fijC-fscal)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ dvda[ii] = dvda[ii] + dvdasum*isai*isai;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL410_ADRESS_H_
+#define _NBKERNEL410_ADRESS_H_
+
+/*! \file nb_kernel410.h
+ * \brief Nonbonded kernel adress 410 (GB Coul + LJ)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 410 with forces.
+ *
+ * <b>Coulomb interaction:</b> Generalized Born<br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel410_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 410 without forces.
+ *
+ * <b>Coulomb interaction:</b> Generalized Born<br>
+ * <b>VdW interaction:</b> Lennard-Jones <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel410_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL410_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel410_adress_cg
+ * Coulomb interaction: Generalized-Born
+ * VdW interaction: Lennard-Jones
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel410_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float isai,isaj,isaprod,gbscale,vgb;
+ float dvdasum,dvdatmp,dvdaj,fgb;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ gbtabscale = *p_gbtabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ isai = invsqrta[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ dvdasum = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ isaj = invsqrta[jnr];
+ isaprod = isai*isaj;
+ qq = iq*charge[jnr];
+ vcoul = qq*rinv11;
+ fscal = vcoul*rinv11;
+ qq = isaprod*(-qq);
+ gbscale = isaprod*gbtabscale;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ dvdaj = dvda[jnr];
+ r = rsq11*rinv11;
+ rt = r*gbscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = GBtab[nnn];
+ F = GBtab[nnn+1];
+ Geps = eps*GBtab[nnn+2];
+ Heps2 = eps2*GBtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vgb = qq*VV;
+ fijC = qq*FF*gbscale;
+ dvdatmp = -0.5*(vgb+fijC*r);
+ dvdasum = dvdasum + dvdatmp;
+ dvda[jnr] = dvdaj+dvdatmp*isaj*isaj;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq-(fijC-fscal)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ dvda[ii] = dvda[ii] + dvdasum*isai*isai;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel410_adress_ex
+ * Coulomb interaction: Generalized-Born
+ * VdW interaction: Lennard-Jones
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel410_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float isai,isaj,isaprod,gbscale,vgb;
+ float dvdasum,dvdatmp,dvdaj,fgb;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ gbtabscale = *p_gbtabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ isai = invsqrta[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ dvdasum = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ isaj = invsqrta[jnr];
+ isaprod = isai*isaj;
+ qq = iq*charge[jnr];
+ vcoul = qq*rinv11;
+ fscal = vcoul*rinv11;
+ qq = isaprod*(-qq);
+ gbscale = isaprod*gbtabscale;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ rinvsq = rinv11*rinv11;
+ dvdaj = dvda[jnr];
+ r = rsq11*rinv11;
+ rt = r*gbscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = GBtab[nnn];
+ F = GBtab[nnn+1];
+ Geps = eps*GBtab[nnn+2];
+ Heps2 = eps2*GBtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vgb = qq*VV;
+ fijC = qq*FF*gbscale;
+ dvdatmp = -0.5*(vgb+fijC*r);
+ dvdasum = dvdasum + dvdatmp;
+ dvda[jnr] = dvdaj+dvdatmp*isaj*isaj;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ Vvdw12 = c12*rinvsix*rinvsix;
+ Vvdwtot = Vvdwtot+Vvdw12-Vvdw6;
+ fscal = (12.0*Vvdw12-6.0*Vvdw6)*rinvsq-(fijC-fscal)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ dvda[ii] = dvda[ii] + dvdasum*isai*isai;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL420_ADRESS_H_
+#define _NBKERNEL420_ADRESS_H_
+
+/*! \file nb_kernel420.h
+ * \brief Nonbonded kernel adress 420 (GB Coul + Bham)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 420 with forces.
+ *
+ * <b>Coulomb interaction:</b> Generalized Born<br>
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel420_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 420 without forces.
+ *
+ * \internal Generated at compile time in either C or Fortran
+ * <b>VdW interaction:</b> Buckingham <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel420_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL420_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel420_adress_cg
+ * Coulomb interaction: Generalized-Born
+ * VdW interaction: Buckingham
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel420_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float isai,isaj,isaprod,gbscale,vgb;
+ float dvdasum,dvdatmp,dvdaj,fgb;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ gbtabscale = *p_gbtabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ isai = invsqrta[ii];
+ nti = 3*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ dvdasum = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ isaj = invsqrta[jnr];
+ isaprod = isai*isaj;
+ qq = iq*charge[jnr];
+ vcoul = qq*rinv11;
+ fscal = vcoul*rinv11;
+ qq = isaprod*(-qq);
+ gbscale = isaprod*gbtabscale;
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ dvdaj = dvda[jnr];
+ r = rsq11*rinv11;
+ rt = r*gbscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = GBtab[nnn];
+ F = GBtab[nnn+1];
+ Geps = eps*GBtab[nnn+2];
+ Heps2 = eps2*GBtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vgb = qq*VV;
+ fijC = qq*FF*gbscale;
+ dvdatmp = -0.5*(vgb+fijC*r);
+ dvdasum = dvdasum + dvdatmp;
+ dvda[jnr] = dvdaj+dvdatmp*isaj*isaj;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq-(fijC-fscal)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ dvda[ii] = dvda[ii] + dvdasum*isai*isai;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel420_adress_ex
+ * Coulomb interaction: Generalized-Born
+ * VdW interaction: Buckingham
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel420_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float rinvsq;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float rinvsix;
+ float Vvdw6,Vvdwtot;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float isai,isaj,isaprod,gbscale,vgb;
+ float dvdasum,dvdatmp,dvdaj,fgb;
+ float Vvdwexp,br;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,cexp1,cexp2;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ gbtabscale = *p_gbtabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ isai = invsqrta[ii];
+ nti = 3*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ dvdasum = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ isaj = invsqrta[jnr];
+ isaprod = isai*isaj;
+ qq = iq*charge[jnr];
+ vcoul = qq*rinv11;
+ fscal = vcoul*rinv11;
+ qq = isaprod*(-qq);
+ gbscale = isaprod*gbtabscale;
+ tj = nti+3*type[jnr];
+ c6 = vdwparam[tj];
+ cexp1 = vdwparam[tj+1];
+ cexp2 = vdwparam[tj+2];
+ rinvsq = rinv11*rinv11;
+ dvdaj = dvda[jnr];
+ r = rsq11*rinv11;
+ rt = r*gbscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = GBtab[nnn];
+ F = GBtab[nnn+1];
+ Geps = eps*GBtab[nnn+2];
+ Heps2 = eps2*GBtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vgb = qq*VV;
+ fijC = qq*FF*gbscale;
+ dvdatmp = -0.5*(vgb+fijC*r);
+ dvdasum = dvdasum + dvdatmp;
+ dvda[jnr] = dvdaj+dvdatmp*isaj*isaj;
+ vctot = vctot + vcoul;
+ rinvsix = rinvsq*rinvsq*rinvsq;
+ Vvdw6 = c6*rinvsix;
+ br = cexp2*rsq11*rinv11;
+ Vvdwexp = cexp1*exp(-br);
+ Vvdwtot = Vvdwtot+Vvdwexp-Vvdw6;
+ fscal = (br*Vvdwexp-6.0*Vvdw6)*rinvsq-(fijC-fscal)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ dvda[ii] = dvda[ii] + dvdasum*isai*isai;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL430_ADRESS_H_
+#define _NBKERNEL430_ADRESS_H_
+
+/*! \file nb_kernel430.h
+ * \brief Nonbonded kernel adress 430 (GB Coul + Tab VdW)
+ *
+ * \internal
+ */
+
+#include "types/simple.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#if 0
+}
+#endif
+
+
+/*! \brief Nonbonded kernel adress 430 with forces.
+ *
+ * <b>Coulomb interaction:</b> Generalized Born<br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> Yes <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel430_adress_ex
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+/*! \brief Nonbonded kernel adress 430 without forces.
+ *
+ * <b>Coulomb interaction:</b> Generalized Born<br>
+ * <b>VdW interaction:</b> Tabulated <br>
+ * <b>Water optimization:</b> No <br>
+ * <b>Forces calculated:</b> No <br>
+ *
+ * \note All level1 and level2 nonbonded kernels use the same
+ * call sequence. Parameters are documented in nb_kernel.h
+ */
+void
+nb_kernel430_adress_cg
+ (int * nri, int iinr[],
+ int jindex[], int jjnr[],
+ int shift[], real shiftvec[],
+ real fshift[], int gid[],
+ real pos[], real faction[],
+ real charge[], real * facel,
+ real * krf, real * crf,
+ real Vc[], int type[],
+ int * ntype, real vdwparam[],
+ real Vvdw[], real * tabscale,
+ real VFtab[], real invsqrta[],
+ real dvda[], real * gbtabscale,
+ real GBtab[], int * nthreads,
+ int * count, void * mtx,
+ int * outeriter, int * inneriter,
+ real force_cap, real * wf);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _NBKERNEL430_ADRESS_H_ */
--- /dev/null
+/*
+ * Copyright (c) Erik Lindahl, David van der Spoel 2003
+ *
+ * This file is generated automatically at compile time
+ * by the program mknb in the Gromacs distribution.
+ *
+ * Options used when generation this file:
+ * Language: c
+ * Precision: single
+ * Threads: yes
+ * Software invsqrt: no
+ * PowerPC invsqrt: no
+ * Prefetch forces: no
+ * Adress kernel: yes
+ * Comments: no
+ */
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+#ifdef GMX_THREAD_SHM_FDECOMP
+#include<thread_mpi.h>
+#endif
+#define ALMOST_ZERO 1e-30
+#define ALMOST_ONE 1-(1e-30)
+#include<math.h>
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel430_adress_cg
+ * Coulomb interaction: Generalized-Born
+ * VdW interaction: Tabulated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel430_adress_cg(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float fijD,fijR;
+ float isai,isaj,isaprod,gbscale,vgb;
+ float dvdasum,dvdatmp,dvdaj,fgb;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ gbtabscale = *p_gbtabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ isai = invsqrta[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ dvdasum = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ hybscal = 1.0;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else
+ {
+ hybscal = 1.0 - weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ isaj = invsqrta[jnr];
+ isaprod = isai*isaj;
+ qq = iq*charge[jnr];
+ vcoul = qq*rinv11;
+ fscal = vcoul*rinv11;
+ qq = isaprod*(-qq);
+ gbscale = isaprod*gbtabscale;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ dvdaj = dvda[jnr];
+ r = rsq11*rinv11;
+ rt = r*gbscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = GBtab[nnn];
+ F = GBtab[nnn+1];
+ Geps = eps*GBtab[nnn+2];
+ Heps2 = eps2*GBtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vgb = qq*VV;
+ fijC = qq*FF*gbscale;
+ dvdatmp = -0.5*(vgb+fijC*r);
+ dvdasum = dvdasum + dvdatmp;
+ dvda[jnr] = dvdaj+dvdatmp*isaj*isaj;
+ vctot = vctot + vcoul;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale+fijC-fscal)*rinv11;
+ fscal *= hybscal;
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ dvda[ii] = dvda[ii] + dvdasum*isai*isai;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
+
+
+
+/*
+ * Gromacs nonbonded kernel nb_kernel430_adress_ex
+ * Coulomb interaction: Generalized-Born
+ * VdW interaction: Tabulated
+ * water optimization: No
+ * Calculate forces: yes
+ */
+void nb_kernel430_adress_ex(
+ int * p_nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ float * shiftvec,
+ float * fshift,
+ int * gid,
+ float * pos,
+ float * faction,
+ float * charge,
+ float * p_facel,
+ float * p_krf,
+ float * p_crf,
+ float * Vc,
+ int * type,
+ int * p_ntype,
+ float * vdwparam,
+ float * Vvdw,
+ float * p_tabscale,
+ float * VFtab,
+ float * invsqrta,
+ float * dvda,
+ float * p_gbtabscale,
+ float * GBtab,
+ int * p_nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ float force_cap,
+ float * wf)
+{
+ int nri,ntype,nthreads;
+ float facel,krf,crf,tabscale,gbtabscale;
+ int n,ii,is3,ii3,k,nj0,nj1,jnr,j3,ggid;
+ int nn0,nn1,nouter,ninner;
+ float shX,shY,shZ;
+ float fscal,tx,ty,tz;
+ float iq;
+ float qq,vcoul,vctot;
+ int nti;
+ int tj;
+ float Vvdw6,Vvdwtot;
+ float Vvdw12;
+ float r,rt,eps,eps2;
+ int n0,nnn;
+ float Y,F,Geps,Heps2,Fp,VV;
+ float FF;
+ float fijC;
+ float fijD,fijR;
+ float isai,isaj,isaprod,gbscale,vgb;
+ float dvdasum,dvdatmp,dvdaj,fgb;
+ float ix1,iy1,iz1,fix1,fiy1,fiz1;
+ float jx1,jy1,jz1;
+ float dx11,dy11,dz11,rsq11,rinv11;
+ float c6,c12;
+ float weight_cg1, weight_cg2, weight_product;
+ float hybscal;
+
+ nri = *p_nri;
+ ntype = *p_ntype;
+ nthreads = *p_nthreads;
+ facel = *p_facel;
+ krf = *p_krf;
+ crf = *p_crf;
+ tabscale = *p_tabscale;
+ gbtabscale = *p_gbtabscale;
+ nouter = 0;
+ ninner = 0;
+
+ do
+ {
+ #ifdef GMX_THREAD_SHM_FDECOMP
+ tMPI_Thread_mutex_lock((tMPI_Thread_mutex_t *)mtx);
+ nn0 = *count;
+ nn1 = nn0+(nri-nn0)/(2*nthreads)+10;
+ *count = nn1;
+ tMPI_Thread_mutex_unlock((tMPI_Thread_mutex_t *)mtx);
+ if(nn1>nri) nn1=nri;
+ #else
+ nn0 = 0;
+ nn1 = nri;
+ #endif
+
+ for(n=nn0; (n<nn1); n++)
+ {
+ is3 = 3*shift[n];
+ shX = shiftvec[is3];
+ shY = shiftvec[is3+1];
+ shZ = shiftvec[is3+2];
+ nj0 = jindex[n];
+ nj1 = jindex[n+1];
+ ii = iinr[n];
+ ii3 = 3*ii;
+ ix1 = shX + pos[ii3+0];
+ iy1 = shY + pos[ii3+1];
+ iz1 = shZ + pos[ii3+2];
+ iq = facel*charge[ii];
+ isai = invsqrta[ii];
+ nti = 2*ntype*type[ii];
+ weight_cg1 = wf[ii];
+ vctot = 0;
+ Vvdwtot = 0;
+ dvdasum = 0;
+ fix1 = 0;
+ fiy1 = 0;
+ fiz1 = 0;
+
+ for(k=nj0; (k<nj1); k++)
+ {
+ jnr = jjnr[k];
+ weight_cg2 = wf[jnr];
+ weight_product = weight_cg1*weight_cg2;
+ if (weight_product < ALMOST_ZERO) {
+ /* force is zero, skip this molecule */
+ continue;
+ }
+ else if (weight_product >= ALMOST_ONE)
+ {
+ hybscal = 1.0;
+ }
+ else
+ {
+ hybscal = weight_product;
+ }
+ j3 = 3*jnr;
+ jx1 = pos[j3+0];
+ jy1 = pos[j3+1];
+ jz1 = pos[j3+2];
+ dx11 = ix1 - jx1;
+ dy11 = iy1 - jy1;
+ dz11 = iz1 - jz1;
+ rsq11 = dx11*dx11+dy11*dy11+dz11*dz11;
+ rinv11 = 1.0/sqrt(rsq11);
+ isaj = invsqrta[jnr];
+ isaprod = isai*isaj;
+ qq = iq*charge[jnr];
+ vcoul = qq*rinv11;
+ fscal = vcoul*rinv11;
+ qq = isaprod*(-qq);
+ gbscale = isaprod*gbtabscale;
+ tj = nti+2*type[jnr];
+ c6 = vdwparam[tj];
+ c12 = vdwparam[tj+1];
+ dvdaj = dvda[jnr];
+ r = rsq11*rinv11;
+ rt = r*gbscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ Y = GBtab[nnn];
+ F = GBtab[nnn+1];
+ Geps = eps*GBtab[nnn+2];
+ Heps2 = eps2*GBtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ vgb = qq*VV;
+ fijC = qq*FF*gbscale;
+ dvdatmp = -0.5*(vgb+fijC*r);
+ dvdasum = dvdasum + dvdatmp;
+ dvda[jnr] = dvdaj+dvdatmp*isaj*isaj;
+ vctot = vctot + vcoul;
+ r = rsq11*rinv11;
+ rt = r*tabscale;
+ n0 = rt;
+ eps = rt-n0;
+ eps2 = eps*eps;
+ nnn = 8*n0;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw6 = c6*VV;
+ fijD = c6*FF;
+ nnn = nnn+4;
+ Y = VFtab[nnn];
+ F = VFtab[nnn+1];
+ Geps = eps*VFtab[nnn+2];
+ Heps2 = eps2*VFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ VV = Y+eps*Fp;
+ FF = Fp+Geps+2.0*Heps2;
+ Vvdw12 = c12*VV;
+ fijR = c12*FF;
+ Vvdwtot = Vvdwtot+ Vvdw6 + Vvdw12;
+ fscal = -((fijD+fijR)*tabscale+fijC-fscal)*rinv11;
+ fscal *= hybscal;
+ if(force_cap>0 && (fabs(fscal)> force_cap)){
+ fscal=force_cap*fscal/fabs(fscal);
+ }
+ tx = fscal*dx11;
+ ty = fscal*dy11;
+ tz = fscal*dz11;
+ fix1 = fix1 + tx;
+ fiy1 = fiy1 + ty;
+ fiz1 = fiz1 + tz;
+ faction[j3+0] = faction[j3+0] - tx;
+ faction[j3+1] = faction[j3+1] - ty;
+ faction[j3+2] = faction[j3+2] - tz;
+ }
+
+ faction[ii3+0] = faction[ii3+0] + fix1;
+ faction[ii3+1] = faction[ii3+1] + fiy1;
+ faction[ii3+2] = faction[ii3+2] + fiz1;
+ fshift[is3] = fshift[is3]+fix1;
+ fshift[is3+1] = fshift[is3+1]+fiy1;
+ fshift[is3+2] = fshift[is3+2]+fiz1;
+ ggid = gid[n];
+ Vc[ggid] = Vc[ggid] + vctot;
+ Vvdw[ggid] = Vvdw[ggid] + Vvdwtot;
+ dvda[ii] = dvda[ii] + dvdasum*isai*isai;
+ ninner = ninner + nj1 - nj0;
+ }
+
+ nouter = nouter + nn1 - nn0;
+ }
+ while (nn1<nri);
+
+ *outeriter = nouter;
+ *inneriter = ninner;
+}
+
+
--- /dev/null
+
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000_adress, University of Groningen_adress, The Netherlands.
+ * Copyright (c) 2001-2009_adress, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis_adress,
+ * written by Erik Lindahl_adress, David van der Spoel_adress, Berk Hess_adress, and others - for
+ * a full list of developers and information_adress, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License_adress, or (at your option) any
+ * later version.
+ * As a special exception_adress, you may use this file as part of a free software
+ * library without restriction. Specifically_adress, if other files instantiate
+ * templates or use macros or inline functions from this file_adress, or you compile
+ * this file and link it with other files to produce an executable_adress, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL_adress, not an application linking with it.
+ *
+ * To help fund GROMACS development_adress, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+
+#include "types/nrnb.h"
+#include "nb_kernel_c_adress.h"
+#include "../nb_kerneltype.h"
+
+
+/* Include standard kernel headers in local directory */
+#include "nb_kernel010_adress.h"
+#include "nb_kernel020_adress.h"
+#include "nb_kernel030_adress.h"
+#include "nb_kernel100_adress.h"
+#include "nb_kernel101_adress.h"
+#include "nb_kernel102_adress.h"
+#include "nb_kernel103_adress.h"
+#include "nb_kernel104_adress.h"
+#include "nb_kernel110_adress.h"
+#include "nb_kernel111_adress.h"
+#include "nb_kernel112_adress.h"
+#include "nb_kernel113_adress.h"
+#include "nb_kernel114_adress.h"
+#include "nb_kernel120_adress.h"
+#include "nb_kernel121_adress.h"
+#include "nb_kernel122_adress.h"
+#include "nb_kernel123_adress.h"
+#include "nb_kernel124_adress.h"
+#include "nb_kernel130_adress.h"
+#include "nb_kernel131_adress.h"
+#include "nb_kernel132_adress.h"
+#include "nb_kernel133_adress.h"
+#include "nb_kernel134_adress.h"
+#include "nb_kernel200_adress.h"
+#include "nb_kernel201_adress.h"
+#include "nb_kernel202_adress.h"
+#include "nb_kernel203_adress.h"
+#include "nb_kernel204_adress.h"
+#include "nb_kernel210_adress.h"
+#include "nb_kernel211_adress.h"
+#include "nb_kernel212_adress.h"
+#include "nb_kernel213_adress.h"
+#include "nb_kernel214_adress.h"
+#include "nb_kernel220_adress.h"
+#include "nb_kernel221_adress.h"
+#include "nb_kernel222_adress.h"
+#include "nb_kernel223_adress.h"
+#include "nb_kernel224_adress.h"
+#include "nb_kernel230_adress.h"
+#include "nb_kernel231_adress.h"
+#include "nb_kernel232_adress.h"
+#include "nb_kernel233_adress.h"
+#include "nb_kernel234_adress.h"
+#include "nb_kernel300_adress.h"
+#include "nb_kernel301_adress.h"
+#include "nb_kernel302_adress.h"
+#include "nb_kernel303_adress.h"
+#include "nb_kernel304_adress.h"
+#include "nb_kernel310_adress.h"
+#include "nb_kernel311_adress.h"
+#include "nb_kernel312_adress.h"
+#include "nb_kernel313_adress.h"
+#include "nb_kernel314_adress.h"
+#include "nb_kernel320_adress.h"
+#include "nb_kernel321_adress.h"
+#include "nb_kernel322_adress.h"
+#include "nb_kernel323_adress.h"
+#include "nb_kernel324_adress.h"
+#include "nb_kernel330_adress.h"
+#include "nb_kernel331_adress.h"
+#include "nb_kernel332_adress.h"
+#include "nb_kernel333_adress.h"
+#include "nb_kernel334_adress.h"
+#include "nb_kernel400_adress.h"
+#include "nb_kernel410_adress.h"
+#include "nb_kernel420_adress.h"
+#include "nb_kernel430_adress.h"
+
+
+
+static nb_adress_kernel_t *
+kernellist_adress[eNR_NBKERNEL_NR] =
+{
+ nb_kernel010_adress_cg,
+ nb_kernel020_adress_cg,
+ nb_kernel030_adress_cg,
+ nb_kernel100_adress_cg,
+ nb_kernel101_adress_cg,
+ nb_kernel102_adress_cg,
+ nb_kernel103_adress_cg,
+ nb_kernel104_adress_cg,
+ nb_kernel110_adress_cg,
+ nb_kernel111_adress_cg,
+ nb_kernel112_adress_cg,
+ nb_kernel113_adress_cg,
+ nb_kernel114_adress_cg,
+ nb_kernel120_adress_cg,
+ nb_kernel121_adress_cg,
+ nb_kernel122_adress_cg,
+ nb_kernel123_adress_cg,
+ nb_kernel124_adress_cg,
+ nb_kernel130_adress_cg,
+ nb_kernel131_adress_cg,
+ nb_kernel132_adress_cg,
+ nb_kernel133_adress_cg,
+ nb_kernel134_adress_cg,
+ nb_kernel200_adress_cg,
+ nb_kernel201_adress_cg,
+ nb_kernel202_adress_cg,
+ nb_kernel203_adress_cg,
+ nb_kernel204_adress_cg,
+ nb_kernel210_adress_cg,
+ nb_kernel211_adress_cg,
+ nb_kernel212_adress_cg,
+ nb_kernel213_adress_cg,
+ nb_kernel214_adress_cg,
+ nb_kernel220_adress_cg,
+ nb_kernel221_adress_cg,
+ nb_kernel222_adress_cg,
+ nb_kernel223_adress_cg,
+ nb_kernel224_adress_cg,
+ nb_kernel230_adress_cg,
+ nb_kernel231_adress_cg,
+ nb_kernel232_adress_cg,
+ nb_kernel233_adress_cg,
+ nb_kernel234_adress_cg,
+ nb_kernel300_adress_cg,
+ nb_kernel301_adress_cg,
+ nb_kernel302_adress_cg,
+ nb_kernel303_adress_cg,
+ nb_kernel304_adress_cg,
+ nb_kernel310_adress_cg,
+ nb_kernel311_adress_cg,
+ nb_kernel312_adress_cg,
+ nb_kernel313_adress_cg,
+ nb_kernel314_adress_cg,
+ nb_kernel320_adress_cg,
+ nb_kernel321_adress_cg,
+ nb_kernel322_adress_cg,
+ nb_kernel323_adress_cg,
+ nb_kernel324_adress_cg,
+ nb_kernel330_adress_cg,
+ nb_kernel331_adress_cg,
+ nb_kernel332_adress_cg,
+ nb_kernel333_adress_cg,
+ nb_kernel334_adress_cg,
+ nb_kernel400_adress_cg,
+ nb_kernel410_adress_cg,
+ nb_kernel430_adress_cg,
+ nb_kernel010_adress_ex,
+ nb_kernel020_adress_ex,
+ nb_kernel030_adress_ex,
+ nb_kernel100_adress_ex,
+ nb_kernel101_adress_ex,
+ nb_kernel102_adress_ex,
+ nb_kernel103_adress_ex,
+ nb_kernel104_adress_ex,
+ nb_kernel110_adress_ex,
+ nb_kernel111_adress_ex,
+ nb_kernel112_adress_ex,
+ nb_kernel113_adress_ex,
+ nb_kernel114_adress_ex,
+ nb_kernel120_adress_ex,
+ nb_kernel121_adress_ex,
+ nb_kernel122_adress_ex,
+ nb_kernel123_adress_ex,
+ nb_kernel124_adress_ex,
+ nb_kernel130_adress_ex,
+ nb_kernel131_adress_ex,
+ nb_kernel132_adress_ex,
+ nb_kernel133_adress_ex,
+ nb_kernel134_adress_ex,
+ nb_kernel200_adress_ex,
+ nb_kernel201_adress_ex,
+ nb_kernel202_adress_ex,
+ nb_kernel203_adress_ex,
+ nb_kernel204_adress_ex,
+ nb_kernel210_adress_ex,
+ nb_kernel211_adress_ex,
+ nb_kernel212_adress_ex,
+ nb_kernel213_adress_ex,
+ nb_kernel214_adress_ex,
+ nb_kernel220_adress_ex,
+ nb_kernel221_adress_ex,
+ nb_kernel222_adress_ex,
+ nb_kernel223_adress_ex,
+ nb_kernel224_adress_ex,
+ nb_kernel230_adress_ex,
+ nb_kernel231_adress_ex,
+ nb_kernel232_adress_ex,
+ nb_kernel233_adress_ex,
+ nb_kernel234_adress_ex,
+ nb_kernel300_adress_ex,
+ nb_kernel301_adress_ex,
+ nb_kernel302_adress_ex,
+ nb_kernel303_adress_ex,
+ nb_kernel304_adress_ex,
+ nb_kernel310_adress_ex,
+ nb_kernel311_adress_ex,
+ nb_kernel312_adress_ex,
+ nb_kernel313_adress_ex,
+ nb_kernel314_adress_ex,
+ nb_kernel320_adress_ex,
+ nb_kernel321_adress_ex,
+ nb_kernel322_adress_ex,
+ nb_kernel323_adress_ex,
+ nb_kernel324_adress_ex,
+ nb_kernel330_adress_ex,
+ nb_kernel331_adress_ex,
+ nb_kernel332_adress_ex,
+ nb_kernel333_adress_ex,
+ nb_kernel334_adress_ex,
+ nb_kernel400_adress_ex,
+ nb_kernel410_adress_ex,
+ nb_kernel430_adress_ex,
+};
+
+void
+nb_kernel_setup_adress(FILE *log, nb_adress_kernel_t **list_adress)
+{
+ int i;
+ nb_adress_kernel_t *p;
+
+ if(NULL != log)
+ fprintf(log,"AdResS simulation: Configuring adress C nonbonded kernels...\n");
+
+ for(i=0;i<eNR_NBKERNEL_NR;i++)
+ {
+ p = kernellist_adress[i];
+ if(p!=NULL)
+ list_adress[i] = p;
+ }
+}
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS Development Team
+ *
+ * Gromacs is a library for molecular simulation and trajectory analysis,
+ * written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
+ * a full list of developers and information, check out http://www.gromacs.org
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option) any
+ * later version.
+ * As a special exception, you may use this file as part of a free software
+ * library without restriction. Specifically, if other files instantiate
+ * templates or use macros or inline functions from this file, or you compile
+ * this file and link it with other files to produce an executable, this
+ * file does not by itself cause the resulting executable to be covered by
+ * the GNU Lesser General Public License.
+ *
+ * In plain-speak: do not worry about classes/macros/templates either - only
+ * changes to the library have to be LGPL, not an application linking with it.
+ *
+ * To help fund GROMACS development, we humbly ask that you cite
+ * the papers people have written on it - you can find them on the website!
+ */
+#ifndef _NBKERNEL_ADRESS_H_
+#define _NBKERNEL_ADRESS_H_
+
+/** \file
+ * \brief The vanilla nonbonded Gromacs kernels (portable, written in C).
+ *
+ * \internal
+ */
+
+#include <stdio.h>
+
+#include "../nb_kerneltype.h"
+
+void
+nb_kernel_setup_adress(FILE *fplog,nb_adress_kernel_t **list);
+
+#endif /* _NBKERNEL_H_ */
+
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-noinst_LTLIBRARIES = libnb_kernel_bluegene.la
-
-libnb_kernel_bluegene_la_SOURCES = \
- nb_kernel010_bluegene.c nb_kernel010_bluegene.h \
- nb_kernel020_bluegene.c nb_kernel020_bluegene.h \
- nb_kernel030_bluegene.c nb_kernel030_bluegene.h \
- nb_kernel100_bluegene.c nb_kernel100_bluegene.h \
- nb_kernel101_bluegene.c nb_kernel101_bluegene.h \
- nb_kernel102_bluegene.c nb_kernel102_bluegene.h \
- nb_kernel103_bluegene.c nb_kernel103_bluegene.h \
- nb_kernel104_bluegene.c nb_kernel104_bluegene.h \
- nb_kernel110_bluegene.c nb_kernel110_bluegene.h \
- nb_kernel111_bluegene.c nb_kernel111_bluegene.h \
- nb_kernel112_bluegene.c nb_kernel112_bluegene.h \
- nb_kernel113_bluegene.c nb_kernel113_bluegene.h \
- nb_kernel114_bluegene.c nb_kernel114_bluegene.h \
- nb_kernel120_bluegene.c nb_kernel120_bluegene.h \
- nb_kernel121_bluegene.c nb_kernel121_bluegene.h \
- nb_kernel122_bluegene.c nb_kernel122_bluegene.h \
- nb_kernel123_bluegene.c nb_kernel123_bluegene.h \
- nb_kernel124_bluegene.c nb_kernel124_bluegene.h \
- nb_kernel130_bluegene.c nb_kernel130_bluegene.h \
- nb_kernel131_bluegene.c nb_kernel131_bluegene.h \
- nb_kernel132_bluegene.c nb_kernel132_bluegene.h \
- nb_kernel133_bluegene.c nb_kernel133_bluegene.h \
- nb_kernel134_bluegene.c nb_kernel134_bluegene.h \
- nb_kernel200_bluegene.c nb_kernel200_bluegene.h \
- nb_kernel201_bluegene.c nb_kernel201_bluegene.h \
- nb_kernel202_bluegene.c nb_kernel202_bluegene.h \
- nb_kernel203_bluegene.c nb_kernel203_bluegene.h \
- nb_kernel204_bluegene.c nb_kernel204_bluegene.h \
- nb_kernel210_bluegene.c nb_kernel210_bluegene.h \
- nb_kernel211_bluegene.c nb_kernel211_bluegene.h \
- nb_kernel212_bluegene.c nb_kernel212_bluegene.h \
- nb_kernel213_bluegene.c nb_kernel213_bluegene.h \
- nb_kernel214_bluegene.c nb_kernel214_bluegene.h \
- nb_kernel220_bluegene.c nb_kernel220_bluegene.h \
- nb_kernel221_bluegene.c nb_kernel221_bluegene.h \
- nb_kernel222_bluegene.c nb_kernel222_bluegene.h \
- nb_kernel223_bluegene.c nb_kernel223_bluegene.h \
- nb_kernel224_bluegene.c nb_kernel224_bluegene.h \
- nb_kernel230_bluegene.c nb_kernel230_bluegene.h \
- nb_kernel231_bluegene.c nb_kernel231_bluegene.h \
- nb_kernel232_bluegene.c nb_kernel232_bluegene.h \
- nb_kernel233_bluegene.c nb_kernel233_bluegene.h \
- nb_kernel234_bluegene.c nb_kernel234_bluegene.h \
- nb_kernel300_bluegene.c nb_kernel300_bluegene.h \
- nb_kernel301_bluegene.c nb_kernel301_bluegene.h \
- nb_kernel302_bluegene.c nb_kernel302_bluegene.h \
- nb_kernel303_bluegene.c nb_kernel303_bluegene.h \
- nb_kernel304_bluegene.c nb_kernel304_bluegene.h \
- nb_kernel310_bluegene.c nb_kernel310_bluegene.h \
- nb_kernel311_bluegene.c nb_kernel311_bluegene.h \
- nb_kernel312_bluegene.c nb_kernel312_bluegene.h \
- nb_kernel313_bluegene.c nb_kernel313_bluegene.h \
- nb_kernel314_bluegene.c nb_kernel314_bluegene.h \
- nb_kernel320_bluegene.c nb_kernel320_bluegene.h \
- nb_kernel321_bluegene.c nb_kernel321_bluegene.h \
- nb_kernel322_bluegene.c nb_kernel322_bluegene.h \
- nb_kernel323_bluegene.c nb_kernel323_bluegene.h \
- nb_kernel324_bluegene.c nb_kernel324_bluegene.h \
- nb_kernel330_bluegene.c nb_kernel330_bluegene.h \
- nb_kernel331_bluegene.c nb_kernel331_bluegene.h \
- nb_kernel332_bluegene.c nb_kernel332_bluegene.h \
- nb_kernel333_bluegene.c nb_kernel333_bluegene.h \
- nb_kernel334_bluegene.c nb_kernel334_bluegene.h \
- nb_kernel400_bluegene.c nb_kernel400_bluegene.h \
- nb_kernel410_bluegene.c nb_kernel410_bluegene.h \
- nb_kernel420_bluegene.c nb_kernel420_bluegene.h \
- nb_kernel430_bluegene.c nb_kernel430_bluegene.h \
- nb_kernel_bluegene.c nb_kernel_bluegene.h \
- nb_kernel_w3_bluegene.h nb_kernel_w3w3_bluegene.h \
- nb_kernel_w4_bluegene.h nb_kernel_w4w4_bluegene.h \
- nb_kernel_gen_bluegene.h interaction.h
-
-
-
vctot += _vcoul; \
_dvdatmp = _vcoul + _fijC * _rt; \
dvdasum -= _dvdatmp; \
- dvda[jnr] -= _dvdatmp;
+ dvda[jnr] -= _dvdatmp
#define calc_coulomb_force_(_qq,_rinv,_rsq) \
_fscal += _fijC * (_rinv * _gbscale)
VV = __fpmadd(Y,eps,__fpmadd(F,eps,GHeps)); \
FF = __fpmadd(F,eps,__fpmadd(__fpadd(GHeps,GHeps),eps,H)); \
Vvdwtot = __fxcpmadd(Vvdwtot,VV,_c12); \
- fijD = __fxcpmadd(fijD,FF,_c12);
+ fijD = __fxcpmadd(fijD,FF,_c12)
#else
/* refines the reciprocal square root rinv of rsq with one Newton-Raphson iteration (scalar version)
*/
-#define sqrt_newton_scalar(rinv,rsq) ((0.5 * rinv) * (3.0 - rsq * (rinv * rinv)));
+#define sqrt_newton_scalar(rinv,rsq) ((0.5 * rinv) * (3.0 - rsq * (rinv * rinv)))
/* refines two reciprocal estimates rinv of r with one Newton-Raphson iteration in parallel
_rinv = sqrt_newton_scalar(_rinv,_rsq);
#endif
+ /* cppcheck-suppress selfAssignment */
FULL_INTERACTION_(_qq,_rinv,_rsq,jnr);
#ifndef NO_FORCE
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-noinst_LTLIBRARIES = libnb_kernel_c.la
-
-libnb_kernel_c_la_SOURCES = \
- nb_kernel010.c nb_kernel020.c nb_kernel030.c nb_kernel100.c \
- nb_kernel101.c nb_kernel102.c nb_kernel103.c nb_kernel104.c \
- nb_kernel110.c nb_kernel111.c nb_kernel112.c nb_kernel113.c \
- nb_kernel114.c nb_kernel120.c nb_kernel121.c nb_kernel122.c \
- nb_kernel123.c nb_kernel124.c nb_kernel130.c nb_kernel131.c \
- nb_kernel132.c nb_kernel133.c nb_kernel134.c nb_kernel200.c \
- nb_kernel201.c nb_kernel202.c nb_kernel203.c nb_kernel204.c \
- nb_kernel210.c nb_kernel211.c nb_kernel212.c nb_kernel213.c \
- nb_kernel214.c nb_kernel220.c nb_kernel221.c nb_kernel222.c \
- nb_kernel223.c nb_kernel224.c nb_kernel230.c nb_kernel231.c \
- nb_kernel232.c nb_kernel233.c nb_kernel234.c nb_kernel300.c \
- nb_kernel301.c nb_kernel302.c nb_kernel303.c nb_kernel304.c \
- nb_kernel310.c nb_kernel311.c nb_kernel312.c nb_kernel313.c \
- nb_kernel314.c nb_kernel320.c nb_kernel321.c nb_kernel322.c \
- nb_kernel323.c nb_kernel324.c nb_kernel330.c nb_kernel331.c \
- nb_kernel332.c nb_kernel333.c nb_kernel334.c nb_kernel400.c \
- nb_kernel410.c nb_kernel420.c nb_kernel430.c \
- nb_kernel_allvsall.c nb_kernel_allvsallgb.c \
- nb_kernel010.h nb_kernel020.h nb_kernel030.h nb_kernel100.h \
- nb_kernel101.h nb_kernel102.h nb_kernel103.h nb_kernel104.h \
- nb_kernel110.h nb_kernel111.h nb_kernel112.h nb_kernel113.h \
- nb_kernel114.h nb_kernel120.h nb_kernel121.h nb_kernel122.h \
- nb_kernel123.h nb_kernel124.h nb_kernel130.h nb_kernel131.h \
- nb_kernel132.h nb_kernel133.h nb_kernel134.h nb_kernel200.h \
- nb_kernel201.h nb_kernel202.h nb_kernel203.h nb_kernel204.h \
- nb_kernel210.h nb_kernel211.h nb_kernel212.h nb_kernel213.h \
- nb_kernel214.h nb_kernel220.h nb_kernel221.h nb_kernel222.h \
- nb_kernel223.h nb_kernel224.h nb_kernel230.h nb_kernel231.h \
- nb_kernel232.h nb_kernel233.h nb_kernel234.h nb_kernel300.h \
- nb_kernel301.h nb_kernel302.h nb_kernel303.h nb_kernel304.h \
- nb_kernel310.h nb_kernel311.h nb_kernel312.h nb_kernel313.h \
- nb_kernel314.h nb_kernel320.h nb_kernel321.h nb_kernel322.h \
- nb_kernel323.h nb_kernel324.h nb_kernel330.h nb_kernel331.h \
- nb_kernel332.h nb_kernel333.h nb_kernel334.h nb_kernel400.h \
- nb_kernel410.h nb_kernel420.h nb_kernel430.h \
- nb_kernel_allvsall.h nb_kernel_allvsallgb.h \
- nb_kernel_c.c nb_kernel_c.h
-
-
-
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-noinst_LTLIBRARIES = libnb_kernel_f77_double.la
-
-libnb_kernel_f77_double_la_SOURCES = \
- nb_kernel010_f77_double.c nb_kernel020_f77_double.c nb_kernel030_f77_double.c nb_kernel100_f77_double.c \
- nb_kernel101_f77_double.c nb_kernel102_f77_double.c nb_kernel103_f77_double.c nb_kernel104_f77_double.c \
- nb_kernel110_f77_double.c nb_kernel111_f77_double.c nb_kernel112_f77_double.c nb_kernel113_f77_double.c \
- nb_kernel114_f77_double.c nb_kernel120_f77_double.c nb_kernel121_f77_double.c nb_kernel122_f77_double.c \
- nb_kernel123_f77_double.c nb_kernel124_f77_double.c nb_kernel130_f77_double.c nb_kernel131_f77_double.c \
- nb_kernel132_f77_double.c nb_kernel133_f77_double.c nb_kernel134_f77_double.c nb_kernel200_f77_double.c \
- nb_kernel201_f77_double.c nb_kernel202_f77_double.c nb_kernel203_f77_double.c nb_kernel204_f77_double.c \
- nb_kernel210_f77_double.c nb_kernel211_f77_double.c nb_kernel212_f77_double.c nb_kernel213_f77_double.c \
- nb_kernel214_f77_double.c nb_kernel220_f77_double.c nb_kernel221_f77_double.c nb_kernel222_f77_double.c \
- nb_kernel223_f77_double.c nb_kernel224_f77_double.c nb_kernel230_f77_double.c nb_kernel231_f77_double.c \
- nb_kernel232_f77_double.c nb_kernel233_f77_double.c nb_kernel234_f77_double.c nb_kernel300_f77_double.c \
- nb_kernel301_f77_double.c nb_kernel302_f77_double.c nb_kernel303_f77_double.c nb_kernel304_f77_double.c \
- nb_kernel310_f77_double.c nb_kernel311_f77_double.c nb_kernel312_f77_double.c nb_kernel313_f77_double.c \
- nb_kernel314_f77_double.c nb_kernel320_f77_double.c nb_kernel321_f77_double.c nb_kernel322_f77_double.c \
- nb_kernel323_f77_double.c nb_kernel324_f77_double.c nb_kernel330_f77_double.c nb_kernel331_f77_double.c \
- nb_kernel332_f77_double.c nb_kernel333_f77_double.c nb_kernel334_f77_double.c nb_kernel400_f77_double.c \
- nb_kernel410_f77_double.c nb_kernel420_f77_double.c nb_kernel430_f77_double.c \
- nb_kernel010_f77_double.h nb_kernel020_f77_double.h nb_kernel030_f77_double.h nb_kernel100_f77_double.h \
- nb_kernel101_f77_double.h nb_kernel102_f77_double.h nb_kernel103_f77_double.h nb_kernel104_f77_double.h \
- nb_kernel110_f77_double.h nb_kernel111_f77_double.h nb_kernel112_f77_double.h nb_kernel113_f77_double.h \
- nb_kernel114_f77_double.h nb_kernel120_f77_double.h nb_kernel121_f77_double.h nb_kernel122_f77_double.h \
- nb_kernel123_f77_double.h nb_kernel124_f77_double.h nb_kernel130_f77_double.h nb_kernel131_f77_double.h \
- nb_kernel132_f77_double.h nb_kernel133_f77_double.h nb_kernel134_f77_double.h nb_kernel200_f77_double.h \
- nb_kernel201_f77_double.h nb_kernel202_f77_double.h nb_kernel203_f77_double.h nb_kernel204_f77_double.h \
- nb_kernel210_f77_double.h nb_kernel211_f77_double.h nb_kernel212_f77_double.h nb_kernel213_f77_double.h \
- nb_kernel214_f77_double.h nb_kernel220_f77_double.h nb_kernel221_f77_double.h nb_kernel222_f77_double.h \
- nb_kernel223_f77_double.h nb_kernel224_f77_double.h nb_kernel230_f77_double.h nb_kernel231_f77_double.h \
- nb_kernel232_f77_double.h nb_kernel233_f77_double.h nb_kernel234_f77_double.h nb_kernel300_f77_double.h \
- nb_kernel301_f77_double.h nb_kernel302_f77_double.h nb_kernel303_f77_double.h nb_kernel304_f77_double.h \
- nb_kernel310_f77_double.h nb_kernel311_f77_double.h nb_kernel312_f77_double.h nb_kernel313_f77_double.h \
- nb_kernel314_f77_double.h nb_kernel320_f77_double.h nb_kernel321_f77_double.h nb_kernel322_f77_double.h \
- nb_kernel323_f77_double.h nb_kernel324_f77_double.h nb_kernel330_f77_double.h nb_kernel331_f77_double.h \
- nb_kernel332_f77_double.h nb_kernel333_f77_double.h nb_kernel334_f77_double.h nb_kernel400_f77_double.h \
- nb_kernel410_f77_double.h nb_kernel420_f77_double.h nb_kernel430_f77_double.h \
- nb_kernel_f77_double.c nb_kernel_f77_double.h nb_kernel_f77sync.c \
- f77dkernel010.f f77dkernel020.f f77dkernel030.f f77dkernel100.f \
- f77dkernel101.f f77dkernel102.f f77dkernel103.f f77dkernel104.f \
- f77dkernel110.f f77dkernel111.f f77dkernel112.f f77dkernel113.f \
- f77dkernel114.f f77dkernel120.f f77dkernel121.f f77dkernel122.f \
- f77dkernel123.f f77dkernel124.f f77dkernel130.f f77dkernel131.f \
- f77dkernel132.f f77dkernel133.f f77dkernel134.f f77dkernel200.f \
- f77dkernel201.f f77dkernel202.f f77dkernel203.f f77dkernel204.f \
- f77dkernel210.f f77dkernel211.f f77dkernel212.f f77dkernel213.f \
- f77dkernel214.f f77dkernel220.f f77dkernel221.f f77dkernel222.f \
- f77dkernel223.f f77dkernel224.f f77dkernel230.f f77dkernel231.f \
- f77dkernel232.f f77dkernel233.f f77dkernel234.f f77dkernel300.f \
- f77dkernel301.f f77dkernel302.f f77dkernel303.f f77dkernel304.f \
- f77dkernel310.f f77dkernel311.f f77dkernel312.f f77dkernel313.f \
- f77dkernel314.f f77dkernel320.f f77dkernel321.f f77dkernel322.f \
- f77dkernel323.f f77dkernel324.f f77dkernel330.f f77dkernel331.f \
- f77dkernel332.f f77dkernel333.f f77dkernel334.f f77dkernel400.f \
- f77dkernel410.f f77dkernel420.f f77dkernel430.f
-
-
-
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-noinst_LTLIBRARIES = libnb_kernel_f77_single.la
-
-libnb_kernel_f77_single_la_SOURCES = \
- nb_kernel010_f77_single.c nb_kernel020_f77_single.c nb_kernel030_f77_single.c nb_kernel100_f77_single.c \
- nb_kernel101_f77_single.c nb_kernel102_f77_single.c nb_kernel103_f77_single.c nb_kernel104_f77_single.c \
- nb_kernel110_f77_single.c nb_kernel111_f77_single.c nb_kernel112_f77_single.c nb_kernel113_f77_single.c \
- nb_kernel114_f77_single.c nb_kernel120_f77_single.c nb_kernel121_f77_single.c nb_kernel122_f77_single.c \
- nb_kernel123_f77_single.c nb_kernel124_f77_single.c nb_kernel130_f77_single.c nb_kernel131_f77_single.c \
- nb_kernel132_f77_single.c nb_kernel133_f77_single.c nb_kernel134_f77_single.c nb_kernel200_f77_single.c \
- nb_kernel201_f77_single.c nb_kernel202_f77_single.c nb_kernel203_f77_single.c nb_kernel204_f77_single.c \
- nb_kernel210_f77_single.c nb_kernel211_f77_single.c nb_kernel212_f77_single.c nb_kernel213_f77_single.c \
- nb_kernel214_f77_single.c nb_kernel220_f77_single.c nb_kernel221_f77_single.c nb_kernel222_f77_single.c \
- nb_kernel223_f77_single.c nb_kernel224_f77_single.c nb_kernel230_f77_single.c nb_kernel231_f77_single.c \
- nb_kernel232_f77_single.c nb_kernel233_f77_single.c nb_kernel234_f77_single.c nb_kernel300_f77_single.c \
- nb_kernel301_f77_single.c nb_kernel302_f77_single.c nb_kernel303_f77_single.c nb_kernel304_f77_single.c \
- nb_kernel310_f77_single.c nb_kernel311_f77_single.c nb_kernel312_f77_single.c nb_kernel313_f77_single.c \
- nb_kernel314_f77_single.c nb_kernel320_f77_single.c nb_kernel321_f77_single.c nb_kernel322_f77_single.c \
- nb_kernel323_f77_single.c nb_kernel324_f77_single.c nb_kernel330_f77_single.c nb_kernel331_f77_single.c \
- nb_kernel332_f77_single.c nb_kernel333_f77_single.c nb_kernel334_f77_single.c nb_kernel400_f77_single.c \
- nb_kernel410_f77_single.c nb_kernel420_f77_single.c nb_kernel430_f77_single.c \
- nb_kernel010_f77_single.h nb_kernel020_f77_single.h nb_kernel030_f77_single.h nb_kernel100_f77_single.h \
- nb_kernel101_f77_single.h nb_kernel102_f77_single.h nb_kernel103_f77_single.h nb_kernel104_f77_single.h \
- nb_kernel110_f77_single.h nb_kernel111_f77_single.h nb_kernel112_f77_single.h nb_kernel113_f77_single.h \
- nb_kernel114_f77_single.h nb_kernel120_f77_single.h nb_kernel121_f77_single.h nb_kernel122_f77_single.h \
- nb_kernel123_f77_single.h nb_kernel124_f77_single.h nb_kernel130_f77_single.h nb_kernel131_f77_single.h \
- nb_kernel132_f77_single.h nb_kernel133_f77_single.h nb_kernel134_f77_single.h nb_kernel200_f77_single.h \
- nb_kernel201_f77_single.h nb_kernel202_f77_single.h nb_kernel203_f77_single.h nb_kernel204_f77_single.h \
- nb_kernel210_f77_single.h nb_kernel211_f77_single.h nb_kernel212_f77_single.h nb_kernel213_f77_single.h \
- nb_kernel214_f77_single.h nb_kernel220_f77_single.h nb_kernel221_f77_single.h nb_kernel222_f77_single.h \
- nb_kernel223_f77_single.h nb_kernel224_f77_single.h nb_kernel230_f77_single.h nb_kernel231_f77_single.h \
- nb_kernel232_f77_single.h nb_kernel233_f77_single.h nb_kernel234_f77_single.h nb_kernel300_f77_single.h \
- nb_kernel301_f77_single.h nb_kernel302_f77_single.h nb_kernel303_f77_single.h nb_kernel304_f77_single.h \
- nb_kernel310_f77_single.h nb_kernel311_f77_single.h nb_kernel312_f77_single.h nb_kernel313_f77_single.h \
- nb_kernel314_f77_single.h nb_kernel320_f77_single.h nb_kernel321_f77_single.h nb_kernel322_f77_single.h \
- nb_kernel323_f77_single.h nb_kernel324_f77_single.h nb_kernel330_f77_single.h nb_kernel331_f77_single.h \
- nb_kernel332_f77_single.h nb_kernel333_f77_single.h nb_kernel334_f77_single.h nb_kernel400_f77_single.h \
- nb_kernel410_f77_single.h nb_kernel420_f77_single.h nb_kernel430_f77_single.h \
- nb_kernel_f77_single.c nb_kernel_f77_single.h nb_kernel_f77sync.c \
- f77skernel010.f f77skernel020.f f77skernel030.f f77skernel100.f \
- f77skernel101.f f77skernel102.f f77skernel103.f f77skernel104.f \
- f77skernel110.f f77skernel111.f f77skernel112.f f77skernel113.f \
- f77skernel114.f f77skernel120.f f77skernel121.f f77skernel122.f \
- f77skernel123.f f77skernel124.f f77skernel130.f f77skernel131.f \
- f77skernel132.f f77skernel133.f f77skernel134.f f77skernel200.f \
- f77skernel201.f f77skernel202.f f77skernel203.f f77skernel204.f \
- f77skernel210.f f77skernel211.f f77skernel212.f f77skernel213.f \
- f77skernel214.f f77skernel220.f f77skernel221.f f77skernel222.f \
- f77skernel223.f f77skernel224.f f77skernel230.f f77skernel231.f \
- f77skernel232.f f77skernel233.f f77skernel234.f f77skernel300.f \
- f77skernel301.f f77skernel302.f f77skernel303.f f77skernel304.f \
- f77skernel310.f f77skernel311.f f77skernel312.f f77skernel313.f \
- f77skernel314.f f77skernel320.f f77skernel321.f f77skernel322.f \
- f77skernel323.f f77skernel324.f f77skernel330.f f77skernel331.f \
- f77skernel332.f f77skernel333.f f77skernel334.f f77skernel400.f \
- f77skernel410.f f77skernel420.f f77skernel430.f
-
-
-
-
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-noinst_LTLIBRARIES = libnb_kernel_ia32_sse.la
-
-libnb_kernel_ia32_sse_la_SOURCES = \
- nb_kernel010_ia32_sse.s nb_kernel010_ia32_sse.h \
- nb_kernel030_ia32_sse.s nb_kernel030_ia32_sse.h \
- nb_kernel100_ia32_sse.s nb_kernel100_ia32_sse.h \
- nb_kernel101_ia32_sse.s nb_kernel101_ia32_sse.h \
- nb_kernel102_ia32_sse.s nb_kernel102_ia32_sse.h \
- nb_kernel103_ia32_sse.s nb_kernel103_ia32_sse.h \
- nb_kernel104_ia32_sse.s nb_kernel104_ia32_sse.h \
- nb_kernel110_ia32_sse.s nb_kernel110_ia32_sse.h \
- nb_kernel111_ia32_sse.s nb_kernel111_ia32_sse.h \
- nb_kernel112_ia32_sse.s nb_kernel112_ia32_sse.h \
- nb_kernel113_ia32_sse.s nb_kernel113_ia32_sse.h \
- nb_kernel114_ia32_sse.s nb_kernel114_ia32_sse.h \
- nb_kernel130_ia32_sse.s nb_kernel130_ia32_sse.h \
- nb_kernel131_ia32_sse.s nb_kernel131_ia32_sse.h \
- nb_kernel132_ia32_sse.s nb_kernel132_ia32_sse.h \
- nb_kernel133_ia32_sse.s nb_kernel133_ia32_sse.h \
- nb_kernel134_ia32_sse.s nb_kernel134_ia32_sse.h \
- nb_kernel200_ia32_sse.s nb_kernel200_ia32_sse.h \
- nb_kernel201_ia32_sse.s nb_kernel201_ia32_sse.h \
- nb_kernel202_ia32_sse.s nb_kernel202_ia32_sse.h \
- nb_kernel203_ia32_sse.s nb_kernel203_ia32_sse.h \
- nb_kernel204_ia32_sse.s nb_kernel204_ia32_sse.h \
- nb_kernel210_ia32_sse.s nb_kernel210_ia32_sse.h \
- nb_kernel211_ia32_sse.s nb_kernel211_ia32_sse.h \
- nb_kernel212_ia32_sse.s nb_kernel212_ia32_sse.h \
- nb_kernel213_ia32_sse.s nb_kernel213_ia32_sse.h \
- nb_kernel214_ia32_sse.s nb_kernel214_ia32_sse.h \
- nb_kernel230_ia32_sse.s nb_kernel230_ia32_sse.h \
- nb_kernel231_ia32_sse.s nb_kernel231_ia32_sse.h \
- nb_kernel232_ia32_sse.s nb_kernel232_ia32_sse.h \
- nb_kernel233_ia32_sse.s nb_kernel233_ia32_sse.h \
- nb_kernel234_ia32_sse.s nb_kernel234_ia32_sse.h \
- nb_kernel300_ia32_sse.s nb_kernel300_ia32_sse.h \
- nb_kernel301_ia32_sse.s nb_kernel301_ia32_sse.h \
- nb_kernel302_ia32_sse.s nb_kernel302_ia32_sse.h \
- nb_kernel303_ia32_sse.s nb_kernel303_ia32_sse.h \
- nb_kernel304_ia32_sse.s nb_kernel304_ia32_sse.h \
- nb_kernel310_ia32_sse.s nb_kernel310_ia32_sse.h \
- nb_kernel311_ia32_sse.s nb_kernel311_ia32_sse.h \
- nb_kernel312_ia32_sse.s nb_kernel312_ia32_sse.h \
- nb_kernel313_ia32_sse.s nb_kernel313_ia32_sse.h \
- nb_kernel314_ia32_sse.s nb_kernel314_ia32_sse.h \
- nb_kernel330_ia32_sse.s nb_kernel330_ia32_sse.h \
- nb_kernel331_ia32_sse.s nb_kernel331_ia32_sse.h \
- nb_kernel332_ia32_sse.s nb_kernel332_ia32_sse.h \
- nb_kernel333_ia32_sse.s nb_kernel333_ia32_sse.h \
- nb_kernel334_ia32_sse.s nb_kernel334_ia32_sse.h \
- nb_kernel400_ia32_sse.c nb_kernel400_ia32_sse.h \
- nb_kernel410_ia32_sse.c nb_kernel410_ia32_sse.h \
- nb_kernel430_ia32_sse.c nb_kernel430_ia32_sse.h \
- nb_kernel_ia32_sse_test_asm.s nb_kernel_ia32_sse_test_asm.h \
- nb_kernel_ia32_sse.c nb_kernel_ia32_sse.h \
- nb_kernel_allvsall_sse2_single.c \
- nb_kernel_allvsall_sse2_single.h \
- nb_kernel_allvsallgb_sse2_single.c \
- nb_kernel_allvsallgb_sse2_single.h
-
-
-EXTRA_DIST = \
- nb_kernel010_ia32_sse_intel_syntax.s nb_kernel030_ia32_sse_intel_syntax.s \
- nb_kernel100_ia32_sse_intel_syntax.s nb_kernel101_ia32_sse_intel_syntax.s \
- nb_kernel102_ia32_sse_intel_syntax.s nb_kernel103_ia32_sse_intel_syntax.s \
- nb_kernel104_ia32_sse_intel_syntax.s nb_kernel110_ia32_sse_intel_syntax.s \
- nb_kernel111_ia32_sse_intel_syntax.s nb_kernel112_ia32_sse_intel_syntax.s \
- nb_kernel113_ia32_sse_intel_syntax.s nb_kernel114_ia32_sse_intel_syntax.s \
- nb_kernel130_ia32_sse_intel_syntax.s nb_kernel131_ia32_sse_intel_syntax.s \
- nb_kernel132_ia32_sse_intel_syntax.s nb_kernel133_ia32_sse_intel_syntax.s \
- nb_kernel134_ia32_sse_intel_syntax.s nb_kernel200_ia32_sse_intel_syntax.s \
- nb_kernel201_ia32_sse_intel_syntax.s nb_kernel202_ia32_sse_intel_syntax.s \
- nb_kernel203_ia32_sse_intel_syntax.s nb_kernel204_ia32_sse_intel_syntax.s \
- nb_kernel210_ia32_sse_intel_syntax.s nb_kernel211_ia32_sse_intel_syntax.s \
- nb_kernel212_ia32_sse_intel_syntax.s nb_kernel213_ia32_sse_intel_syntax.s \
- nb_kernel214_ia32_sse_intel_syntax.s nb_kernel230_ia32_sse_intel_syntax.s \
- nb_kernel231_ia32_sse_intel_syntax.s nb_kernel232_ia32_sse_intel_syntax.s \
- nb_kernel233_ia32_sse_intel_syntax.s nb_kernel234_ia32_sse_intel_syntax.s \
- nb_kernel300_ia32_sse_intel_syntax.s nb_kernel301_ia32_sse_intel_syntax.s \
- nb_kernel302_ia32_sse_intel_syntax.s nb_kernel303_ia32_sse_intel_syntax.s \
- nb_kernel304_ia32_sse_intel_syntax.s nb_kernel310_ia32_sse_intel_syntax.s \
- nb_kernel311_ia32_sse_intel_syntax.s nb_kernel312_ia32_sse_intel_syntax.s \
- nb_kernel313_ia32_sse_intel_syntax.s nb_kernel314_ia32_sse_intel_syntax.s \
- nb_kernel330_ia32_sse_intel_syntax.s nb_kernel331_ia32_sse_intel_syntax.s \
- nb_kernel332_ia32_sse_intel_syntax.s nb_kernel333_ia32_sse_intel_syntax.s \
- nb_kernel334_ia32_sse_intel_syntax.s nb_kernel_ia32_sse_test_asm_intel_syntax.s
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-noinst_LTLIBRARIES = libnb_kernel_ia32_sse2.la
-
-libnb_kernel_ia32_sse2_la_SOURCES = \
- nb_kernel010_ia32_sse2.s nb_kernel010_ia32_sse2.h \
- nb_kernel030_ia32_sse2.s nb_kernel030_ia32_sse2.h \
- nb_kernel100_ia32_sse2.s nb_kernel100_ia32_sse2.h \
- nb_kernel101_ia32_sse2.s nb_kernel101_ia32_sse2.h \
- nb_kernel102_ia32_sse2.s nb_kernel102_ia32_sse2.h \
- nb_kernel103_ia32_sse2.s nb_kernel103_ia32_sse2.h \
- nb_kernel104_ia32_sse2.s nb_kernel104_ia32_sse2.h \
- nb_kernel110_ia32_sse2.s nb_kernel110_ia32_sse2.h \
- nb_kernel111_ia32_sse2.s nb_kernel111_ia32_sse2.h \
- nb_kernel112_ia32_sse2.s nb_kernel112_ia32_sse2.h \
- nb_kernel113_ia32_sse2.s nb_kernel113_ia32_sse2.h \
- nb_kernel114_ia32_sse2.s nb_kernel114_ia32_sse2.h \
- nb_kernel130_ia32_sse2.s nb_kernel130_ia32_sse2.h \
- nb_kernel131_ia32_sse2.s nb_kernel131_ia32_sse2.h \
- nb_kernel132_ia32_sse2.s nb_kernel132_ia32_sse2.h \
- nb_kernel133_ia32_sse2.s nb_kernel133_ia32_sse2.h \
- nb_kernel134_ia32_sse2.s nb_kernel134_ia32_sse2.h \
- nb_kernel200_ia32_sse2.s nb_kernel200_ia32_sse2.h \
- nb_kernel201_ia32_sse2.s nb_kernel201_ia32_sse2.h \
- nb_kernel202_ia32_sse2.s nb_kernel202_ia32_sse2.h \
- nb_kernel203_ia32_sse2.s nb_kernel203_ia32_sse2.h \
- nb_kernel204_ia32_sse2.s nb_kernel204_ia32_sse2.h \
- nb_kernel210_ia32_sse2.s nb_kernel210_ia32_sse2.h \
- nb_kernel211_ia32_sse2.s nb_kernel211_ia32_sse2.h \
- nb_kernel212_ia32_sse2.s nb_kernel212_ia32_sse2.h \
- nb_kernel213_ia32_sse2.s nb_kernel213_ia32_sse2.h \
- nb_kernel214_ia32_sse2.s nb_kernel214_ia32_sse2.h \
- nb_kernel230_ia32_sse2.s nb_kernel230_ia32_sse2.h \
- nb_kernel231_ia32_sse2.s nb_kernel231_ia32_sse2.h \
- nb_kernel232_ia32_sse2.s nb_kernel232_ia32_sse2.h \
- nb_kernel233_ia32_sse2.s nb_kernel233_ia32_sse2.h \
- nb_kernel234_ia32_sse2.s nb_kernel234_ia32_sse2.h \
- nb_kernel300_ia32_sse2.s nb_kernel300_ia32_sse2.h \
- nb_kernel301_ia32_sse2.s nb_kernel301_ia32_sse2.h \
- nb_kernel302_ia32_sse2.s nb_kernel302_ia32_sse2.h \
- nb_kernel303_ia32_sse2.s nb_kernel303_ia32_sse2.h \
- nb_kernel304_ia32_sse2.s nb_kernel304_ia32_sse2.h \
- nb_kernel310_ia32_sse2.s nb_kernel310_ia32_sse2.h \
- nb_kernel311_ia32_sse2.s nb_kernel311_ia32_sse2.h \
- nb_kernel312_ia32_sse2.s nb_kernel312_ia32_sse2.h \
- nb_kernel313_ia32_sse2.s nb_kernel313_ia32_sse2.h \
- nb_kernel314_ia32_sse2.s nb_kernel314_ia32_sse2.h \
- nb_kernel330_ia32_sse2.s nb_kernel330_ia32_sse2.h \
- nb_kernel331_ia32_sse2.s nb_kernel331_ia32_sse2.h \
- nb_kernel332_ia32_sse2.s nb_kernel332_ia32_sse2.h \
- nb_kernel333_ia32_sse2.s nb_kernel333_ia32_sse2.h \
- nb_kernel334_ia32_sse2.s nb_kernel334_ia32_sse2.h \
- nb_kernel400_ia32_sse2.c nb_kernel400_ia32_sse2.h \
- nb_kernel410_ia32_sse2.c nb_kernel410_ia32_sse2.h \
- nb_kernel430_ia32_sse2.c nb_kernel430_ia32_sse2.h \
- nb_kernel_ia32_sse2_test_asm.s nb_kernel_ia32_sse2_test_asm.h \
- nb_kernel_ia32_sse2.c nb_kernel_ia32_sse2.h \
- nb_kernel_allvsall_sse2_double.c \
- nb_kernel_allvsall_sse2_double.h \
- nb_kernel_allvsallgb_sse2_double.c \
- nb_kernel_allvsallgb_sse2_double.h
-
-
-EXTRA_DIST = \
- nb_kernel010_ia32_sse2_intel_syntax.s nb_kernel030_ia32_sse2_intel_syntax.s \
- nb_kernel100_ia32_sse2_intel_syntax.s nb_kernel101_ia32_sse2_intel_syntax.s \
- nb_kernel102_ia32_sse2_intel_syntax.s nb_kernel103_ia32_sse2_intel_syntax.s \
- nb_kernel104_ia32_sse2_intel_syntax.s nb_kernel110_ia32_sse2_intel_syntax.s \
- nb_kernel111_ia32_sse2_intel_syntax.s nb_kernel112_ia32_sse2_intel_syntax.s \
- nb_kernel113_ia32_sse2_intel_syntax.s nb_kernel114_ia32_sse2_intel_syntax.s \
- nb_kernel130_ia32_sse2_intel_syntax.s nb_kernel131_ia32_sse2_intel_syntax.s \
- nb_kernel132_ia32_sse2_intel_syntax.s nb_kernel133_ia32_sse2_intel_syntax.s \
- nb_kernel134_ia32_sse2_intel_syntax.s nb_kernel200_ia32_sse2_intel_syntax.s \
- nb_kernel201_ia32_sse2_intel_syntax.s nb_kernel202_ia32_sse2_intel_syntax.s \
- nb_kernel203_ia32_sse2_intel_syntax.s nb_kernel204_ia32_sse2_intel_syntax.s \
- nb_kernel210_ia32_sse2_intel_syntax.s nb_kernel211_ia32_sse2_intel_syntax.s \
- nb_kernel212_ia32_sse2_intel_syntax.s nb_kernel213_ia32_sse2_intel_syntax.s \
- nb_kernel214_ia32_sse2_intel_syntax.s nb_kernel230_ia32_sse2_intel_syntax.s \
- nb_kernel231_ia32_sse2_intel_syntax.s nb_kernel232_ia32_sse2_intel_syntax.s \
- nb_kernel233_ia32_sse2_intel_syntax.s nb_kernel234_ia32_sse2_intel_syntax.s \
- nb_kernel300_ia32_sse2_intel_syntax.s nb_kernel301_ia32_sse2_intel_syntax.s \
- nb_kernel302_ia32_sse2_intel_syntax.s nb_kernel303_ia32_sse2_intel_syntax.s \
- nb_kernel304_ia32_sse2_intel_syntax.s nb_kernel310_ia32_sse2_intel_syntax.s \
- nb_kernel311_ia32_sse2_intel_syntax.s nb_kernel312_ia32_sse2_intel_syntax.s \
- nb_kernel313_ia32_sse2_intel_syntax.s nb_kernel314_ia32_sse2_intel_syntax.s \
- nb_kernel330_ia32_sse2_intel_syntax.s nb_kernel331_ia32_sse2_intel_syntax.s \
- nb_kernel332_ia32_sse2_intel_syntax.s nb_kernel333_ia32_sse2_intel_syntax.s \
- nb_kernel334_ia32_sse2_intel_syntax.s nb_kernel_ia32_sse2_test_asm_intel_syntax.s
-
-
-
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-noinst_LTLIBRARIES = libnb_kernel_ia64_double.la
-
-libnb_kernel_ia64_double_la_SOURCES = \
- nb_kernel010_ia64_double.S nb_kernel010_ia64_double.h \
- nb_kernel030_ia64_double.S nb_kernel030_ia64_double.h \
- nb_kernel100_ia64_double.S nb_kernel100_ia64_double.h \
- nb_kernel110_ia64_double.S nb_kernel110_ia64_double.h \
- nb_kernel130_ia64_double.S nb_kernel130_ia64_double.h \
- nb_kernel200_ia64_double.S nb_kernel200_ia64_double.h \
- nb_kernel210_ia64_double.S nb_kernel210_ia64_double.h \
- nb_kernel230_ia64_double.S nb_kernel230_ia64_double.h \
- nb_kernel300_ia64_double.S nb_kernel300_ia64_double.h \
- nb_kernel310_ia64_double.S nb_kernel310_ia64_double.h \
- nb_kernel330_ia64_double.S nb_kernel330_ia64_double.h \
- nb_kernel400_ia64_double.S nb_kernel400_ia64_double.h \
- nb_kernel410_ia64_double.S nb_kernel410_ia64_double.h \
- nb_kernel430_ia64_double.S nb_kernel430_ia64_double.h \
- nb_kernel010nf_ia64_double.S nb_kernel010nf_ia64_double.h \
- nb_kernel030nf_ia64_double.S nb_kernel030nf_ia64_double.h \
- nb_kernel100nf_ia64_double.S nb_kernel100nf_ia64_double.h \
- nb_kernel110nf_ia64_double.S nb_kernel110nf_ia64_double.h \
- nb_kernel130nf_ia64_double.S nb_kernel130nf_ia64_double.h \
- nb_kernel200nf_ia64_double.S nb_kernel200nf_ia64_double.h \
- nb_kernel210nf_ia64_double.S nb_kernel210nf_ia64_double.h \
- nb_kernel230nf_ia64_double.S nb_kernel230nf_ia64_double.h \
- nb_kernel300nf_ia64_double.S nb_kernel300nf_ia64_double.h \
- nb_kernel310nf_ia64_double.S nb_kernel310nf_ia64_double.h \
- nb_kernel330nf_ia64_double.S nb_kernel330nf_ia64_double.h \
- nb_kernel400nf_ia64_double.S nb_kernel400nf_ia64_double.h \
- nb_kernel410nf_ia64_double.S nb_kernel410nf_ia64_double.h \
- nb_kernel430nf_ia64_double.S nb_kernel430nf_ia64_double.h \
- ia64_cpuid.S ia64_cpuid.h \
- nb_kernel_ia64_double.c nb_kernel_ia64_double.h
-
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-noinst_LTLIBRARIES = libnb_kernel_ia64_single.la
-
-libnb_kernel_ia64_single_la_SOURCES = \
- nb_kernel010_ia64_single.S nb_kernel010_ia64_single.h \
- nb_kernel030_ia64_single.S nb_kernel030_ia64_single.h \
- nb_kernel100_ia64_single.S nb_kernel100_ia64_single.h \
- nb_kernel110_ia64_single.S nb_kernel110_ia64_single.h \
- nb_kernel130_ia64_single.S nb_kernel130_ia64_single.h \
- nb_kernel200_ia64_single.S nb_kernel200_ia64_single.h \
- nb_kernel210_ia64_single.S nb_kernel210_ia64_single.h \
- nb_kernel230_ia64_single.S nb_kernel230_ia64_single.h \
- nb_kernel300_ia64_single.S nb_kernel300_ia64_single.h \
- nb_kernel310_ia64_single.S nb_kernel310_ia64_single.h \
- nb_kernel330_ia64_single.S nb_kernel330_ia64_single.h \
- nb_kernel400_ia64_single.S nb_kernel400_ia64_single.h \
- nb_kernel410_ia64_single.S nb_kernel410_ia64_single.h \
- nb_kernel430_ia64_single.S nb_kernel430_ia64_single.h \
- nb_kernel010nf_ia64_single.S nb_kernel010nf_ia64_single.h \
- nb_kernel030nf_ia64_single.S nb_kernel030nf_ia64_single.h \
- nb_kernel100nf_ia64_single.S nb_kernel100nf_ia64_single.h \
- nb_kernel130nf_ia64_single.S nb_kernel130nf_ia64_single.h \
- nb_kernel110nf_ia64_single.S nb_kernel110nf_ia64_single.h \
- nb_kernel200nf_ia64_single.S nb_kernel200nf_ia64_single.h \
- nb_kernel210nf_ia64_single.S nb_kernel210nf_ia64_single.h \
- nb_kernel230nf_ia64_single.S nb_kernel230nf_ia64_single.h \
- nb_kernel300nf_ia64_single.S nb_kernel300nf_ia64_single.h \
- nb_kernel310nf_ia64_single.S nb_kernel310nf_ia64_single.h \
- nb_kernel330nf_ia64_single.S nb_kernel330nf_ia64_single.h \
- nb_kernel400nf_ia64_single.S nb_kernel400nf_ia64_single.h \
- nb_kernel410nf_ia64_single.S nb_kernel410nf_ia64_single.h \
- nb_kernel430nf_ia64_single.S nb_kernel430nf_ia64_single.h \
- ia64_cpuid.S ia64_cpuid.h \
- nb_kernel_ia64_single.c nb_kernel_ia64_single.h
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-noinst_LTLIBRARIES = libnb_kernel_power6.la
-
-libnb_kernel_power6_la_SOURCES = \
- nb_kernel010_power6.c nb_kernel020_power6.c nb_kernel030_power6.c nb_kernel100_power6.c \
- nb_kernel101_power6.c nb_kernel102_power6.c nb_kernel103_power6.c nb_kernel104_power6.c \
- nb_kernel110_power6.c nb_kernel111_power6.c nb_kernel112_power6.c nb_kernel113_power6.c \
- nb_kernel114_power6.c nb_kernel120_power6.c nb_kernel121_power6.c nb_kernel122_power6.c \
- nb_kernel123_power6.c nb_kernel124_power6.c nb_kernel130_power6.c nb_kernel131_power6.c \
- nb_kernel132_power6.c nb_kernel133_power6.c nb_kernel134_power6.c nb_kernel200_power6.c \
- nb_kernel201_power6.c nb_kernel202_power6.c nb_kernel203_power6.c nb_kernel204_power6.c \
- nb_kernel210_power6.c nb_kernel211_power6.c nb_kernel212_power6.c nb_kernel213_power6.c \
- nb_kernel214_power6.c nb_kernel220_power6.c nb_kernel221_power6.c nb_kernel222_power6.c \
- nb_kernel223_power6.c nb_kernel224_power6.c nb_kernel230_power6.c nb_kernel231_power6.c \
- nb_kernel232_power6.c nb_kernel233_power6.c nb_kernel234_power6.c nb_kernel300_power6.c \
- nb_kernel301_power6.c nb_kernel302_power6.c nb_kernel303_power6.c nb_kernel304_power6.c \
- nb_kernel310_power6.c nb_kernel311_power6.c nb_kernel312_power6.c nb_kernel313_power6.c \
- nb_kernel314_power6.c nb_kernel320_power6.c nb_kernel321_power6.c nb_kernel322_power6.c \
- nb_kernel323_power6.c nb_kernel324_power6.c nb_kernel330_power6.c nb_kernel331_power6.c \
- nb_kernel332_power6.c nb_kernel333_power6.c nb_kernel334_power6.c nb_kernel400_power6.c \
- nb_kernel410_power6.c nb_kernel420_power6.c nb_kernel430_power6.c \
- nb_kernel010_power6.h nb_kernel020_power6.h nb_kernel030_power6.h nb_kernel100_power6.h \
- nb_kernel101_power6.h nb_kernel102_power6.h nb_kernel103_power6.h nb_kernel104_power6.h \
- nb_kernel110_power6.h nb_kernel111_power6.h nb_kernel112_power6.h nb_kernel113_power6.h \
- nb_kernel114_power6.h nb_kernel120_power6.h nb_kernel121_power6.h nb_kernel122_power6.h \
- nb_kernel123_power6.h nb_kernel124_power6.h nb_kernel130_power6.h nb_kernel131_power6.h \
- nb_kernel132_power6.h nb_kernel133_power6.h nb_kernel134_power6.h nb_kernel200_power6.h \
- nb_kernel201_power6.h nb_kernel202_power6.h nb_kernel203_power6.h nb_kernel204_power6.h \
- nb_kernel210_power6.h nb_kernel211_power6.h nb_kernel212_power6.h nb_kernel213_power6.h \
- nb_kernel214_power6.h nb_kernel220_power6.h nb_kernel221_power6.h nb_kernel222_power6.h \
- nb_kernel223_power6.h nb_kernel224_power6.h nb_kernel230_power6.h nb_kernel231_power6.h \
- nb_kernel232_power6.h nb_kernel233_power6.h nb_kernel234_power6.h nb_kernel300_power6.h \
- nb_kernel301_power6.h nb_kernel302_power6.h nb_kernel303_power6.h nb_kernel304_power6.h \
- nb_kernel310_power6.h nb_kernel311_power6.h nb_kernel312_power6.h nb_kernel313_power6.h \
- nb_kernel314_power6.h nb_kernel320_power6.h nb_kernel321_power6.h nb_kernel322_power6.h \
- nb_kernel323_power6.h nb_kernel324_power6.h nb_kernel330_power6.h nb_kernel331_power6.h \
- nb_kernel332_power6.h nb_kernel333_power6.h nb_kernel334_power6.h nb_kernel400_power6.h \
- nb_kernel410_power6.h nb_kernel420_power6.h nb_kernel430_power6.h \
- nb_kernel_power6.c nb_kernel_power6.h nb_kernel_pwr6sync.c \
- pwr6kernel010.F pwr6kernel020.F pwr6kernel030.F pwr6kernel100.F \
- pwr6kernel101.F pwr6kernel102.F pwr6kernel103.F pwr6kernel104.F \
- pwr6kernel110.F pwr6kernel111.F pwr6kernel112.F pwr6kernel113.F \
- pwr6kernel114.F pwr6kernel120.F pwr6kernel121.F pwr6kernel122.F \
- pwr6kernel123.F pwr6kernel124.F pwr6kernel130.F pwr6kernel131.F \
- pwr6kernel132.F pwr6kernel133.F pwr6kernel134.F pwr6kernel200.F \
- pwr6kernel201.F pwr6kernel202.F pwr6kernel203.F pwr6kernel204.F \
- pwr6kernel210.F pwr6kernel211.F pwr6kernel212.F pwr6kernel213.F \
- pwr6kernel214.F pwr6kernel220.F pwr6kernel221.F pwr6kernel222.F \
- pwr6kernel223.F pwr6kernel224.F pwr6kernel230.F pwr6kernel231.F \
- pwr6kernel232.F pwr6kernel233.F pwr6kernel234.F pwr6kernel300.F \
- pwr6kernel301.F pwr6kernel302.F pwr6kernel303.F pwr6kernel304.F \
- pwr6kernel310.F pwr6kernel311.F pwr6kernel312.F pwr6kernel313.F \
- pwr6kernel314.F pwr6kernel320.F pwr6kernel321.F pwr6kernel322.F \
- pwr6kernel323.F pwr6kernel324.F pwr6kernel330.F pwr6kernel331.F \
- pwr6kernel332.F pwr6kernel333.F pwr6kernel334.F pwr6kernel400.F \
- pwr6kernel410.F pwr6kernel420.F pwr6kernel430.F
-
-
-
-
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-noinst_LTLIBRARIES = libnb_kernel_ppc_altivec.la
-
-libnb_kernel_ppc_altivec_la_SOURCES = \
- nb_kernel010_ppc_altivec.c nb_kernel010_ppc_altivec.h \
- nb_kernel030_ppc_altivec.c nb_kernel030_ppc_altivec.h \
- nb_kernel100_ppc_altivec.c nb_kernel100_ppc_altivec.h \
- nb_kernel101_ppc_altivec.c nb_kernel101_ppc_altivec.h \
- nb_kernel102_ppc_altivec.c nb_kernel102_ppc_altivec.h \
- nb_kernel103_ppc_altivec.c nb_kernel103_ppc_altivec.h \
- nb_kernel104_ppc_altivec.c nb_kernel104_ppc_altivec.h \
- nb_kernel110_ppc_altivec.c nb_kernel110_ppc_altivec.h \
- nb_kernel111_ppc_altivec.c nb_kernel111_ppc_altivec.h \
- nb_kernel112_ppc_altivec.c nb_kernel112_ppc_altivec.h \
- nb_kernel113_ppc_altivec.c nb_kernel113_ppc_altivec.h \
- nb_kernel114_ppc_altivec.c nb_kernel114_ppc_altivec.h \
- nb_kernel130_ppc_altivec.c nb_kernel130_ppc_altivec.h \
- nb_kernel131_ppc_altivec.c nb_kernel131_ppc_altivec.h \
- nb_kernel132_ppc_altivec.c nb_kernel132_ppc_altivec.h \
- nb_kernel133_ppc_altivec.c nb_kernel133_ppc_altivec.h \
- nb_kernel134_ppc_altivec.c nb_kernel134_ppc_altivec.h \
- nb_kernel200_ppc_altivec.c nb_kernel200_ppc_altivec.h \
- nb_kernel201_ppc_altivec.c nb_kernel201_ppc_altivec.h \
- nb_kernel202_ppc_altivec.c nb_kernel202_ppc_altivec.h \
- nb_kernel203_ppc_altivec.c nb_kernel203_ppc_altivec.h \
- nb_kernel204_ppc_altivec.c nb_kernel204_ppc_altivec.h \
- nb_kernel210_ppc_altivec.c nb_kernel210_ppc_altivec.h \
- nb_kernel211_ppc_altivec.c nb_kernel211_ppc_altivec.h \
- nb_kernel212_ppc_altivec.c nb_kernel212_ppc_altivec.h \
- nb_kernel213_ppc_altivec.c nb_kernel213_ppc_altivec.h \
- nb_kernel214_ppc_altivec.c nb_kernel214_ppc_altivec.h \
- nb_kernel230_ppc_altivec.c nb_kernel230_ppc_altivec.h \
- nb_kernel231_ppc_altivec.c nb_kernel231_ppc_altivec.h \
- nb_kernel232_ppc_altivec.c nb_kernel232_ppc_altivec.h \
- nb_kernel233_ppc_altivec.c nb_kernel233_ppc_altivec.h \
- nb_kernel234_ppc_altivec.c nb_kernel234_ppc_altivec.h \
- nb_kernel300_ppc_altivec.c nb_kernel300_ppc_altivec.h \
- nb_kernel301_ppc_altivec.c nb_kernel301_ppc_altivec.h \
- nb_kernel302_ppc_altivec.c nb_kernel302_ppc_altivec.h \
- nb_kernel303_ppc_altivec.c nb_kernel303_ppc_altivec.h \
- nb_kernel304_ppc_altivec.c nb_kernel304_ppc_altivec.h \
- nb_kernel310_ppc_altivec.c nb_kernel310_ppc_altivec.h \
- nb_kernel311_ppc_altivec.c nb_kernel311_ppc_altivec.h \
- nb_kernel312_ppc_altivec.c nb_kernel312_ppc_altivec.h \
- nb_kernel313_ppc_altivec.c nb_kernel313_ppc_altivec.h \
- nb_kernel314_ppc_altivec.c nb_kernel314_ppc_altivec.h \
- nb_kernel330_ppc_altivec.c nb_kernel330_ppc_altivec.h \
- nb_kernel331_ppc_altivec.c nb_kernel331_ppc_altivec.h \
- nb_kernel332_ppc_altivec.c nb_kernel332_ppc_altivec.h \
- nb_kernel333_ppc_altivec.c nb_kernel333_ppc_altivec.h \
- nb_kernel334_ppc_altivec.c nb_kernel334_ppc_altivec.h \
- nb_kernel400_ppc_altivec.c nb_kernel400_ppc_altivec.h \
- nb_kernel410_ppc_altivec.c nb_kernel410_ppc_altivec.h \
- nb_kernel430_ppc_altivec.c nb_kernel430_ppc_altivec.h \
- ppc_altivec_util.h \
- nb_kernel_ppc_altivec.c nb_kernel_ppc_altivec.h \
- nb_kernel_ppc_altivec_test.c \
- nb_kernel_ppc_altivec_test.h
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-noinst_LTLIBRARIES = libnb_kernel_sse2_double.la
-
-libnb_kernel_sse2_double_la_SOURCES = \
- nb_kernel400_sse2_double.c nb_kernel400_sse2_double.h \
- nb_kernel410_sse2_double.c nb_kernel410_sse2_double.h \
- nb_kernel430_sse2_double.c nb_kernel430_sse2_double.h \
- nb_kernel_sse2_double.c nb_kernel_sse2_double.h
-
-
-
-
-
/* get gmx_gbdata_t */
#include "../nb_kerneltype.h"
-#include "nb_kernel430_x86_64_sse2.h"
+#include "../nb_kernel_x86_64_sse2/nb_kernel430_x86_64_sse2.h"
void nb_kernel430_sse2_double(int * p_nri,
int * iinr,
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-noinst_LTLIBRARIES = libnb_kernel_sse2_single.la
-
-libnb_kernel_sse2_single_la_SOURCES = \
- nb_kernel400_sse2_single.c nb_kernel400_sse2_single.h \
- nb_kernel410_sse2_single.c nb_kernel410_sse2_single.h \
- nb_kernel430_sse2_single.c nb_kernel430_sse2_single.h \
- nb_kernel_sse2_single.c nb_kernel_sse2_single.h
-
-
-
-
-
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-noinst_LTLIBRARIES = libnb_kernel_x86_64_sse.la
-
-libnb_kernel_x86_64_sse_la_SOURCES = \
- nb_kernel010_x86_64_sse.s nb_kernel010_x86_64_sse.h \
- nb_kernel030_x86_64_sse.s nb_kernel030_x86_64_sse.h \
- nb_kernel100_x86_64_sse.s nb_kernel100_x86_64_sse.h \
- nb_kernel101_x86_64_sse.s nb_kernel101_x86_64_sse.h \
- nb_kernel102_x86_64_sse.s nb_kernel102_x86_64_sse.h \
- nb_kernel103_x86_64_sse.s nb_kernel103_x86_64_sse.h \
- nb_kernel104_x86_64_sse.s nb_kernel104_x86_64_sse.h \
- nb_kernel110_x86_64_sse.s nb_kernel110_x86_64_sse.h \
- nb_kernel111_x86_64_sse.s nb_kernel111_x86_64_sse.h \
- nb_kernel112_x86_64_sse.s nb_kernel112_x86_64_sse.h \
- nb_kernel113_x86_64_sse.s nb_kernel113_x86_64_sse.h \
- nb_kernel114_x86_64_sse.s nb_kernel114_x86_64_sse.h \
- nb_kernel130_x86_64_sse.s nb_kernel130_x86_64_sse.h \
- nb_kernel131_x86_64_sse.s nb_kernel131_x86_64_sse.h \
- nb_kernel132_x86_64_sse.s nb_kernel132_x86_64_sse.h \
- nb_kernel133_x86_64_sse.s nb_kernel133_x86_64_sse.h \
- nb_kernel134_x86_64_sse.s nb_kernel134_x86_64_sse.h \
- nb_kernel200_x86_64_sse.s nb_kernel200_x86_64_sse.h \
- nb_kernel201_x86_64_sse.s nb_kernel201_x86_64_sse.h \
- nb_kernel202_x86_64_sse.s nb_kernel202_x86_64_sse.h \
- nb_kernel203_x86_64_sse.s nb_kernel203_x86_64_sse.h \
- nb_kernel204_x86_64_sse.s nb_kernel204_x86_64_sse.h \
- nb_kernel210_x86_64_sse.s nb_kernel210_x86_64_sse.h \
- nb_kernel211_x86_64_sse.s nb_kernel211_x86_64_sse.h \
- nb_kernel212_x86_64_sse.s nb_kernel212_x86_64_sse.h \
- nb_kernel213_x86_64_sse.s nb_kernel213_x86_64_sse.h \
- nb_kernel214_x86_64_sse.s nb_kernel214_x86_64_sse.h \
- nb_kernel230_x86_64_sse.s nb_kernel230_x86_64_sse.h \
- nb_kernel231_x86_64_sse.s nb_kernel231_x86_64_sse.h \
- nb_kernel232_x86_64_sse.s nb_kernel232_x86_64_sse.h \
- nb_kernel233_x86_64_sse.s nb_kernel233_x86_64_sse.h \
- nb_kernel234_x86_64_sse.s nb_kernel234_x86_64_sse.h \
- nb_kernel300_x86_64_sse.s nb_kernel300_x86_64_sse.h \
- nb_kernel301_x86_64_sse.s nb_kernel301_x86_64_sse.h \
- nb_kernel302_x86_64_sse.s nb_kernel302_x86_64_sse.h \
- nb_kernel303_x86_64_sse.s nb_kernel303_x86_64_sse.h \
- nb_kernel304_x86_64_sse.s nb_kernel304_x86_64_sse.h \
- nb_kernel310_x86_64_sse.s nb_kernel310_x86_64_sse.h \
- nb_kernel311_x86_64_sse.s nb_kernel311_x86_64_sse.h \
- nb_kernel312_x86_64_sse.s nb_kernel312_x86_64_sse.h \
- nb_kernel313_x86_64_sse.s nb_kernel313_x86_64_sse.h \
- nb_kernel314_x86_64_sse.s nb_kernel314_x86_64_sse.h \
- nb_kernel330_x86_64_sse.s nb_kernel330_x86_64_sse.h \
- nb_kernel331_x86_64_sse.s nb_kernel331_x86_64_sse.h \
- nb_kernel332_x86_64_sse.s nb_kernel332_x86_64_sse.h \
- nb_kernel333_x86_64_sse.s nb_kernel333_x86_64_sse.h \
- nb_kernel334_x86_64_sse.s nb_kernel334_x86_64_sse.h \
- nb_kernel400_x86_64_sse.c nb_kernel400_x86_64_sse.h \
- nb_kernel410_x86_64_sse.c nb_kernel410_x86_64_sse.h \
- nb_kernel430_x86_64_sse.c nb_kernel430_x86_64_sse.h \
- nb_kernel_x86_64_sse.c nb_kernel_x86_64_sse.h \
- nb_kernel_x86_64_sse_test_asm.s nb_kernel_x86_64_sse_test_asm.h \
- nb_kernel_allvsall_sse2_single.c nb_kernel_allvsall_sse2_single.h \
- nb_kernel_allvsallgb_sse2_single.c nb_kernel_allvsallgb_sse2_single.h
-
-
-
-EXTRA_DIST = \
- nb_kernel010_x86_64_sse_intel_syntax.s nb_kernel030_x86_64_sse_intel_syntax.s \
- nb_kernel100_x86_64_sse_intel_syntax.s nb_kernel101_x86_64_sse_intel_syntax.s \
- nb_kernel102_x86_64_sse_intel_syntax.s nb_kernel103_x86_64_sse_intel_syntax.s \
- nb_kernel104_x86_64_sse_intel_syntax.s nb_kernel110_x86_64_sse_intel_syntax.s \
- nb_kernel111_x86_64_sse_intel_syntax.s nb_kernel112_x86_64_sse_intel_syntax.s \
- nb_kernel113_x86_64_sse_intel_syntax.s nb_kernel114_x86_64_sse_intel_syntax.s \
- nb_kernel130_x86_64_sse_intel_syntax.s nb_kernel131_x86_64_sse_intel_syntax.s \
- nb_kernel132_x86_64_sse_intel_syntax.s nb_kernel133_x86_64_sse_intel_syntax.s \
- nb_kernel134_x86_64_sse_intel_syntax.s nb_kernel200_x86_64_sse_intel_syntax.s \
- nb_kernel201_x86_64_sse_intel_syntax.s nb_kernel202_x86_64_sse_intel_syntax.s \
- nb_kernel203_x86_64_sse_intel_syntax.s nb_kernel204_x86_64_sse_intel_syntax.s \
- nb_kernel210_x86_64_sse_intel_syntax.s nb_kernel211_x86_64_sse_intel_syntax.s \
- nb_kernel212_x86_64_sse_intel_syntax.s nb_kernel213_x86_64_sse_intel_syntax.s \
- nb_kernel214_x86_64_sse_intel_syntax.s nb_kernel230_x86_64_sse_intel_syntax.s \
- nb_kernel231_x86_64_sse_intel_syntax.s nb_kernel232_x86_64_sse_intel_syntax.s \
- nb_kernel233_x86_64_sse_intel_syntax.s nb_kernel234_x86_64_sse_intel_syntax.s \
- nb_kernel300_x86_64_sse_intel_syntax.s nb_kernel301_x86_64_sse_intel_syntax.s \
- nb_kernel302_x86_64_sse_intel_syntax.s nb_kernel303_x86_64_sse_intel_syntax.s \
- nb_kernel304_x86_64_sse_intel_syntax.s nb_kernel310_x86_64_sse_intel_syntax.s \
- nb_kernel311_x86_64_sse_intel_syntax.s nb_kernel312_x86_64_sse_intel_syntax.s \
- nb_kernel313_x86_64_sse_intel_syntax.s nb_kernel314_x86_64_sse_intel_syntax.s \
- nb_kernel330_x86_64_sse_intel_syntax.s nb_kernel331_x86_64_sse_intel_syntax.s \
- nb_kernel332_x86_64_sse_intel_syntax.s nb_kernel333_x86_64_sse_intel_syntax.s \
- nb_kernel334_x86_64_sse_intel_syntax.s nb_kernel_x86_64_sse_test_asm_intel_syntax.s
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-
-AM_CPPFLAGS= -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-noinst_LTLIBRARIES = libnb_kernel_x86_64_sse2.la
-
-libnb_kernel_x86_64_sse2_la_SOURCES = \
- nb_kernel010_x86_64_sse2.s nb_kernel010_x86_64_sse2.h \
- nb_kernel030_x86_64_sse2.s nb_kernel030_x86_64_sse2.h \
- nb_kernel100_x86_64_sse2.s nb_kernel100_x86_64_sse2.h \
- nb_kernel101_x86_64_sse2.s nb_kernel101_x86_64_sse2.h \
- nb_kernel102_x86_64_sse2.s nb_kernel102_x86_64_sse2.h \
- nb_kernel103_x86_64_sse2.s nb_kernel103_x86_64_sse2.h \
- nb_kernel104_x86_64_sse2.s nb_kernel104_x86_64_sse2.h \
- nb_kernel110_x86_64_sse2.s nb_kernel110_x86_64_sse2.h \
- nb_kernel111_x86_64_sse2.s nb_kernel111_x86_64_sse2.h \
- nb_kernel112_x86_64_sse2.s nb_kernel112_x86_64_sse2.h \
- nb_kernel113_x86_64_sse2.s nb_kernel113_x86_64_sse2.h \
- nb_kernel114_x86_64_sse2.s nb_kernel114_x86_64_sse2.h \
- nb_kernel130_x86_64_sse2.s nb_kernel130_x86_64_sse2.h \
- nb_kernel131_x86_64_sse2.s nb_kernel131_x86_64_sse2.h \
- nb_kernel132_x86_64_sse2.s nb_kernel132_x86_64_sse2.h \
- nb_kernel133_x86_64_sse2.s nb_kernel133_x86_64_sse2.h \
- nb_kernel134_x86_64_sse2.s nb_kernel134_x86_64_sse2.h \
- nb_kernel200_x86_64_sse2.s nb_kernel200_x86_64_sse2.h \
- nb_kernel201_x86_64_sse2.s nb_kernel201_x86_64_sse2.h \
- nb_kernel202_x86_64_sse2.s nb_kernel202_x86_64_sse2.h \
- nb_kernel203_x86_64_sse2.s nb_kernel203_x86_64_sse2.h \
- nb_kernel204_x86_64_sse2.s nb_kernel204_x86_64_sse2.h \
- nb_kernel210_x86_64_sse2.s nb_kernel210_x86_64_sse2.h \
- nb_kernel211_x86_64_sse2.s nb_kernel211_x86_64_sse2.h \
- nb_kernel212_x86_64_sse2.s nb_kernel212_x86_64_sse2.h \
- nb_kernel213_x86_64_sse2.s nb_kernel213_x86_64_sse2.h \
- nb_kernel214_x86_64_sse2.s nb_kernel214_x86_64_sse2.h \
- nb_kernel230_x86_64_sse2.s nb_kernel230_x86_64_sse2.h \
- nb_kernel231_x86_64_sse2.s nb_kernel231_x86_64_sse2.h \
- nb_kernel232_x86_64_sse2.s nb_kernel232_x86_64_sse2.h \
- nb_kernel233_x86_64_sse2.s nb_kernel233_x86_64_sse2.h \
- nb_kernel234_x86_64_sse2.s nb_kernel234_x86_64_sse2.h \
- nb_kernel300_x86_64_sse2.s nb_kernel300_x86_64_sse2.h \
- nb_kernel301_x86_64_sse2.s nb_kernel301_x86_64_sse2.h \
- nb_kernel302_x86_64_sse2.s nb_kernel302_x86_64_sse2.h \
- nb_kernel303_x86_64_sse2.s nb_kernel303_x86_64_sse2.h \
- nb_kernel304_x86_64_sse2.s nb_kernel304_x86_64_sse2.h \
- nb_kernel310_x86_64_sse2.s nb_kernel310_x86_64_sse2.h \
- nb_kernel311_x86_64_sse2.s nb_kernel311_x86_64_sse2.h \
- nb_kernel312_x86_64_sse2.s nb_kernel312_x86_64_sse2.h \
- nb_kernel313_x86_64_sse2.s nb_kernel313_x86_64_sse2.h \
- nb_kernel314_x86_64_sse2.s nb_kernel314_x86_64_sse2.h \
- nb_kernel330_x86_64_sse2.s nb_kernel330_x86_64_sse2.h \
- nb_kernel331_x86_64_sse2.s nb_kernel331_x86_64_sse2.h \
- nb_kernel332_x86_64_sse2.s nb_kernel332_x86_64_sse2.h \
- nb_kernel333_x86_64_sse2.s nb_kernel333_x86_64_sse2.h \
- nb_kernel334_x86_64_sse2.s nb_kernel334_x86_64_sse2.h \
- nb_kernel400_x86_64_sse2.c nb_kernel400_x86_64_sse2.h \
- nb_kernel410_x86_64_sse2.c nb_kernel410_x86_64_sse2.h \
- nb_kernel430_x86_64_sse2.c nb_kernel430_x86_64_sse2.h \
- nb_kernel_x86_64_sse2_test_asm.s nb_kernel_x86_64_sse2_test_asm.h \
- nb_kernel_x86_64_sse2.c nb_kernel_x86_64_sse2.h \
- nb_kernel_allvsall_sse2_double.c \
- nb_kernel_allvsall_sse2_double.h \
- nb_kernel_allvsallgb_sse2_double.c \
- nb_kernel_allvsallgb_sse2_double.h
-
-
-
-EXTRA_DIST = \
- nb_kernel010_x86_64_sse2_intel_syntax.s nb_kernel030_x86_64_sse2_intel_syntax.s \
- nb_kernel100_x86_64_sse2_intel_syntax.s nb_kernel101_x86_64_sse2_intel_syntax.s \
- nb_kernel102_x86_64_sse2_intel_syntax.s nb_kernel103_x86_64_sse2_intel_syntax.s \
- nb_kernel104_x86_64_sse2_intel_syntax.s nb_kernel110_x86_64_sse2_intel_syntax.s \
- nb_kernel111_x86_64_sse2_intel_syntax.s nb_kernel112_x86_64_sse2_intel_syntax.s \
- nb_kernel113_x86_64_sse2_intel_syntax.s nb_kernel114_x86_64_sse2_intel_syntax.s \
- nb_kernel130_x86_64_sse2_intel_syntax.s nb_kernel131_x86_64_sse2_intel_syntax.s \
- nb_kernel132_x86_64_sse2_intel_syntax.s nb_kernel133_x86_64_sse2_intel_syntax.s \
- nb_kernel134_x86_64_sse2_intel_syntax.s nb_kernel200_x86_64_sse2_intel_syntax.s \
- nb_kernel201_x86_64_sse2_intel_syntax.s nb_kernel202_x86_64_sse2_intel_syntax.s \
- nb_kernel203_x86_64_sse2_intel_syntax.s nb_kernel204_x86_64_sse2_intel_syntax.s \
- nb_kernel210_x86_64_sse2_intel_syntax.s nb_kernel211_x86_64_sse2_intel_syntax.s \
- nb_kernel212_x86_64_sse2_intel_syntax.s nb_kernel213_x86_64_sse2_intel_syntax.s \
- nb_kernel214_x86_64_sse2_intel_syntax.s nb_kernel230_x86_64_sse2_intel_syntax.s \
- nb_kernel231_x86_64_sse2_intel_syntax.s nb_kernel232_x86_64_sse2_intel_syntax.s \
- nb_kernel233_x86_64_sse2_intel_syntax.s nb_kernel234_x86_64_sse2_intel_syntax.s \
- nb_kernel300_x86_64_sse2_intel_syntax.s nb_kernel301_x86_64_sse2_intel_syntax.s \
- nb_kernel302_x86_64_sse2_intel_syntax.s nb_kernel303_x86_64_sse2_intel_syntax.s \
- nb_kernel304_x86_64_sse2_intel_syntax.s nb_kernel310_x86_64_sse2_intel_syntax.s \
- nb_kernel311_x86_64_sse2_intel_syntax.s nb_kernel312_x86_64_sse2_intel_syntax.s \
- nb_kernel313_x86_64_sse2_intel_syntax.s nb_kernel314_x86_64_sse2_intel_syntax.s \
- nb_kernel330_x86_64_sse2_intel_syntax.s nb_kernel331_x86_64_sse2_intel_syntax.s \
- nb_kernel332_x86_64_sse2_intel_syntax.s nb_kernel333_x86_64_sse2_intel_syntax.s \
- nb_kernel334_x86_64_sse2_intel_syntax.s nb_kernel_x86_64_sse2_test_intel_syntax.s
-
+typedef void
+nb_adress_kernel_t(int * nri,
+ int * iinr,
+ int * jindex,
+ int * jjnr,
+ int * shift,
+ real * shiftvec,
+ real * fshift,
+ int * gid,
+ real * pos,
+ real * faction,
+ real * charge,
+ real * facel,
+ real * krf,
+ real * crf,
+ real * vc,
+ int * type,
+ int * ntype,
+ real * vdwparam,
+ real * vvdw,
+ real * tabscale,
+ real * vftab,
+ real * invsqrta,
+ real * dvda,
+ real * gbtabscale,
+ real * gbtab,
+ int * nthreads,
+ int * count,
+ void * mtx,
+ int * outeriter,
+ int * inneriter,
+ real force_cap,
+ real * wf);
+
+
+
#ifdef __cplusplus
}
#endif
#include "nonbonded.h"
#include "nb_kernel_c/nb_kernel_c.h"
+#include "nb_kernel_adress_c/nb_kernel_c_adress.h"
#include "nb_free_energy.h"
#include "nb_generic.h"
#include "nb_generic_cg.h"
+#include "nb_generic_adress.h"
/* 1,4 interactions uses kernel 330 directly */
#include "nb_kernel_c/nb_kernel330.h"
+#include "nb_kernel_adress_c/nb_kernel330_adress.h"
#ifdef GMX_PPC_ALTIVEC
#include "nb_kernel_ppc_altivec/nb_kernel_ppc_altivec.h"
static nb_kernel_t **
nb_kernel_list = NULL;
+static nb_adress_kernel_t **
+nb_kernel_list_adress = NULL;
void
gmx_setup_kernels(FILE *fplog,gmx_bool bGenericKernelOnly)
}
}
+void
+gmx_setup_adress_kernels(FILE *fplog,gmx_bool bGenericKernelOnly) {
+ int i;
+
+ snew(nb_kernel_list_adress, eNR_NBKERNEL_NR);
+
+ for (i = 0; i < eNR_NBKERNEL_NR; i++) {
+ nb_kernel_list_adress[i] = NULL;
+ }
+
+ if (bGenericKernelOnly)
+ {
+ return;
+ }
+
+ nb_kernel_setup_adress(fplog, nb_kernel_list_adress);
+}
void do_nonbonded(t_commrec *cr,t_forcerec *fr,
rvec x[],rvec f[],t_mdatoms *mdatoms,t_blocka *excl,
real * fshift;
int n,n0,n1,i,i0,i1,nrnb_ind,sz;
t_nblists *nblists;
- gmx_bool bWater;
- nb_kernel_t * kernelptr;
+ gmx_bool bWater;
FILE * fp;
int fac=0;
int nthreads = 1;
int outeriter,inneriter;
real * tabledata = NULL;
gmx_gbdata_t gbdata;
+
+ nb_kernel_t *kernelptr=NULL;
+ nb_adress_kernel_t *adresskernelptr=NULL;
+ gmx_bool bCG; /* for AdresS */
+ int k;/* for AdresS */
+
bLR = (flags & GMX_DONB_LR);
bDoForces = (flags & GMX_DONB_FORCES);
bForeignLambda = (flags & GMX_DONB_FOREIGNLAMBDA);
+ bCG = FALSE; /* for AdresS */
+
gbdata.gb_epsilon_solvent = fr->gb_epsilon_solvent;
gbdata.epsilon_r = fr->epsilon_r;
gbdata.gpol = egpol;
+ if (!fr->adress_type==eAdressOff && !bDoForces){
+ gmx_fatal(FARGS,"No force kernels not implemeted for adress");
+ }
+
if(fr->bAllvsAll)
{
if(fr->bGB)
}
else if (nlist->enlist == enlistCG_CG)
{
+ if (fr->adress_type==eAdressOff){
/* Call the charge group based inner loop */
- gmx_nb_generic_cg_kernel(nlist,
- fr,
- mdatoms,
- x[0],
- f[0],
- fshift,
- egcoul,
- egnb,
- nblists->tab.scale,
- tabledata,
- &outeriter,
- &inneriter);
+ gmx_nb_generic_cg_kernel(nlist,
+ fr,
+ mdatoms,
+ x[0],
+ f[0],
+ fshift,
+ egcoul,
+ egnb,
+ nblists->tab.scale,
+ tabledata,
+ &outeriter,
+ &inneriter);
+ }
+ else
+ {
+ /*gmx_nb_generic_adress_kernel(nlist,
+ fr,
+ mdatoms,
+ x[0],
+ f[0],
+ fshift,
+ egcoul,
+ egnb,
+ nblists->tab.scale,
+ tabledata,
+ &outeriter,
+ &inneriter);*/
+ gmx_fatal(FARGS,"Death & horror! Adress cgcg kernel not implemented anymore.\n");
+
+ }
}
else
{
- /* Not free energy */
-
- kernelptr = nb_kernel_list[nrnb_ind];
+ /* AdresS*/
+ /* for adress we need to determine for each energy group wether it is explicit or coarse-grained */
+ if (!fr->adress_type == eAdressOff) {
+ bCG = FALSE;
+ if ( !fr->adress_group_explicit[ mdatoms->cENER[nlist->iinr[0]] ] ){
+ bCG=TRUE;
+ }
+ /* If this processor has only explicit atoms (w=1)
+ skip the coarse grained force calculation. Same for
+ only coarsegrained atoms and explicit interactions.
+ Last condition is to make sure that generic kernel is not
+ skipped*/
+ if (mdatoms->pureex && bCG && nb_kernel_list[nrnb_ind] != NULL) continue;
+ if (mdatoms->purecg && !bCG && nb_kernel_list[nrnb_ind] != NULL) continue;
+ }
- if (kernelptr == NULL)
- {
+ if (fr->adress_type == eAdressOff ||
+ mdatoms->pureex ||
+ mdatoms->purecg){
+ /* if we only have to calculate pure cg/ex interactions
+ we can use the faster standard gromacs kernels*/
+ kernelptr = nb_kernel_list[nrnb_ind];
+ }else{
+ /* This processor has hybrid interactions which means
+ * we have to
+ * use our own kernels. We have two kernel types: one that
+ * calculates the forces with the explicit prefactor w1*w2
+ * and one for coarse-grained with (1-w1*w2)
+ * explicit kernels are the second part of the kernel
+ * list */
+ if (!bCG) nrnb_ind += eNR_NBKERNEL_NR/2;
+ adresskernelptr = nb_kernel_list_adress[nrnb_ind];
+ }
+
+ if (kernelptr == NULL && adresskernelptr == NULL)
+ {
/* Call a generic nonbonded kernel */
/* If you want to hack/test your own interactions,
* do it in this routine and make sure it is called
* by setting the environment variable GMX_NB_GENERIC.
*/
+ if (fr->adress_type==eAdressOff){
+
gmx_nb_generic_kernel(nlist,
fr,
mdatoms,
tabledata,
&outeriter,
&inneriter);
+ }else /* do generic AdResS kernels (slow)*/
+ {
+
+ gmx_nb_generic_adress_kernel(nlist,
+ fr,
+ mdatoms,
+ x[0],
+ f[0],
+ fshift,
+ egcoul,
+ egnb,
+ nblists->tab.scale,
+ tabledata,
+ &outeriter,
+ &inneriter,
+ bCG);
+ }
+
+
}
else
{
/* Call nonbonded kernel from function pointer */
-
+ if (kernelptr!=NULL){
(*kernelptr)( &(nlist->nri),
nlist->iinr,
nlist->jindex,
&outeriter,
&inneriter,
(real *)&gbdata);
+ }else if (adresskernelptr != NULL)
+ { /* Adress kernels */
+ (*adresskernelptr)( &(nlist->nri),
+ nlist->iinr,
+ nlist->jindex,
+ nlist->jjnr,
+ nlist->shift,
+ fr->shift_vec[0],
+ fshift,
+ nlist->gid,
+ x[0],
+ f[0],
+ mdatoms->chargeA,
+ &(fr->epsfac),
+ &(fr->k_rf),
+ &(fr->c_rf),
+ egcoul,
+ mdatoms->typeA,
+ &(fr->ntype),
+ fr->nbfp,
+ egnb,
+ &(nblists->tab.scale),
+ tabledata,
+ fr->invsqrta,
+ fr->dvda,
+ &(fr->gbtabscale),
+ fr->gbtab.tab,
+ &nthreads,
+ &(nlist->count),
+ nlist->mtx,
+ &outeriter,
+ &inneriter,
+ fr->adress_ex_forcecap,
+ mdatoms->wf);
+ }
}
}
int icoul,ivdw;
gmx_bool bMolPBC,bFreeEnergy;
+ gmx_bool bCG; /* AdResS*/
+ real wf14[2]={0,0}; /* AdResS*/
+
#if GMX_THREAD_SHM_FDECOMP
pthread_mutex_t mtx;
#else
}
+ bCG = FALSE; /*Adres*/
/* We don't do SSE or altivec here, due to large overhead for 4-fold
* unrolling on short lists
*/
aj = iatoms[i++];
gid = GID(md->cENER[ai],md->cENER[aj],md->nenergrp);
+ if (!fr->adress_type == eAdressOff) {
+ if (fr->adress_group_explicit[md->cENER[ai]] != fr->adress_group_explicit[md->cENER[aj]]){
+ /*exclude cg-ex interaction*/
+ continue;
+ }
+ bCG = !fr->adress_group_explicit[md->cENER[ai]];
+ wf14[0] = md->wf[ai];
+ wf14[1] = md->wf[aj];
+ }
switch (ftype) {
case F_LJ14:
bFreeEnergy =
}
else
{
+ if (fr->adress_type==eAdressOff || !fr->adress_do_hybridpairs){
/* Not perturbed - call kernel 330 */
nb_kernel330
( &i1,
&outeriter,
&inneriter,
NULL);
- }
+ } else {
+ if (bCG) {
+ nb_kernel330_adress_cg(&i1,
+ &i0,
+ j_index,
+ &i1,
+ &shift_f,
+ fr->shift_vec[0],
+ fshift[0],
+ &gid,
+ x14[0],
+ f14[0],
+ chargeA,
+ &eps,
+ &krf,
+ &crf,
+ egcoul,
+ typeA,
+ &ntype,
+ nbfp,
+ egnb,
+ &tabscale,
+ tab,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ &nthreads,
+ &count,
+ (void *) &mtx,
+ &outeriter,
+ &inneriter,
+ fr->adress_ex_forcecap,
+ wf14);
+ } else {
+ nb_kernel330_adress_ex(&i1,
+ &i0,
+ j_index,
+ &i1,
+ &shift_f,
+ fr->shift_vec[0],
+ fshift[0],
+ &gid,
+ x14[0],
+ f14[0],
+ chargeA,
+ &eps,
+ &krf,
+ &crf,
+ egcoul,
+ typeA,
+ &ntype,
+ nbfp,
+ egnb,
+ &tabscale,
+ tab,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ &nthreads,
+ &count,
+ (void *) &mtx,
+ &outeriter,
+ &inneriter,
+ fr->adress_ex_forcecap,
+ wf14);
+ }
+
+ }
+ }
/* Add the forces */
rvec_inc(f[ai],f14[0]);
return ndih;
}
-static void get_dih2(t_xrama *xr,t_functype functype[],
- t_ilist *bondeds,t_atoms *atoms)
-{
- int found,**ff,thisff[NPP];
- int i,type,ftype,nat,ai,aj,ak,al;
- int j,k;
- char *cai,*caj,*cak,*cal;
- int ndih,maxdih;
- t_iatom *iatoms;
-
- ndih=0;
- maxdih=1+(bondeds->nr/5);
- snew(ff,maxdih);
- for(j=0; (j<maxdih); j++) {
- snew(ff[j],NPP);
- }
- fprintf(stderr,"There may be as many as %d dihedrals...\n",maxdih);
-
- iatoms=bondeds->iatoms;
- for(i=0; (i<bondeds->nr); ) {
- type=iatoms[0];
- ftype=functype[type];
- nat=interaction_function[ftype].nratoms+1;
-
- if (ftype == F_PDIHS) {
- ai=iatoms[1]; cai=*atoms->atomname[ai];
- aj=iatoms[2]; caj=*atoms->atomname[aj];
- ak=iatoms[3]; cak=*atoms->atomname[ak];
- al=iatoms[4]; cal=*atoms->atomname[al];
-
- for(j=0; (j<NPP); j++)
- thisff[j]=-1;
- if (gmx_strcasecmp(cai,"C") == 0) {
- /* May be a Phi angle */
- if ((gmx_strcasecmp(caj,"N") == 0) &&
- (gmx_strcasecmp(cak,"CA") == 0) &&
- (gmx_strcasecmp(cal,"C") == 0))
- thisff[0]=ai,thisff[1]=aj,thisff[2]=ak,thisff[3]=al;
- }
- else if (gmx_strcasecmp(cai,"N") == 0) {
- /* May be a Psi angle */
- if ((gmx_strcasecmp(caj,"CA") == 0) &&
- (gmx_strcasecmp(cak,"C") == 0) &&
- (gmx_strcasecmp(cal,"N") == 0))
- thisff[1]=ai,thisff[2]=aj,thisff[3]=ak,thisff[4]=al;
- }
- if (thisff[1] != -1) {
- ndih=search_ff(thisff,ndih,ff);
- if (ndih > maxdih)
- gmx_fatal(FARGS,"More than %n dihedrals found. SEGV?",maxdih);
- }
- else {
- fprintf(stderr,"No Phi or Psi, atoms: %s %s %s %s\n",
- cai,caj,cak,cal);
- }
- }
- i+=nat;
- iatoms+=nat;
- }
- for(j=0; (j<ndih); j++) {
- if ((ff[j][0] != -1) && (ff[j][4] != -1))
- add_xr(xr,ff[j],atoms);
- else {
- fprintf(stderr,"Incomplete dihedral(%d) atoms: ",j);
- for(k=0; (k<NPP); k++)
- fprintf(stderr,"%2s ",
- ff[j][k] == -1 ? "-1" : *atoms->atomname[ff[j][k]]);
- fprintf(stderr,"\n");
- }
- }
- fprintf(stderr,"Found %d phi-psi combinations\n",xr->npp);
-}
-
static void min_max(t_xrama *xr)
{
int ai,i,j;
#include "nrjac.h"
-#define ROTATE(a,i,j,k,l) g=a[i][j];h=a[k][l];a[i][j]=g-s*(h+g*tau);\
- a[k][l]=h+s*(g-h*tau);
+static inline
+void do_rotate(double **a, int i, int j, int k, int l, double tau, double s)
+{
+ double g, h;
+ g = a[i][j];
+ h = a[k][l];
+ a[i][j] = g - s * (h + g * tau);
+ a[k][l] = h + s * (g - h * tau);
+}
void jacobi(double **a,int n,double d[],double **v,int *nrot)
{
d[ip] -= h;
d[iq] += h;
a[ip][iq]=0.0;
- for (j=0; j<ip; j++) {
- ROTATE(a,j,ip,j,iq)
- }
- for (j=ip+1; j<iq; j++) {
- ROTATE(a,ip,j,j,iq)
- }
- for (j=iq+1; j<n; j++) {
- ROTATE(a,ip,j,iq,j)
- }
- for (j=0; j<n; j++) {
- ROTATE(v,j,ip,j,iq)
- }
+ for (j=0; j<ip; j++)
+ {
+ do_rotate(a,j,ip,j,iq,tau,s);
+ }
+ for (j=ip+1; j<iq; j++)
+ {
+ do_rotate(a,ip,j,j,iq,tau,s);
+ }
+ for (j=iq+1; j<n; j++)
+ {
+ do_rotate(a,ip,j,iq,j,tau,s);
+ }
+ for (j=0; j<n; j++)
+ {
+ do_rotate(v,j,ip,j,iq,tau,s);
+ }
++(*nrot);
}
}
{ "FENE Bonds", 58 },
{ "Tab. Bonds", 62 },
{ "Restraint Potential", 86 },
+ { "Linear Angles", 57 },
{ "Angles", 168 },
{ "G96Angles", 150 },
{ "Quartic Angles", 160 },
{ "Morse Potent.", 58 },
{ "Cubic Bonds", 54 },
{ "Walls", 31 },
+ { "Polarization", 59 },
+ { "Anharmonic Polarization", 72 },
{ "Water Pol.", 62 },
{ "Thole Pol.", 296 },
{ "Virial", 18 },
#include "gmxfio.h"
#include "oenv.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
{
c=line+6;
/* skip HEADER or TITLE and spaces */
- while (c && (c[0]!=' ')) c++;
- while (c && (c[0]==' ')) c++;
+ while (c[0]!=' ') c++;
+ while (c[0]==' ') c++;
/* truncate after title */
d=strstr(c," ");
if (d)
c=line;
}
/* skip 'MOLECULE:' and spaces */
- while (c && (c[0]!=' ')) c++;
- while (c && (c[0]==' ')) c++;
+ while (c[0]!=' ') c++;
+ while (c[0]==' ') c++;
/* truncate after title */
d=strstr(c," ");
if (d)
}
}
-static void dump_shit(FILE *out,matrix trans,rvec prcomp,real totmass)
-{
- /* print principal component data */
- pr_rvecs(out,0,"Rot Matrix",trans,DIM);
- fprintf(out,"Det(trans) = %g\n",det(trans));
-
- fprintf(out,"Norm of principal axes: %.3f, %.3f, %.3f\n",
- prcomp[XX],prcomp[YY],prcomp[ZZ]);
- fprintf(out,"Totmass = %g\n",totmass);
-}
-
-
void orient_princ(t_atoms *atoms,int isize,atom_id *index,
int natoms, rvec x[], rvec *v, rvec d)
{
}
} while (ptr);
- fclose(in);
+ ffclose(in);
if (debug) {
fprintf(debug,"Done reading MDP file, there were %d entries in there\n",
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-# Convenience library for selection routines - not installed
-
-AM_YFLAGS=-d
-AM_CPPFLAGS= -I$(top_srcdir)/include
-
-noinst_LTLIBRARIES = libselection.la
-
-libselection_la_SOURCES = \
- compiler.c evaluate.c evaluate.h keywords.h \
- mempool.c mempool.h \
- params.c parser.c parser.h parsetree.c \
- parsetree.h \
- scanner.c scanner.h scanner_flex.h scanner_internal.c \
- scanner_internal.h selcollection.h selhelp.c \
- selhelp.h selection.c \
- selelem.c selelem.h selmethod.c selvalue.c \
- sm_compare.c sm_distance.c sm_insolidangle.c \
- sm_keywords.c sm_merge.c sm_permute.c sm_position.c \
- sm_same.c sm_simple.c \
- symrec.c symrec.h
-
-LDADD = ../libgmx@LIBSUFFIX@.la ../../mdlib/libmd@LIBSUFFIX@.la
-
-EXTRA_PROGRAMS = test_selection
-
-CLEANFILES = *.la *~ \\\#*
#include <smalloc.h>
#include <string2.h>
#include <vec.h>
+#include <assert.h>
#include <indexutil.h>
#include <poscalc.h>
static void
init_item_evaloutput(t_selelem *sel)
{
+ assert(!(sel->child == NULL &&
+ (sel->type == SEL_SUBEXPRREF || sel->type == SEL_SUBEXPR)));
+
/* Process children. */
if (sel->type != SEL_SUBEXPRREF)
{
&& ((sel->cdata->flags & SEL_CDATA_SIMPLESUBEXPR)
|| (sel->cdata->flags & SEL_CDATA_FULLEVAL)))
{
+ assert(sel->child);
sel->cdata->gmin = sel->child->cdata->gmin;
sel->cdata->gmax = sel->child->cdata->gmax;
}
case SEL_EXPRESSION:
case SEL_MODIFIER:
+ assert(g);
rc = _gmx_sel_evaluate_method_params(data, sel, g);
if (rc != 0)
{
}
else if (sel->u.cgrp.isize == 0)
{
+ assert(g);
gmx_ana_index_reserve(&sel->u.cgrp, g->isize);
rc = sel->cdata->evaluate(data, sel, g);
if (bDoMinMax)
static void
postprocess_item_subexpressions(t_selelem *sel)
{
+ assert(!(sel->child == NULL &&
+ (sel->type == SEL_SUBEXPRREF || sel->type == SEL_SUBEXPR)));
+
/* Process children. */
if (sel->type != SEL_SUBEXPRREF)
{
sel->u.cgrp.name = name;
sel->evaluate = &_gmx_sel_evaluate_subexpr_staticeval;
- if (sel->cdata)
- {
- sel->cdata->evaluate = sel->evaluate;
- }
+ sel->cdata->evaluate = sel->evaluate;
+
_gmx_selelem_free_values(sel->child);
sel->child->mempool = NULL;
_gmx_selvalue_setstore(&sel->child->v, sel->v.u.ptr);
#include <maths.h>
#include <smalloc.h>
#include <vec.h>
+#include <assert.h>
#include <indexutil.h>
#include <poscalc.h>
_gmx_sel_evaluate_arithmetic(gmx_sel_evaluate_t *data, t_selelem *sel,
gmx_ana_index_t *g)
{
- t_selelem *left, *right;
int n, i, i1, i2;
real lval, rval=0., val=0.;
int rc;
+ gmx_bool bArithNeg;
- left = sel->child;
- right = left->next;
+ t_selelem *const left = sel->child;
+ t_selelem *const right = left->next;
if (left->mempool)
{
n = (sel->flags & SEL_SINGLEVAL) ? 1 : g->isize;
sel->v.nr = n;
+
+ bArithNeg = (sel->u.arith.type == ARITH_NEG);
+ assert(right || bArithNeg);
for (i = i1 = i2 = 0; i < n; ++i)
{
lval = left->v.u.r[i1];
- if (sel->u.arith.type != ARITH_NEG)
+ if (!bArithNeg)
{
rval = right->v.u.r[i2];
}
{
++i1;
}
- if (sel->u.arith.type != ARITH_NEG && !(right->flags & SEL_SINGLEVAL))
+ if (!bArithNeg && !(right->flags & SEL_SINGLEVAL))
{
++i2;
}
#include <smalloc.h>
#include <string2.h>
#include <gmx_fatal.h>
+#include <assert.h>
#include <poscalc.h>
#include <selection.h>
* children have been updated. */
if (sel->type == SEL_ROOT)
{
+ assert(sel->child);
sel->flags |= (sel->child->flags & SEL_VALTYPEMASK);
}
/* Mark that the flags are set */
if (nparams > 0 && !param)
{
report_error(fp, name, "error: missing parameter data");
- bOk = FALSE;
return FALSE;
}
if (nparams == 0 && param)
/** Initializes the \p insolidangle selection method. */
static int
init_insolidangle(t_topology *top, int npar, gmx_ana_selparam_t *param, void *data);
-/** Sets the COM/COG data for the \p insolidangle selection method. */
-static void
-set_comg_insolidangle(gmx_ana_pos_t *pos, void *data);
/** Frees the data allocated for the \p insolidangle selection method. */
static void
free_data_insolidangle(void *data);
return success;
}
-int atp_size (int *index_atp)
-{
- int i = 0;
-
- while (index_atp[i])
- i++;
- return i;
-}
-
-
extern int do_scattering_intensity (const char* fnTPS, const char* fnNDX,
const char* fnXVG, const char *fnTRX,
const char* fnDAT,
#define p4(x) ((x)*(x)*(x)*(x))
static real A,A_3,B,B_4,C,c1,c2,c3,c4,c5,c6,One_4pi,FourPi_V,Vol,N0;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
static tMPI_Thread_mutex_t shift_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
#endif
void set_shift_consts(FILE *log,real r1,real rc,rvec box,t_forcerec *fr)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* at the very least we shouldn't allow multiple threads to set these
simulataneously */
tMPI_Thread_mutex_lock(&shift_mutex);
}
One_4pi = 1.0/(4.0*M_PI);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&shift_mutex);
#endif
}
return dx2;
}
-real calc_dx2(rvec xi,rvec xj,rvec box)
-{
- rvec dx;
-
- return calc_dx2dx(xi,xj,box,dx);
-}
-
real shiftfunction(real r1,real rc,real R)
{
real dr;
return A*dr*dr+B*dr*dr*dr;
}
-real new_f(real r,real rc)
-{
- real rrc,rrc2,rrc3;
-
- rrc = r/rc;
- rrc2 = rrc*rrc;
- rrc3 = rrc2*rrc;
- return 1.5*rrc2*rrc3 - 2.5*rrc3 + 1.0;
-}
-
-real new_phi(real r,real rc)
-{
- real rrr;
-
- rrr = sqr(r/rc);
-
- return 1/r-(0.125/rc)*(15 + 3*rrr*rrr - 10*rrr);
-}
-
-real old_f(real r,real rc,real r1)
-{
- real dr,r2;
-
- if (r <= r1)
- return 1.0;
- else if (r >= rc)
- return 0;
-
- dr = r-r1;
- r2 = r*r;
- return 1+A*r2*dr*dr+B*r2*dr*dr*dr;
-}
-
-real old_phi(real r,real rc,real r1)
-{
- real dr;
-
- if (r <= r1)
- return 1/r-C;
- else if (r >= rc)
- return 0.0;
-
- dr = r-r1;
-
- return 1/r-A_3*dr*dr*dr-B_4*dr*dr*dr*dr - C;
-}
-
-real spreadfunction(real r1,real rc,real R)
-{
- real dr;
-
- if (R <= r1)
- return 0.0;
- else if (R >= rc)
- return 0.0;
-
- dr=R-r1;
-
- return -One_4pi*(dr/R)*(2*A*(2*R-r1)+B*dr*(5*R-2*r1));
-}
-
real potential(real r1,real rc,real R)
{
if (R < r1)
return (phitot/natoms);
}
-real symmetrize_phi(FILE *log,int natoms,real phi[],gmx_bool bVerbose)
-{
- real phitot;
- int i;
-
- phitot=phi_aver(natoms,phi);
- if (bVerbose)
- fprintf(log,"phi_aver = %10.3e\n",phitot);
-
- for(i=0; (i<natoms); i++)
- phi[i]-=phitot;
-
- return phitot;
-}
-
-static real rgbset(real col)
-{
- int icol32;
-
- icol32=32.0*col;
- return icol32/32.0;
-}
-
-
-
-real analyse_diff(FILE *log,char *label,const output_env_t oenv,
- int natom,rvec ffour[],rvec fpppm[],
- real phi_f[],real phi_p[],real phi_sr[],
- char *fcorr,char *pcorr,char *ftotcorr,char *ptotcorr)
-/* Analyse difference between forces from fourier (_f) and other (_p)
- * LR solvers (and potential also).
- * If the filenames are given, xvgr files are written.
- * returns the root mean square error in the force.
- */
-{
- int i,m;
- FILE *fp=NULL,*gp=NULL;
- real f2sum=0,p2sum=0;
- real df,fmax,dp,pmax,rmsf;
-
- fmax = fabs(ffour[0][0]-fpppm[0][0]);
- pmax = fabs(phi_f[0] - phi_p[0]);
-
- for(i=0; (i<natom); i++) {
- dp = fabs(phi_f[i] - phi_p[i]);
- pmax = max(dp,pmax);
- p2sum += dp*dp;
- for(m=0; (m<DIM); m++) {
- df = fabs(ffour[i][m] - fpppm[i][m]);
- fmax = max(df,fmax);
- f2sum += df*df;
- }
- }
-
- rmsf = sqrt(f2sum/(3.0*natom));
- fprintf(log,"\n********************************\nERROR ANALYSIS for %s\n",
- label);
- fprintf(log,"%-10s%12s%12s\n","Error:","Max Abs","RMS");
- fprintf(log,"%-10s %10.3f %10.3f\n","Force",fmax,rmsf);
- fprintf(log,"%-10s %10.3f %10.3f\n","Potential",pmax,sqrt(p2sum/(natom)));
-
- if (fcorr) {
- fp = xvgropen(fcorr,"LR Force Correlation","Four-Force","PPPM-Force",oenv);
- for(i=0; (i<natom); i++) {
- for(m=0; (m<DIM); m++) {
- fprintf(fp,"%10.3f %10.3f\n",ffour[i][m],fpppm[i][m]);
- }
- }
- gmx_fio_fclose(fp);
- do_view(oenv,fcorr,NULL);
- }
- if (pcorr)
- fp = xvgropen(pcorr,"LR Potential Correlation","Four-Pot","PPPM-Pot",oenv);
- if (ptotcorr)
- gp = xvgropen(ptotcorr,"Total Potential Correlation","Four-Pot","PPPM-Pot",
- oenv);
- for(i=0; (i<natom); i++) {
- if (pcorr)
- fprintf(fp,"%10.3f %10.3f\n",phi_f[i],phi_p[i]);
- if (ptotcorr)
- fprintf(gp,"%10.3f %10.3f\n",phi_f[i]+phi_sr[i],phi_p[i]+phi_sr[i]);
- }
- if (pcorr) {
- gmx_fio_fclose(fp);
- do_view(oenv,pcorr,NULL);
- }
- if (ptotcorr) {
- gmx_fio_fclose(gp);
- do_view(oenv,ptotcorr,NULL);
- }
-
- return rmsf;
-}
-
static volatile sig_atomic_t usr_condition=0;
-static RETSIGTYPE signal_handler(int n)
+static void signal_handler(int n)
{
switch (n) {
/* windows doesn't do SIGINT correctly according to ANSI (yes, signals are in
/* This file is completely threadsafe - keep it that way! */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi/threads.h"
#endif
if (!bMal)
bytes=-bytes;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&gmx_logfile_mtx);
#endif
what ? what : NN,bytes/1024.0,
file ? fname : NN,line,nelem,size);
}
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&gmx_logfile_mtx);
#endif
}
#include "mshift.h"
#include "invblock.h"
#include "txtdump.h"
-#include "math.h"
+#include <math.h>
#include "assert.h"
#include "gmx_fatal.h"
#include "splitter.h"
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-# Convenience library for statistics routine - not installed
-
-AM_CPPFLAGS= -I$(top_srcdir)/include
-
-noinst_LTLIBRARIES = libstatistics.la
-
-libstatistics_la_SOURCES = \
- gmx_statistics.c histogram.c
-
-LDADD = ../libgmx@LIBSUFFIX@.la
-
-EXTRA_PROGRAMS = gmx_statistics_test
-
-CLEANFILES = *.la *~ \\\#*
#include "mtop_util.h"
#include "gmxfio.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
static const char *program_name=NULL;
static char *cmd_line=NULL;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* For now, some things here are simply not re-entrant, so
we have to actively lock them. */
static tMPI_Thread_mutex_t init_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
const char *ShortProgram(void)
{
const char *pr,*ret;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&init_mutex);
#endif
pr=ret=program_name;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&init_mutex);
#endif
if ((pr=strrchr(ret,DIR_SEPARATOR)) != NULL)
const char *Program(void)
{
const char *ret;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&init_mutex);
#endif
ret=program_name;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&init_mutex);
#endif
return ret;
const char *command_line(void)
{
const char *ret;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&init_mutex);
#endif
ret=cmd_line;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&init_mutex);
#endif
return ret;
void set_program_name(const char *argvzero)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&init_mutex);
#endif
/* When you run a dynamically linked program before installing
}
if (program_name == NULL)
program_name="GROMACS";
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&init_mutex);
#endif
}
int i;
size_t cmdlength;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&init_mutex);
#endif
if (cmd_line==NULL)
strcat(cmd_line," ");
}
}
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&init_mutex);
#endif
static void set_default_time_unit(const char *time_list[], gmx_bool bCanTime)
{
- int i,j;
+ int i=0,j;
const char *select;
if (bCanTime)
/* The some system, e.g. the catamount kernel on cray xt3 do not have nice(2). */
if (nicelevel != 0 && !bExit)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
static gmx_bool nice_set=FALSE; /* only set it once */
tMPI_Thread_mutex_lock(&init_mutex);
if (!nice_set)
{
#endif
i=nice(nicelevel); /* assign ret value to avoid warnings */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
nice_set=TRUE;
}
tMPI_Thread_mutex_unlock(&init_mutex);
{
const char *unk = "onbekend";
time_t clock;
- char *user=NULL;
+ const char *user=unk;
int gh;
uid_t uid;
- char buf[256];
+ char buf[256]="";
char timebuf[STRLEN];
#ifdef HAVE_PWD_H
struct passwd *pw;
#include "statutil.h"
#include "gmx_fatal.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
{ 0, FALSE }
};
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
static tMPI_Thread_mutex_t tc_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
#endif
-typedef struct {
- real tfactor;
- const char *tstr,*xvgstr;
-} t_timeconvert;
-
-static const t_timeconvert timeconvert[] = {
- { 0, NULL, NULL },
- { 1e3, "fs", "fs" },
- { 1, "ps", "ps" },
- { 1e-3, "ns", "ns" },
- { 1e-6, "us", "\\mus" },
- { 1e-9, "ms", "ms" },
- { 1e-12, "s", "s" },
- { (1.0/60.0)*1e-12, "m", "m" },
- { (1.0/3600.0)*1e-12, "h", "h" },
- { 0, NULL, NULL }
-};
-
gmx_bool bTimeSet(int tcontrol)
{
gmx_bool ret;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&tc_mutex);
#endif
range_check(tcontrol,0,TNR);
ret=timecontrol[tcontrol].bSet;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&tc_mutex);
#endif
{
real ret;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&tc_mutex);
#endif
range_check(tcontrol,0,TNR);
ret=timecontrol[tcontrol].t;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&tc_mutex);
#endif
return ret;
void setTimeValue(int tcontrol,real value)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&tc_mutex);
#endif
range_check(tcontrol,0,TNR);
timecontrol[tcontrol].t = value;
timecontrol[tcontrol].bSet = TRUE;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&tc_mutex);
#endif
}
+++ /dev/null
-# Cross-platform threading library/MPI implementation.
-#
-# This Makefile.am can be used both for linking the final executables against
-# the libthread_mpi.a object created here, or for linking into libraries.
-#
-
-
-AM_CPPFLAGS= -I$(top_srcdir)/include
-
-noinst_LTLIBRARIES = libthread_mpi.la
-
-# again, we assume that we're using pthreads if we're using autotools.
-libthread_mpi_la_SOURCES = alltoall.c impl.h pthreads.h \
- barrier.c list.c reduce.c \
- bcast.c lock.c reduce_fast.c \
- collective.c once.c scatter.c \
- collective.h p2p.h settings.h \
- comm.c p2p_protocol.c tmpi_init.c \
- errhandler.c p2p_send_recv.c tmpi_ops.h \
- event.c p2p_wait.c topology.c \
- gather.c profile.c type.c \
- group.c profile.h winthreads.c \
- pthreads.c winthreads.h numa_malloc.c
-
-
-CLEANFILES = *.la *~ \\\#*
-
/* the p2p communication events (incoming envelopes + finished send
envelopes generate events) */
tMPI_Event p2p_event;
- TMPI_YIELD_WAIT_DATA /* data associated with waiting */
+ TMPI_YIELD_WAIT_DATA; /* data associated with waiting */
struct req_list rql; /* list of pre-allocated requests */
/* collective communication structures: */
int tag, tMPI_Comm comm)
{
struct envelope *sev;
- struct tmpi_thread *send_dst=tMPI_Get_thread(comm, dest);
+ struct tmpi_thread *send_dst;
struct tmpi_thread *cur=tMPI_Get_current();
struct tmpi_req_ req;
{
return tMPI_Error(TMPI_COMM_WORLD, TMPI_ERR_COMM);
}
+ send_dst = tMPI_Get_thread(comm, dest);
if (!send_dst)
{
return tMPI_Error(comm, TMPI_ERR_SEND_DEST);
struct envelope *rev, *sev;
struct tmpi_thread *cur=tMPI_Get_current();
struct tmpi_thread *recv_src=0;
- struct tmpi_thread *send_dst=tMPI_Get_thread(comm, dest);
+ struct tmpi_thread *send_dst;
struct tmpi_req_ sreq, rreq;
int ret=TMPI_SUCCESS;
{
return tMPI_Error(TMPI_COMM_WORLD, TMPI_ERR_COMM);
}
+ send_dst=tMPI_Get_thread(comm, dest);
if (!send_dst)
{
return tMPI_Error(comm, TMPI_ERR_SEND_DEST);
struct tmpi_thread *cur=tMPI_Get_current();
struct req_list *rql=&(cur->rql);
struct tmpi_req_ *rq=tMPI_Get_req(rql);
- struct tmpi_thread *send_dst=tMPI_Get_thread(comm, dest);
+ struct tmpi_thread *send_dst;
struct envelope *ev;
#ifdef TMPI_PROFILE
tMPI_Return_req(rql,rq);
return tMPI_Error(TMPI_COMM_WORLD, TMPI_ERR_COMM);
}
+ send_dst=tMPI_Get_thread(comm, dest);
if (!send_dst)
{
tMPI_Return_req(rql,rq);
/* there are a few global variables that maintain information about the
running threads. Some are defined by the MPI standard: */
tMPI_Comm TMPI_COMM_WORLD=NULL;
-tMPI_Group tMPI_GROUP_EMPTY=NULL;
+tMPI_Group TMPI_GROUP_EMPTY=NULL;
/* the threads themselves (tmpi_comm only contains lists of pointers to this
/* allocate world and thread data */
threads=(struct tmpi_thread*)tMPI_Malloc(sizeof(struct tmpi_thread)*N);
TMPI_COMM_WORLD=tMPI_Comm_alloc(NULL, N);
- tMPI_GROUP_EMPTY=tMPI_Group_alloc();
+ TMPI_GROUP_EMPTY=tMPI_Group_alloc();
if (tMPI_Thread_key_create(&id_key, NULL))
{
tMPI_Comm_destroy(TMPI_COMM_WORLD);
}
- tMPI_Group_free(&tMPI_GROUP_EMPTY);
+ tMPI_Group_free(&TMPI_GROUP_EMPTY);
threads=0;
TMPI_COMM_WORLD=NULL;
- tMPI_GROUP_EMPTY=NULL;
+ TMPI_GROUP_EMPTY=NULL;
Nthreads=0;
/* deallocate the 'global' structure */
#endif
/* This file is completely threadsafe - keep it that way! */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include <thread_mpi.h>
#endif
#include "vec.h"
#include "mtop_util.h"
+#define TPX_TAG_RELEASE "release"
+
+/* This is the tag string which is stored in the tpx file.
+ * Change this if you want to change the tpx format in a feature branch.
+ * This ensures that there will not be different tpx formats around which
+ * can not be distinguished.
+ */
+static const char *tpx_tag = TPX_TAG_RELEASE;
+
/* This number should be increased whenever the file format changes! */
-static const int tpx_version = 73;
+static const int tpx_version = 77;
/* This number should only be increased when you edit the TOPOLOGY section
* of the tpx format. This way we can maintain forward compatibility too
{ 43, F_TABBONDS },
{ 43, F_TABBONDSNC },
{ 70, F_RESTRBONDS },
+ { 76, F_LINEAR_ANGLES },
{ 30, F_CROSS_BOND_BONDS },
{ 30, F_CROSS_BOND_ANGLES },
{ 30, F_UREY_BRADLEY },
{ 69, F_VTEMP },
{ 66, F_PDISPCORR },
{ 54, F_DHDL_CON },
+ { 76, F_ANHARM_POL }
};
#define NFTUPD asize(ftupd)
do_pullgrp(fio,&pull->grp[g],bRead,file_version);
}
+
+static void do_rotgrp(t_fileio *fio, t_rotgrp *rotg,gmx_bool bRead, int file_version)
+{
+ gmx_bool bDum=TRUE;
+ int i;
+
+ gmx_fio_do_int(fio,rotg->eType);
+ gmx_fio_do_int(fio,rotg->bMassW);
+ gmx_fio_do_int(fio,rotg->nat);
+ if (bRead)
+ snew(rotg->ind,rotg->nat);
+ gmx_fio_ndo_int(fio,rotg->ind,rotg->nat);
+ if (bRead)
+ snew(rotg->x_ref,rotg->nat);
+ gmx_fio_ndo_rvec(fio,rotg->x_ref,rotg->nat);
+ gmx_fio_do_rvec(fio,rotg->vec);
+ gmx_fio_do_rvec(fio,rotg->pivot);
+ gmx_fio_do_real(fio,rotg->rate);
+ gmx_fio_do_real(fio,rotg->k);
+ gmx_fio_do_real(fio,rotg->slab_dist);
+ gmx_fio_do_real(fio,rotg->min_gaussian);
+ gmx_fio_do_real(fio,rotg->eps);
+ gmx_fio_do_int(fio,rotg->eFittype);
+ gmx_fio_do_int(fio,rotg->PotAngle_nstep);
+ gmx_fio_do_real(fio,rotg->PotAngle_step);
+}
+
+static void do_rot(t_fileio *fio, t_rot *rot,gmx_bool bRead, int file_version)
+{
+ int g;
+
+ gmx_fio_do_int(fio,rot->ngrp);
+ gmx_fio_do_int(fio,rot->nstrout);
+ gmx_fio_do_int(fio,rot->nstsout);
+ if (bRead)
+ snew(rot->grp,rot->ngrp);
+ for(g=0; g<rot->ngrp; g++)
+ do_rotgrp(fio, &rot->grp[g],bRead,file_version);
+}
+
+
static void do_inputrec(t_fileio *fio, t_inputrec *ir,gmx_bool bRead,
int file_version, real *fudgeQQ)
{
if (file_version != tpx_version)
{
/* Give a warning about features that are not accessible */
- fprintf(stderr,"Note: tpx file_version %d, software version %d\n",
+ fprintf(stderr,"Note: file tpx version %d, software tpx version %d\n",
file_version,tpx_version);
}
gmx_fio_do_real(fio,ir->userreal3);
gmx_fio_do_real(fio,ir->userreal4);
+ /* AdResS stuff */
+ if (file_version >= 75) {
+ gmx_fio_do_gmx_bool(fio,ir->bAdress);
+ if(ir->bAdress){
+ if (bRead) snew(ir->adress, 1);
+ gmx_fio_do_int(fio,ir->adress->type);
+ gmx_fio_do_real(fio,ir->adress->const_wf);
+ gmx_fio_do_real(fio,ir->adress->ex_width);
+ gmx_fio_do_real(fio,ir->adress->hy_width);
+ gmx_fio_do_int(fio,ir->adress->icor);
+ gmx_fio_do_int(fio,ir->adress->site);
+ gmx_fio_do_rvec(fio,ir->adress->refs);
+ gmx_fio_do_int(fio,ir->adress->n_tf_grps);
+ gmx_fio_do_real(fio, ir->adress->ex_forcecap);
+ gmx_fio_do_int(fio, ir->adress->n_energy_grps);
+ gmx_fio_do_int(fio,ir->adress->do_hybridpairs);
+
+ if (bRead)snew(ir->adress->tf_table_index,ir->adress->n_tf_grps);
+ if (ir->adress->n_tf_grps > 0) {
+ bDum=gmx_fio_ndo_int(fio,ir->adress->tf_table_index,ir->adress->n_tf_grps);
+ }
+ if (bRead)snew(ir->adress->group_explicit,ir->adress->n_energy_grps);
+ if (ir->adress->n_energy_grps > 0) {
+ bDum=gmx_fio_ndo_int(fio, ir->adress->group_explicit,ir->adress->n_energy_grps);
+ }
+ }
+ } else {
+ ir->bAdress = FALSE;
+ }
+
/* pull stuff */
if (file_version >= 48) {
gmx_fio_do_int(fio,ir->ePull);
ir->ePull = epullNO;
}
+ /* Enforced rotation */
+ if (file_version >= 74) {
+ gmx_fio_do_int(fio,ir->bRot);
+ if (ir->bRot == TRUE) {
+ if (bRead)
+ snew(ir->rot,1);
+ do_rot(fio, ir->rot,bRead,file_version);
+ }
+ } else {
+ ir->bRot = FALSE;
+ }
+
/* grpopts stuff */
gmx_fio_do_int(fio,ir->opts.ngtc);
if (file_version >= 69) {
iparams->pdihs.cpB = iparams->pdihs.cpA;
}
break;
+ case F_LINEAR_ANGLES:
+ gmx_fio_do_real(fio,iparams->linangle.klinA);
+ gmx_fio_do_real(fio,iparams->linangle.aA);
+ gmx_fio_do_real(fio,iparams->linangle.klinB);
+ gmx_fio_do_real(fio,iparams->linangle.aB);
+ break;
case F_FENEBONDS:
gmx_fio_do_real(fio,iparams->fene.bm);
gmx_fio_do_real(fio,iparams->fene.kb);
case F_POLARIZATION:
gmx_fio_do_real(fio,iparams->polarize.alpha);
break;
+ case F_ANHARM_POL:
+ gmx_fio_do_real(fio,iparams->anharm_polarize.alpha);
+ gmx_fio_do_real(fio,iparams->anharm_polarize.drcut);
+ gmx_fio_do_real(fio,iparams->anharm_polarize.khyp);
+ break;
case F_WATER_POL:
if (file_version < 31)
gmx_fatal(FARGS,"Old tpr files with water_polarization not supported. Make a new.");
gmx_bool TopOnlyOK, int *file_version,
int *file_generation)
{
- char buf[STRLEN];
+ char buf[STRLEN];
+ char file_tag[STRLEN];
gmx_bool bDouble;
int precision;
int fver,fgen;
gmx_fio_setprecision(fio,bDouble);
gmx_fio_do_int(fio,precision);
fver = tpx_version;
+ sprintf(file_tag,"%s",tpx_tag);
fgen = tpx_generation;
}
- /* Check versions! */
- gmx_fio_do_int(fio,fver);
+ /* Check versions! */
+ gmx_fio_do_int(fio,fver);
- if(fver>=26)
- gmx_fio_do_int(fio,fgen);
- else
- fgen=0;
+ if (fver >= 77)
+ {
+ gmx_fio_do_string(fio,file_tag);
+ }
+ if (bRead)
+ {
+ if (fver < 77)
+ {
+ /* Versions before 77 don't have the tag, set it to release */
+ sprintf(file_tag,"%s",TPX_TAG_RELEASE);
+ }
+
+ if (strcmp(file_tag,tpx_tag) != 0)
+ {
+ fprintf(stderr,"Note: file tpx tag '%s', software tpx tag '%s'\n",
+ file_tag,tpx_tag);
+
+ /* We only support reading tpx files with the same tag as the code
+ * or tpx files with the release tag and with lower version number.
+ */
+ if (!(strcmp(file_tag,TPX_TAG_RELEASE) == 0 && fver < tpx_version))
+ {
+ gmx_fatal(FARGS,"tpx tag/version mismatch: reading tpx file (%s) version %d, tag '%s' with program for tpx version %d, tag '%s'",
+ gmx_fio_getname(fio),fver,file_tag,
+ tpx_version,tpx_tag);
+ }
+ }
+ }
+
+ if (fver >= 26)
+ {
+ gmx_fio_do_int(fio,fgen);
+ }
+ else
+ {
+ fgen=0;
+ }
- if(file_version!=NULL)
- *file_version = fver;
- if(file_generation!=NULL)
- *file_generation = fgen;
+ if (file_version != NULL)
+ {
+ *file_version = fver;
+ }
+ if (file_generation != NULL)
+ {
+ *file_generation = fgen;
+ }
if ((fver <= tpx_incompatible_version) ||
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-# Convenience library for common trajectory analysis routines - not installed
-
-AM_CPPFLAGS= -I$(top_srcdir)/include
-
-noinst_LTLIBRARIES = libtrajana.la
-
-libtrajana_la_SOURCES = \
- centerofmass.c displacement.c indexutil.c nbsearch.c \
- poscalc.c position.c trajana.c
-
-CLEANFILES = *.la *~ \\\#*
memcpy(dest->x, src->x, dest->nr*sizeof(*dest->x));
if (dest->v)
{
+ assert(src->v);
memcpy(dest->v, src->v, dest->nr*sizeof(*dest->v));
}
if (dest->f)
{
+ assert(src->f);
memcpy(dest->f, src->f, dest->nr*sizeof(*dest->f));
}
gmx_ana_indexmap_copy(&dest->m, &src->m, bFirst);
for(i=0; i<nind; i++)
copy_rvec(fr->f[ind[i]],fout[i]);
}
+ /* no break */
case efXTC:
case efG87:
if (fr->bX) {
case efTRR:
if (vout) sfree(vout);
if (fout) sfree(fout);
+ /* no break */
case efXTC:
case efG87:
sfree(xout);
bRet = gro_next_x_or_v(gmx_fio_getfp(status->fio),fr);
break;
default:
-#ifdef GMX_DLOPEN
+#ifdef GMX_USE_PLUGINS
bRet = read_next_vmd_frame(dummy,fr);
#else
gmx_fatal(FARGS,"DEATH HORROR in read_next_frame ftp=%s,status=%s",
}
if (bRet) {
- bMissingData = ((fr->flags & TRX_NEED_X && !fr->bX) ||
- (fr->flags & TRX_NEED_V && !fr->bV) ||
- (fr->flags & TRX_NEED_F && !fr->bF));
+ bMissingData = (((fr->flags & TRX_NEED_X) && !fr->bX) ||
+ ((fr->flags & TRX_NEED_V) && !fr->bV) ||
+ ((fr->flags & TRX_NEED_F) && !fr->bF));
bSkip = FALSE;
if (!bMissingData) {
ct=check_times2(fr->time,fr->t0,fr->tpf,fr->tppf,fr->bDouble);
- if (ct == 0 || (fr->flags & TRX_DONT_SKIP && ct<0)) {
+ if (ct == 0 || ((fr->flags & TRX_DONT_SKIP) && ct<0)) {
printcount(status, oenv,fr->time,FALSE);
} else if (ct > 0)
bRet = FALSE;
bFirst = FALSE;
break;
default:
-#ifdef GMX_DLOPEN
+#ifdef GMX_USE_PLUGINS
fprintf(stderr,"The file format of %s is not a known trajectory format to GROMACS.\n"
"Please make sure that the file is a trajectory!\n"
"GROMACS will now assume it to be a trajectory and will try to open it using the VMD plug-ins.\n"
}
#else
gmx_fatal(FARGS,"Not supported in read_first_frame: %s. Please make sure that the file is a trajectory.\n"
- "GROMACS is not compiled with DLOPEN. Thus it cannot read non-GROMACS trajectory formats.\n"
- "Please compile with DLOPEN support if you want to read non-GROMACS trajectory formats.\n",fn);
+ "GROMACS is not compiled with plug-in support. Thus it cannot read non-GROMACS trajectory formats using the VMD plug-ins.\n"
+ "Please compile with plug-in support if you want to read non-GROMACS trajectory formats.\n",fn);
#endif
break;
}
clear_rvec(fr->v[i]);
}
-int read_first_v(const output_env_t oenv, t_trxstatus **status,const char *fn,
- real *t, rvec **v,matrix box)
-{
- t_trxframe fr;
-
- read_first_frame(oenv,status,fn,&fr,TRX_NEED_V);
- *t = fr.time;
- clear_v(&fr);
- *v = fr.v;
- copy_mat(fr.box,box);
-
- return fr.natoms;
-}
-
-gmx_bool read_next_v(const output_env_t oenv,t_trxstatus *status,real *t,
- int natoms,rvec v[], matrix box)
-{
- t_trxframe fr;
- gmx_bool bRet;
-
- clear_trxframe(&fr,TRUE);
- fr.flags = TRX_NEED_V;
- fr.natoms = natoms;
- fr.time = *t;
- fr.v = v;
- bRet = read_next_frame(oenv,status,&fr);
- *t = fr.time;
- clear_v(&fr);
- copy_mat(fr.box,box);
-
- return bRet;
-}
#endif
/* This file is completely threadsafe - please keep it that way! */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include <thread_mpi.h>
#endif
fprintf(out,"\n");
pr_indent(out,indent);
- fprintf(out,"ref_t%s",bMDPformat ? " = " : ":");
+ fprintf(out,"ref-t%s",bMDPformat ? " = " : ":");
for(i=0; (i<opts->ngtc); i++)
fprintf(out," %10g",opts->ref_t[i]);
fprintf(out,"\n");
pr_indent(out,indent);
- fprintf(out,"tau_t%s",bMDPformat ? " = " : ":");
+ fprintf(out,"tau-t%s",bMDPformat ? " = " : ":");
for(i=0; (i<opts->ngtc); i++)
fprintf(out," %10g",opts->tau_t[i]);
fprintf(out,"\n");
fprintf(out," %10s",EANNEAL(opts->annealing[i]));
fprintf(out,"\n");
- fprintf(out,"ann_npoints%s",bMDPformat ? " = " : ":");
+ fprintf(out,"ann-npoints%s",bMDPformat ? " = " : ":");
for(i=0; (i<opts->ngtc); i++)
fprintf(out," %10d",opts->anneal_npoints[i]);
fprintf(out,"\n");
for(i=0; (i<opts->ngener); i++) {
pr_indent(out,indent);
- fprintf(out,"energygrp_flags[%3d]:",i);
+ fprintf(out,"energygrp-flags[%3d]:",i);
for(m=0; (m<opts->ngener); m++)
fprintf(out," %d",opts->egp_flags[opts->ngener*i+m]);
fprintf(out,"\n");
static void pr_pullgrp(FILE *fp,int indent,int g,t_pullgrp *pg)
{
pr_indent(fp,indent);
- fprintf(fp,"pull_group %d:\n",g);
+ fprintf(fp,"pull-group %d:\n",g);
indent += 2;
pr_ivec_block(fp,indent,"atom",pg->ind,pg->nat,TRUE);
pr_rvec(fp,indent,"weight",pg->weight,pg->nweight,TRUE);
{
int g;
- PS("pull_geometry",EPULLGEOM(pull->eGeom));
- pr_ivec(fp,indent,"pull_dim",pull->dim,DIM,TRUE);
- PR("pull_r1",pull->cyl_r1);
- PR("pull_r0",pull->cyl_r0);
- PR("pull_constr_tol",pull->constr_tol);
- PI("pull_nstxout",pull->nstxout);
- PI("pull_nstfout",pull->nstfout);
- PI("pull_ngrp",pull->ngrp);
+ PS("pull-geometry",EPULLGEOM(pull->eGeom));
+ pr_ivec(fp,indent,"pull-dim",pull->dim,DIM,TRUE);
+ PR("pull-r1",pull->cyl_r1);
+ PR("pull-r0",pull->cyl_r0);
+ PR("pull-constr-tol",pull->constr_tol);
+ PI("pull-nstxout",pull->nstxout);
+ PI("pull-nstfout",pull->nstfout);
+ PI("pull-ngrp",pull->ngrp);
for(g=0; g<pull->ngrp+1; g++)
pr_pullgrp(fp,indent,g,&pull->grp[g]);
}
+static void pr_rotgrp(FILE *fp,int indent,int g,t_rotgrp *rotg)
+{
+ pr_indent(fp,indent);
+ fprintf(fp,"rotation_group %d:\n",g);
+ indent += 2;
+ PS("type",EROTGEOM(rotg->eType));
+ PS("massw",BOOL(rotg->bMassW));
+ pr_ivec_block(fp,indent,"atom",rotg->ind,rotg->nat,TRUE);
+ pr_rvecs(fp,indent,"x_ref",rotg->x_ref,rotg->nat);
+ pr_rvec(fp,indent,"vec",rotg->vec,DIM,TRUE);
+ pr_rvec(fp,indent,"pivot",rotg->pivot,DIM,TRUE);
+ PR("rate",rotg->rate);
+ PR("k",rotg->k);
+ PR("slab_dist",rotg->slab_dist);
+ PR("min_gaussian",rotg->min_gaussian);
+ PR("epsilon",rotg->eps);
+ PS("fit_method",EROTFIT(rotg->eFittype));
+ PI("potfitangle_nstep",rotg->PotAngle_nstep);
+ PR("potfitangle_step",rotg->PotAngle_step);
+}
+
+static void pr_rot(FILE *fp,int indent,t_rot *rot)
+{
+ int g;
+
+ PI("rot_nstrout",rot->nstrout);
+ PI("rot_nstsout",rot->nstsout);
+ PI("rot_ngrp",rot->ngrp);
+ for(g=0; g<rot->ngrp; g++)
+ pr_rotgrp(fp,indent,g,&rot->grp[g]);
+}
+
void pr_inputrec(FILE *fp,int indent,const char *title,t_inputrec *ir,
gmx_bool bMDPformat)
{
indent=pr_title(fp,indent,title);
PS("integrator",EI(ir->eI));
PSTEP("nsteps",ir->nsteps);
- PSTEP("init_step",ir->init_step);
- PS("ns_type",ENS(ir->ns_type));
+ PSTEP("init-step",ir->init_step);
+ PS("ns-type",ENS(ir->ns_type));
PI("nstlist",ir->nstlist);
PI("ndelta",ir->ndelta);
PI("nstcomm",ir->nstcomm);
- PS("comm_mode",ECOM(ir->comm_mode));
+ PS("comm-mode",ECOM(ir->comm_mode));
PI("nstlog",ir->nstlog);
PI("nstxout",ir->nstxout);
PI("nstvout",ir->nstvout);
PI("nstcalcenergy",ir->nstcalcenergy);
PI("nstenergy",ir->nstenergy);
PI("nstxtcout",ir->nstxtcout);
- PR("init_t",ir->init_t);
- PR("delta_t",ir->delta_t);
+ PR("init-t",ir->init_t);
+ PR("delta-t",ir->delta_t);
PR("xtcprec",ir->xtcprec);
PI("nkx",ir->nkx);
PI("nky",ir->nky);
PI("nkz",ir->nkz);
- PI("pme_order",ir->pme_order);
- PR("ewald_rtol",ir->ewald_rtol);
- PR("ewald_geometry",ir->ewald_geometry);
- PR("epsilon_surface",ir->epsilon_surface);
- PS("optimize_fft",BOOL(ir->bOptFFT));
+ PI("pme-order",ir->pme_order);
+ PR("ewald-rtol",ir->ewald_rtol);
+ PR("ewald-geometry",ir->ewald_geometry);
+ PR("epsilon-surface",ir->epsilon_surface);
+ PS("optimize-fft",BOOL(ir->bOptFFT));
PS("ePBC",EPBC(ir->ePBC));
PS("bPeriodicMols",BOOL(ir->bPeriodicMols));
PS("bContinuation",BOOL(ir->bContinuation));
PS("epc",EPCOUPLTYPE(ir->epc));
PS("epctype",EPCOUPLTYPETYPE(ir->epct));
PI("nstpcouple",ir->nstpcouple);
- PR("tau_p",ir->tau_p);
- pr_matrix(fp,indent,"ref_p",ir->ref_p,bMDPformat);
+ PR("tau-p",ir->tau_p);
+ pr_matrix(fp,indent,"ref-p",ir->ref_p,bMDPformat);
pr_matrix(fp,indent,"compress",ir->compress,bMDPformat);
- PS("refcoord_scaling",EREFSCALINGTYPE(ir->refcoord_scaling));
+ PS("refcoord-scaling",EREFSCALINGTYPE(ir->refcoord_scaling));
if (bMDPformat)
- fprintf(fp,"posres_com = %g %g %g\n",ir->posres_com[XX],
+ fprintf(fp,"posres-com = %g %g %g\n",ir->posres_com[XX],
ir->posres_com[YY],ir->posres_com[ZZ]);
else
- pr_rvec(fp,indent,"posres_com",ir->posres_com,DIM,TRUE);
+ pr_rvec(fp,indent,"posres-com",ir->posres_com,DIM,TRUE);
if (bMDPformat)
- fprintf(fp,"posres_comB = %g %g %g\n",ir->posres_comB[XX],
+ fprintf(fp,"posres-comB = %g %g %g\n",ir->posres_comB[XX],
ir->posres_comB[YY],ir->posres_comB[ZZ]);
else
- pr_rvec(fp,indent,"posres_comB",ir->posres_comB,DIM,TRUE);
- PI("andersen_seed",ir->andersen_seed);
+ pr_rvec(fp,indent,"posres-comB",ir->posres_comB,DIM,TRUE);
+ PI("andersen-seed",ir->andersen_seed);
PR("rlist",ir->rlist);
PR("rlistlong",ir->rlistlong);
PR("rtpi",ir->rtpi);
PS("coulombtype",EELTYPE(ir->coulombtype));
- PR("rcoulomb_switch",ir->rcoulomb_switch);
+ PR("rcoulomb-switch",ir->rcoulomb_switch);
PR("rcoulomb",ir->rcoulomb);
PS("vdwtype",EVDWTYPE(ir->vdwtype));
- PR("rvdw_switch",ir->rvdw_switch);
+ PR("rvdw-switch",ir->rvdw_switch);
PR("rvdw",ir->rvdw);
if (ir->epsilon_r != 0)
- PR("epsilon_r",ir->epsilon_r);
+ PR("epsilon-r",ir->epsilon_r);
else
- PS("epsilon_r",infbuf);
+ PS("epsilon-r",infbuf);
if (ir->epsilon_rf != 0)
- PR("epsilon_rf",ir->epsilon_rf);
+ PR("epsilon-rf",ir->epsilon_rf);
else
- PS("epsilon_rf",infbuf);
+ PS("epsilon-rf",infbuf);
PR("tabext",ir->tabext);
- PS("implicit_solvent",EIMPLICITSOL(ir->implicit_solvent));
- PS("gb_algorithm",EGBALGORITHM(ir->gb_algorithm));
- PR("gb_epsilon_solvent",ir->gb_epsilon_solvent);
+ PS("implicit-solvent",EIMPLICITSOL(ir->implicit_solvent));
+ PS("gb-algorithm",EGBALGORITHM(ir->gb_algorithm));
+ PR("gb-epsilon-solvent",ir->gb_epsilon_solvent);
PI("nstgbradii",ir->nstgbradii);
PR("rgbradii",ir->rgbradii);
- PR("gb_saltconc",ir->gb_saltconc);
- PR("gb_obc_alpha",ir->gb_obc_alpha);
- PR("gb_obc_beta",ir->gb_obc_beta);
- PR("gb_obc_gamma",ir->gb_obc_gamma);
- PR("gb_dielectric_offset",ir->gb_dielectric_offset);
- PS("sa_algorithm",ESAALGORITHM(ir->gb_algorithm));
- PR("sa_surface_tension",ir->sa_surface_tension);
+ PR("gb-saltconc",ir->gb_saltconc);
+ PR("gb-obc-alpha",ir->gb_obc_alpha);
+ PR("gb-obc-beta",ir->gb_obc_beta);
+ PR("gb-obc-gamma",ir->gb_obc_gamma);
+ PR("gb-dielectric-offset",ir->gb_dielectric_offset);
+ PS("sa-algorithm",ESAALGORITHM(ir->gb_algorithm));
+ PR("sa-surface-tension",ir->sa_surface_tension);
PS("DispCorr",EDISPCORR(ir->eDispCorr));
- PS("free_energy",EFEPTYPE(ir->efep));
- PR("init_lambda",ir->init_lambda);
- PR("delta_lambda",ir->delta_lambda);
+ PS("free-energy",EFEPTYPE(ir->efep));
+ PR("init-lambda",ir->init_lambda);
+ PR("delta-lambda",ir->delta_lambda);
if (!bMDPformat)
{
- PI("n_foreign_lambda",ir->n_flambda);
+ PI("n-foreign-lambda",ir->n_flambda);
}
if (ir->n_flambda > 0)
{
pr_indent(fp,indent);
- fprintf(fp,"foreign_lambda%s",bMDPformat ? " = " : ":");
+ fprintf(fp,"foreign-lambda%s",bMDPformat ? " = " : ":");
for(i=0; i<ir->n_flambda; i++)
{
fprintf(fp," %10g",ir->flambda[i]);
}
fprintf(fp,"\n");
}
- PR("sc_alpha",ir->sc_alpha);
- PI("sc_power",ir->sc_power);
- PR("sc_sigma",ir->sc_sigma);
- PR("sc_sigma_min",ir->sc_sigma_min);
+ PR("sc-alpha",ir->sc_alpha);
+ PI("sc-power",ir->sc_power);
+ PR("sc-sigma",ir->sc_sigma);
+ PR("sc-sigma-min",ir->sc_sigma_min);
PI("nstdhdl", ir->nstdhdl);
- PS("separate_dhdl_file", SEPDHDLFILETYPE(ir->separate_dhdl_file));
- PS("dhdl_derivatives", DHDLDERIVATIVESTYPE(ir->dhdl_derivatives));
- PI("dh_hist_size", ir->dh_hist_size);
- PD("dh_hist_spacing", ir->dh_hist_spacing);
+ PS("separate-dhdl-file", SEPDHDLFILETYPE(ir->separate_dhdl_file));
+ PS("dhdl-derivatives", DHDLDERIVATIVESTYPE(ir->dhdl_derivatives));
+ PI("dh-hist-size", ir->dh_hist_size);
+ PD("dh-hist-spacing", ir->dh_hist_spacing);
PI("nwall",ir->nwall);
- PS("wall_type",EWALLTYPE(ir->wall_type));
- PI("wall_atomtype[0]",ir->wall_atomtype[0]);
- PI("wall_atomtype[1]",ir->wall_atomtype[1]);
- PR("wall_density[0]",ir->wall_density[0]);
- PR("wall_density[1]",ir->wall_density[1]);
- PR("wall_ewald_zfac",ir->wall_ewald_zfac);
+ PS("wall-type",EWALLTYPE(ir->wall_type));
+ PI("wall-atomtype[0]",ir->wall_atomtype[0]);
+ PI("wall-atomtype[1]",ir->wall_atomtype[1]);
+ PR("wall-density[0]",ir->wall_density[0]);
+ PR("wall-density[1]",ir->wall_density[1]);
+ PR("wall-ewald-zfac",ir->wall_ewald_zfac);
PS("pull",EPULLTYPE(ir->ePull));
if (ir->ePull != epullNO)
pr_pull(fp,indent,ir->pull);
+
+ PS("rotation",BOOL(ir->bRot));
+ if (ir->bRot)
+ pr_rot(fp,indent,ir->rot);
PS("disre",EDISRETYPE(ir->eDisre));
- PS("disre_weighting",EDISREWEIGHTING(ir->eDisreWeighting));
- PS("disre_mixed",BOOL(ir->bDisreMixed));
- PR("dr_fc",ir->dr_fc);
- PR("dr_tau",ir->dr_tau);
+ PS("disre-weighting",EDISREWEIGHTING(ir->eDisreWeighting));
+ PS("disre-mixed",BOOL(ir->bDisreMixed));
+ PR("dr-fc",ir->dr_fc);
+ PR("dr-tau",ir->dr_tau);
PR("nstdisreout",ir->nstdisreout);
- PR("orires_fc",ir->orires_fc);
- PR("orires_tau",ir->orires_tau);
+ PR("orires-fc",ir->orires_fc);
+ PR("orires-tau",ir->orires_tau);
PR("nstorireout",ir->nstorireout);
PR("dihre-fc",ir->dihre_fc);
- PR("em_stepsize",ir->em_stepsize);
- PR("em_tol",ir->em_tol);
+ PR("em-stepsize",ir->em_stepsize);
+ PR("em-tol",ir->em_tol);
PI("niter",ir->niter);
- PR("fc_stepsize",ir->fc_stepsize);
+ PR("fc-stepsize",ir->fc_stepsize);
PI("nstcgsteep",ir->nstcgsteep);
PI("nbfgscorr",ir->nbfgscorr);
PS("ConstAlg",ECONSTRTYPE(ir->eConstrAlg));
- PR("shake_tol",ir->shake_tol);
- PI("lincs_order",ir->nProjOrder);
- PR("lincs_warnangle",ir->LincsWarnAngle);
- PI("lincs_iter",ir->nLincsIter);
- PR("bd_fric",ir->bd_fric);
- PI("ld_seed",ir->ld_seed);
- PR("cos_accel",ir->cos_accel);
+ PR("shake-tol",ir->shake_tol);
+ PI("lincs-order",ir->nProjOrder);
+ PR("lincs-warnangle",ir->LincsWarnAngle);
+ PI("lincs-iter",ir->nLincsIter);
+ PR("bd-fric",ir->bd_fric);
+ PI("ld-seed",ir->ld_seed);
+ PR("cos-accel",ir->cos_accel);
pr_matrix(fp,indent,"deform",ir->deform,bMDPformat);
+
+ PS("adress",BOOL(ir->bAdress));
+ if (ir->bAdress){
+ PS("adress_type",EADRESSTYPE(ir->adress->type));
+ PR("adress_const_wf",ir->adress->const_wf);
+ PR("adress_ex_width",ir->adress->ex_width);
+ PR("adress_hy_width",ir->adress->hy_width);
+ PS("adress_interface_correction",EADRESSICTYPE(ir->adress->icor));
+ PS("adress_site",EADRESSSITETYPE(ir->adress->site));
+ PR("adress_ex_force_cap",ir->adress->ex_forcecap);
+ PS("adress_do_hybridpairs", BOOL(ir->adress->do_hybridpairs));
+
+ pr_rvec(fp,indent,"adress_reference_coords",ir->adress->refs,DIM,TRUE);
+ }
PI("userint1",ir->userint1);
PI("userint2",ir->userint2);
PI("userint3",ir->userint3);
PI("QMconstraints",ir->QMconstraints);
PI("QMMMscheme",ir->QMMMscheme);
PR("scalefactor",ir->scalefactor);
- pr_qm_opts(fp,indent,"qm_opts",&(ir->opts));
+ pr_qm_opts(fp,indent,"qm-opts",&(ir->opts));
}
}
#undef PS
iparams->cross_ba.r1e,iparams->cross_ba.r2e,
iparams->cross_ba.r3e,iparams->cross_ba.krt);
break;
+ case F_LINEAR_ANGLES:
+ fprintf(fp,"klinA=%15.8e, aA=%15.8e, klinB=%15.8e, aB=%15.8e\n",
+ iparams->linangle.klinA,iparams->linangle.aA,
+ iparams->linangle.klinB,iparams->linangle.aB);
+ break;
case F_UREY_BRADLEY:
fprintf(fp,"theta=%15.8e, ktheta=%15.8e, r13=%15.8e, kUB=%15.8e\n",
iparams->u_b.theta,iparams->u_b.ktheta,iparams->u_b.r13,iparams->u_b.kUB);
case F_POLARIZATION:
fprintf(fp,"alpha=%15.8e\n",iparams->polarize.alpha);
break;
+ case F_ANHARM_POL:
+ fprintf(fp,"alpha=%15.8e drcut=%15.8e khyp=%15.8e\n",
+ iparams->anharm_polarize.alpha,
+ iparams->anharm_polarize.drcut,
+ iparams->anharm_polarize.khyp);
+ break;
case F_THOLE_POL:
fprintf(fp,"a=%15.8e, alpha1=%15.8e, alpha2=%15.8e, rfac=%15.8e\n",
iparams->thole.a,iparams->thole.alpha1,iparams->thole.alpha2,
return indent;
}
-static void low_pr_block(FILE *fp,int indent,const char *title,t_block *block, gmx_bool bShowNumbers)
-{
- int i;
-
- if (available(fp,block,indent,title))
- {
- indent=pr_block_title(fp,indent,title,block);
- for (i=0; i<=block->nr; i++)
- {
- (void) pr_indent(fp,indent+INDENT);
- (void) fprintf(fp,"%s->index[%d]=%u\n",
- title,bShowNumbers?i:-1,block->index[i]);
- }
- }
-}
-
static void low_pr_blocka(FILE *fp,int indent,const char *title,t_blocka *block, gmx_bool bShowNumbers)
{
int i;
#include "pbc.h"
#include <string.h>
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
static gmx_bool bOverAllocDD=FALSE;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
static tMPI_Thread_mutex_t over_alloc_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
#endif
void set_over_alloc_dd(gmx_bool set)
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&over_alloc_mutex);
/* we just make sure that we don't set this at the same time.
We don't worry too much about reading this rarely-set variable */
#endif
bOverAllocDD = set;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&over_alloc_mutex);
#endif
}
#endif
-#ifdef GMX_DLOPEN
+#ifdef GMX_USE_PLUGINS
#if defined(__hpux)
#include <dl.h>
#include "molfile_plugin.h"
#include "vmddlopen.h"
#if !((defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && !defined __CYGWIN__ && !defined __CYGWIN32__)
-#include "glob.h"
+#include <glob.h>
#else
#include <windows.h>
#include <shlobj.h>
const char *err;
int i;
int ret=0;
+ char pathenv_buffer[GMX_PATH_MAX];
#if !((defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && !defined __CYGWIN__ && !defined __CYGWIN32__)
glob_t globbuf;
- const char *defpathenv = "/usr/local/lib/vmd/plugins/*/molfile";
+ const char *defpath_suffix = "/plugins/*/molfile";
+ const char *defpathenv = GMX_VMD_PLUGIN_PATH;
#else
WIN32_FIND_DATA ffd;
HANDLE hFind = INVALID_HANDLE_VALUE;
char progfolder[GMX_PATH_MAX];
char defpathenv[GMX_PATH_MAX];
+ const char *defpath_suffix = "\\plugins\\WIN32\\molfile";
SHGetFolderPath(NULL,CSIDL_PROGRAM_FILES,NULL,SHGFP_TYPE_CURRENT,progfolder);
sprintf(defpathenv,"%s\\University of Illinois\\VMD\\plugins\\WIN32\\molfile",progfolder);
#endif
}
vmdplugin->filetype++;
+ /* First look for an explicit path given at run time for the
+ * plugins, then an implicit run-time path, and finally for one
+ * given at configure time. This last might be hard-coded to the
+ * default for VMD installs. */
pathenv = getenv("VMD_PLUGIN_PATH");
if (pathenv==NULL)
{
- printf("\nVMD_PLUGIN_PATH not set. ");
- printf("Using default location:\n%s\n",defpathenv);
- pathenv=defpathenv;
+ pathenv = getenv("VMDDIR");
+ if (NULL == pathenv)
+ {
+ printf("\nNeither VMD_PLUGIN_PATH or VMDDIR set. ");
+ printf("Using default location:\n%s\n",defpathenv);
+ pathenv=defpathenv;
+ }
+ else
+ {
+ printf("\nVMD_PLUGIN_PATH no set, but VMDDIR is set. ");
+#ifdef _MSC_VER
+ _snprintf_s(pathenv_buffer, sizeof(pathenv_buffer), _TRUNCATE, "%s%s", pathenv, defpath_suffix);
+#else
+ snprintf(pathenv_buffer, sizeof(pathenv_buffer), "%s%s", pathenv, defpath_suffix);
+#endif
+ printf("Using semi-default location:\n%s\n",pathenv_buffer);
+ pathenv = pathenv_buffer;
+ }
}
strncpy(pathname,pathenv,sizeof(pathname));
#if !((defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && !defined __CYGWIN__ && !defined __CYGWIN32__)
}
for (i=0; i<globbuf.gl_pathc && vmdplugin->api == NULL; i++)
{
+ /* FIXME: Undefined which plugin is chosen if more than one plugin
+ can read a certain file ending. Requires some additional command
+ line option or enviroment variable to specify which plugin should
+ be picked.
+ */
ret|=load_sharedlibrary_plugins(globbuf.gl_pathv[i],vmdplugin);
}
globfree(&globbuf);
return 0;
}
+ if (vmdplugin->api->abiversion < 10)
+ {
+ printf("\nPlugin and/or VMD is too old. At least VMD 1.8.6 is required.\n");
+ return 0;
+ }
+
printf("\nUsing VMD plugin: %s (%s)\n",vmdplugin->api->name,vmdplugin->api->prettyname);
return 1;
snew(fr->v,fr->natoms);
}
}
+ else
+ {
+ fprintf(stderr,
+ "\nThis trajectory is being read with a VMD plug-in from before VMD"
+ "\nversion 1.8, or from a trajectory that lacks time step metadata."
+ "\nEither way, GROMACS cannot tell whether the trajectory has velocities.\n");
+ }
return 1;
}
#include "statutil.h"
#include "copyrite.h"
#include "strdb.h"
-#include "time.h"
+#include <time.h>
#include "readinp.h"
/* The source code in this file should be thread-safe.
for(j=2; (pa[i].u.c[j] != NULL); j++)
fprintf(out,",'%s'",pa[i].u.c[j]);
fprintf(out,"],%d))\n",is_hidden(&(pa[i])));
+ break;
default:
break;
}
+++ /dev/null
-.deps
-.libs
pgutil.c
readir.c
readpull.c
+ readadress.c
+ readrot.c
resall.c
sorting.c
specbond.c
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-# Note: Makefile is automatically generated from Makefile.in by the configure
-# script, and Makefile.in is generated from Makefile.am by automake.
-
-AM_CPPFLAGS = -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-lib_LTLIBRARIES = libgmxpreprocess@LIBSUFFIX@.la
-
-pkgconfigdir = ${libdir}/pkgconfig
-pkgconfig_DATA = libgmxpreprocess@LIBSUFFIX@.pc
-
-EXTRA_DIST = libgmxpreprocess.pc.cmakein
-
-LDADD = $(lib_LTLIBRARIES) ../mdlib/libmd@LIBSUFFIX@.la ../gmxlib/libgmx@LIBSUFFIX@.la
-
-libgmxpreprocess@LIBSUFFIX@_la_LIBADD = ../mdlib/libmd@LIBSUFFIX@.la
-libgmxpreprocess@LIBSUFFIX@_la_DEPENDENCIES =
-
-libgmxpreprocess@LIBSUFFIX@_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@ $(PTHREAD_LIBS)
-
-libgmxpreprocess@LIBSUFFIX@_la_SOURCES = \
-add_par.c add_par.h \
-compute_io.c compute_io.h \
-convparm.c convparm.h \
-fflibutil.c fflibutil.h \
-gen_ad.c \
-gen_vsite.c gen_vsite.h \
-genhydro.c genhydro.h \
-gpp_atomtype.c \
-gpp_bond_atomtype.c gpp_bond_atomtype.h \
-h_db.c h_db.h \
-hackblock.c \
-hizzie.c hizzie.h \
-pdb2top.c \
-pgutil.c pgutil.h \
-readir.c readir.h \
-readpull.c \
-resall.c \
-sorting.c sorting.h \
-specbond.c specbond.h \
-ter_db.c ter_db.h \
-tomorse.c gpp_tomorse.h \
-topdirs.c topdirs.h \
-topexcl.c topexcl.h \
-topio.c topio.h \
-toppush.c toppush.h \
-topshake.c topshake.h \
-toputil.c \
-tpbcmp.c tpbcmp.h \
-vsite_parm.c vsite_parm.h \
-xlate.c xlate.h
-
-bin_PROGRAMS = \
- grompp mdrun tpbconv pdb2gmx \
- g_protonate g_luck gmxdump \
- gmxcheck g_x2top
-
-g_x2top_SOURCES = g_x2top.c nm2type.c g_x2top.h
-
-mdrun_SOURCES = \
- gctio.c \
- ionize.c ionize.h xmdrun.h \
- do_gct.c repl_ex.c repl_ex.h \
- xutils.c runner.c md.c mdrun.c \
- genalg.c genalg.h md_openmm.h md_openmm.c
-
-if GMX_FAHCORE
- noinst_LTLIBRARIES = libfahcore.la
- libfahcore_la_SOURCES = $(mdrun_SOURCES)
- libfahcore_la_CFLAGS = $(AM_CFLAGS)
- libfahcore_la_LDFLAGS = -all-static $(AM_LDFLAGS)
- libfahcore_la_LIBADD = libgmxpreprocess@LIBSUFFIX@.la
-endif
-
-fahcore: libfahcore.la
-
-# shortcut to install only mdrun
-
-install-mdrun: mdrun$(EXEEXT)
- $(mkinstalldirs) $(DESTDIR)$(bindir)
- if test -f mdrun$(EXEEXT); then \
- f=`echo mdrun$(EXEEXT)|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
- echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) mdrun$(EXEEXT) $(DESTDIR)$(bindir)/$$f"; \
- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) mdrun$(EXEEXT) $(DESTDIR)$(bindir)/$$f; \
- else :; fi
-
-CLEANFILES = *~ \\\#*
-
for(i=0; i<5; i++)
newparam->qangle.c[i]=old[i+1];
break;
+ case F_LINEAR_ANGLES:
+ newparam->linangle.aA = old[0];
+ newparam->linangle.klinA = old[1];
+ newparam->linangle.aB = old[2];
+ newparam->linangle.klinB = old[3];
+ break;
case F_ANGLES:
case F_BONDS:
case F_HARMONIC:
case F_POLARIZATION:
newparam->polarize.alpha = old[0];
break;
+ case F_ANHARM_POL:
+ newparam->anharm_polarize.alpha = old[0];
+ newparam->anharm_polarize.drcut = old[1];
+ newparam->anharm_polarize.khyp = old[2];
+ break;
case F_WATER_POL:
newparam->wpol.al_x =old[0];
newparam->wpol.al_y =old[1];
}
}
-static void new_interaction_list(t_ilist *ilist)
-{
- int i;
-
- ilist->nr=0;
- ilist->iatoms=NULL;
-}
-
void convert_params(int atnr,t_params nbtypes[],
t_molinfo *mi,int comb,double reppow,real fudgeQQ,
gmx_mtop_t *mtop)
#include <unistd.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
#include <stdio.h>
#include "copyrite.h"
-#include "string.h"
+#include <string.h>
#include "statutil.h"
int main(int argc,char *argv[])
#define MARGIN_FAC 1.1
-static real set_x_blen(real scale)
-{
- real maxlen;
- int i,j;
-
- for(i=0; i<NATP-1; i++) {
- blen[NATP-1][i] *= scale;
- blen[i][NATP-1] *= scale;
- }
- blen[NATP-1][NATP-1] *= scale;
-
- maxlen = 0;
- for(i=0; i<NATP; i++)
- for(j=0; j<NATP; j++)
- if (blen[i][j] > maxlen)
- maxlen = blen[i][j];
-
- return maxlen*MARGIN_FAC;
-}
-
static gmx_bool is_bond(int nnm,t_nm2type nmt[],char *ai,char *aj,real blen)
{
int i,j;
dump_hybridization(debug,atoms,nbonds);
}
close_symtab(&symtab);
+ free(mymol.name);
printf("\nWARNING: topologies generated by %s can not be trusted at face value.\n",Program());
printf(" Please verify atomtypes and charges by comparison to other\n");
return (p1->AL-p2->AL);
}
-
-static gmx_bool aeq(t_param *p1, t_param *p2)
-{
- if (p1->AJ!=p2->AJ)
- return FALSE;
- else if (((p1->AI==p2->AI) && (p1->AK==p2->AK)) ||
- ((p1->AI==p2->AK) && (p1->AK==p2->AI)))
- return TRUE;
- else
- return FALSE;
-}
-
-
-
static gmx_bool deq(t_param *p1, t_param *p2)
{
if (((p1->AJ==p2->AJ) && (p1->AK==p2->AK)) ||
return TRUE;
}
-static gmx_bool ideq(t_param *p1, t_param *p2)
-{
- return eq_imp(p1->a,p2->a);
-}
-
static int idcomp(const void *a,const void *b)
{
t_param *pa,*pb;
qsort(ps,nr,(size_t)sizeof(ps[0]),idcomp);
}
-static void dump_param(FILE *fp,char *title,int n,t_param ps[])
-{
- int i,j;
-
- fprintf(fp,"%s: %d entries\n",title,n);
- for(i=0; (i<n); i++) {
- fprintf(fp,"%3d: A=[ ",i);
- for(j=0; (j<MAXATOMLIST); j++)
- fprintf(fp," %5d",ps[i].a[j]);
- fprintf(fp,"] C=[");
- for(j=0; (j<MAXFORCEPARAM); j++)
- fprintf(fp," %10.5e",ps[i].c[j]);
- fprintf(fp,"]\n");
- }
-}
-
static int n_hydro(atom_id a[],char ***atomname)
{
int i,nh=0;
if (cudaMalloc((void**)&devTestMem,megsToTest*1048576UL) != cudaSuccess) throw 1;
if (cudaMalloc((void**)&devTempMem,sizeof(uint)*nBlocks) != cudaSuccess) throw 2;
if ( (hostTempMem = (uint*)malloc(sizeof(uint)*nBlocks)) == NULL) throw 3;
- } catch (int allocFailed) {
+ } catch (...) {
// Clear CUDA error flag for outside world
cudaGetLastError();
if (devTempMem) {
bool allocated;
public:
uint initTime;
- memtestState() : nBlocks(1024), nThreads(512), allocated(false), devTestMem(NULL),devTempMem(NULL),hostTempMem(NULL), initTime(0),lcgPeriod(1024) {};
+ memtestState() : nBlocks(1024), nThreads(512), loopIters(0), megsToTest(0), allocated(false), devTestMem(NULL),devTempMem(NULL),hostTempMem(NULL), initTime(0),lcgPeriod(1024) {};
~memtestState() {deallocate();}
uint allocate(uint mbToTest);
#include <ctype.h>
#include "main.h"
#include "macros.h"
-#include "math.h"
+#include <math.h>
#include "futil.h"
#include "statutil.h"
#include "copyrite.h"
void chk_ndx(const char *fn)
{
t_blocka *grps;
- char **grpname=NULL;
+ char **grpname;
int i,j;
grps = init_index(fn,&grpname);
#include "sparsematrix.h"
#include "mtxio.h"
-static void dump_top(FILE *fp,t_topology *top,char *tpr)
-{
- int i,j,k,*types;
-
- fprintf(fp,"; Topology generated from %s by program %s\n",tpr,Program());
- fprintf(fp,"[ defaults ]\n 1 1 no 1.0 1.0\n\n");
- fprintf(fp,"[ atomtypes ]\n");
- fprintf(fp,";name at.num mass charge ptype c6 c12\n");
- snew(types,top->atomtypes.nr);
- for(i=0; (i<top->atomtypes.nr); i++) {
- for(j=0; (j<top->atoms.nr) && (top->atoms.atom[j].type != i); j++)
- ;
- if (j<top->atoms.nr) {
- types[i] = j;
- fprintf(fp,"%5s %4d %8.4f %8.4f %2s %8.3f %8.3f\n",
- *(top->atoms.atomtype[j]),top->atomtypes.atomnumber[i],
- 0.0,0.0,"A",0.0,0.0);
- }
- }
- fprintf(fp,"[ nonbonded_params ]\n");
- for(i=k=0; (i<top->idef.ntypes); i++) {
- for(j=0; (j<top->idef.ntypes); j++,k++) {
- fprintf(fp,"%12s %12s 1 %12.5e %12.5e\n",
- *(top->atoms.atomtype[types[i]]),
- *(top->atoms.atomtype[types[j]]),
- top->idef.iparams[k].lj.c12,top->idef.iparams[k].lj.c6);
- }
- }
- sfree(types);
-}
static void list_tpx(const char *fn, gmx_bool bShowNumbers,const char *mdpfn,
gmx_bool bSysTop)
/*pr_doubles(stdout,indent,"therm_integral",state.therm_integral,state.ngtc);*/
pr_rvecs(stdout,indent,"x",tpx.bX ? state.x : NULL,state.natoms);
pr_rvecs(stdout,indent,"v",tpx.bV ? state.v : NULL,state.natoms);
- if (state,tpx.bF) {
+ if (tpx.bF) {
pr_rvecs(stdout,indent,"f",f,state.natoms);
}
}
int ndr;
ener_file_t in;
gmx_bool bCont;
- gmx_enxnm_t *enm=NULL;
+ gmx_enxnm_t *enm;
t_enxframe *fr;
int i,j,nre,b;
real rav,minthird;
{ efTOP, "-pp", "processed", ffOPTWR },
{ efTPX, "-o", NULL, ffWRITE },
{ efTRN, "-t", NULL, ffOPTRD },
- { efEDR, "-e", NULL, ffOPTRD }
+ { efEDR, "-e", NULL, ffOPTRD },
+ { efTRN, "-ref","rotref", ffOPTRW }
};
#define NFILE asize(fnm)
"NB: United atoms have the same atom numbers as normal ones.\n\n");
}
+ if (ir->bAdress) {
+ if ((ir->adress->const_wf>1) || (ir->adress->const_wf<0)) {
+ warning_error(wi,"AdResS contant weighting function should be between 0 and 1\n\n");
+ }
+ /** \TODO check size of ex+hy width against box size */
+ }
+
/* Check for errors in the input now, since they might cause problems
* during processing further down.
*/
/* make exclusions between QM atoms */
if (ir->bQMMM) {
- generate_qmexcl(sys,ir);
+ if (ir->QMMMscheme==eQMMMschemenormal && ir->ns_type == ensSIMPLE ){
+ gmx_fatal(FARGS,"electrostatic embedding only works with grid neighboursearching, use ns-type=grid instead\n");
+ }
+ else {
+ generate_qmexcl(sys,ir,wi);
+ }
}
if (ftp2bSet(efTRN,NFILE,fnm)) {
if (ir->ePull != epullNO)
set_pull_init(ir,sys,state.x,state.box,oenv,opts->pull_start);
+
+ if (ir->bRot)
+ {
+ set_reference_positions(ir->rot,sys,state.x,state.box,
+ opt2fn("-ref",NFILE,fnm),opt2bSet("-ref",NFILE,fnm),
+ wi);
+ }
/* reset_multinr(sys); */
hack->newx[i]=NOTSET;
}
-static void dump_h_db(const char *fn,int nah,t_hackblock *ah)
-{
- FILE *fp;
- char buf[STRLEN],nname[STRLEN];
- int i,j,k;
-
- sprintf(buf,"%s_new.hdb",fn);
- fp = gmx_fio_fopen(buf,"w");
- for(i=0; (i<nah); i++) {
- fprintf(fp,"%-8s%-8d\n",ah[i].name,ah[i].nhack);
- for(k=0; (k<ah[i].nhack); k++) {
- strcpy(nname,ah[i].hack[k].a[0]);
- nname[0] = 'H';
- print_ab(fp,&ah[i].hack[k],nname);
- }
- }
- gmx_fio_fclose(fp);
-}
-
static void read_h_db_file(const char *hfn,int *nahptr,t_hackblock **ah)
{
FILE *in;
polar2cart(phi,theta,v);
}
-real electron_cross_section(FILE *fp,rvec v,real mass,int nelec)
-{
- /* Compute cross section for electrons */
- real T,B,U,S,Q,R,N,t,u,lnt,sigma;
- real a0 = 0.05292; /* nm */
-
- /* Have to determine T (kinetic energy of electron) */
- T = 0.5*mass*iprod(v,v);
-
- /* R is the binding energy of the electron in hydrogen */
- R = 13.61*ELECTRONVOLT;
-
- /* Have to determine the binding energy B, differs per orbital of course */
- B = R;
-
- /* Have to determine the orbital kinetic energy U */
- U = R;
-
- /* Have to know number of electrons */
- N = nelec;
-
- /* Magic constant Q */
- Q = 1;
-
- /* Some help variables */
- t = T/B;
- u = U/B;
- S = 4*M_PI*sqr(a0)*N*sqr(R/B);
- lnt = log(t);
-
- /* Resulting variable */
- sigma = (S/(t+u+1))*( 0.5*Q*lnt*(1-1/sqr(t)) + (2-Q)*(1-1/t-lnt/(t+1)) );
-
- return sigma;
-}
-
gmx_bool khole_decay(FILE *fp,t_cross_atom *ca,rvec x[],rvec v[],int ion,
int *seed,real dt)
{
+++ /dev/null
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: libgmxpreprocess
-Description: Gromacs preprocess lib
-URL: http://www.gromacs.org
-Version: @VERSION@
-Requires: libgmx@LIBSUFFIX@ libmd@LIBSUFFIX@
-Libs: -L${libdir} -lgmxpreprocess@LIBSUFFIX@ @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ -lm
-Cflags: -I${includedir} @PTHREAD_CFLAGS@ @PKG_CFLAGS@
-
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
if (DEFORM(*ir))
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&deform_init_box_mutex);
#endif
set_deform_reference_box(upd,
deform_init_init_step_tpx,
deform_init_box_tpx);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&deform_init_box_mutex);
#endif
}
/* Check whether everything is still allright */
if (((int)gmx_get_stop_condition() > handled_stop_condition)
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
&& MASTER(cr)
#endif
)
#include "string2.h"
#include "copyrite.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
t_vcm *vcm;
int nchkpt=1;
gmx_localtop_t *top;
- t_mdebin *mdebin=NULL;
+ t_mdebin *mdebin;
t_state *state=NULL;
rvec *f_global=NULL;
int n_xtc=-1;
/* Check whether everything is still allright */
if (((int)gmx_get_stop_condition() > handled_stop_condition)
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
&& MASTER(cr)
#endif
)
#include "mdrun.h"
#include "xmdrun.h"
#include "checkpoint.h"
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "thread_mpi.h"
#endif
{ efXVG, "-dhdl", "dhdl", ffOPTWR },
{ efXVG, "-field", "field", ffOPTWR },
{ efXVG, "-table", "table", ffOPTRD },
+ { efXVG, "-tabletf", "tabletf", ffOPTRD },
{ efXVG, "-tablep", "tablep", ffOPTRD },
{ efXVG, "-tableb", "table", ffOPTRD },
{ efTRX, "-rerun", "rerun", ffOPTRD },
{ efXVG, "-runav", "runaver", ffOPTWR },
{ efXVG, "-px", "pullx", ffOPTWR },
{ efXVG, "-pf", "pullf", ffOPTWR },
+ { efXVG, "-ro", "rotation", ffOPTWR },
+ { efLOG, "-ra", "rotangles",ffOPTWR },
+ { efLOG, "-rs", "rotslabs", ffOPTWR },
+ { efLOG, "-rt", "rottorque",ffOPTWR },
{ efMTX, "-mtx", "nm", ffOPTWR },
{ efNDX, "-dn", "dipole", ffOPTWR },
{ efRND, "-multidir",NULL, ffOPTRDMULT}
"Use particle decompostion" },
{ "-dd", FALSE, etRVEC,{&realddxyz},
"Domain decomposition grid, 0 is optimize" },
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
{ "-nt", FALSE, etINT, {&nthreads},
"Number of threads to start (0 is guess)" },
#endif
dd_node_order = nenum(ddno_opt);
cr->npmenodes = npme;
-#ifndef GMX_THREADS
+#ifndef GMX_THREAD_MPI
nthreads=1;
#endif
gmx_fatal(FARGS,"Need at least two replicas for replica exchange (option -multi)");
if (nmultisim > 1) {
-#ifndef GMX_THREADS
+#ifndef GMX_THREAD_MPI
gmx_bool bParFn = (multidir == NULL);
init_multisystem(cr, nmultisim, multidir, NFILE, fnm, bParFn);
#else
return fff;
}
-real uhat1D(int porder,real k1,real h1)
-{
- real fac1;
- real fff;
- int i;
-
- fac1 = sinx_x(k1*h1*0.5);
-
- fff = 1;
- for(i=1; (i<=porder+1); i++)
- fff *= fac1;
-
- if (fabs(fff) < tol)
- return 0.0;
- else
- return fff;
-}
-
real shat(real acut,real kmag,real r1)
{
return gk(kmag,acut,r1);
return tmp*tmp;
}
-real usqsq1D(int porder,real k1,real h1)
-{
- const real tt=2.0/3.0;
- const real tx=2.0/15.0;
- real t1,t12,tmp;
-
- t1 = sin(k1*h1*0.5);
- t12 = t1*t1;
-
- if (porder == 1)
- tmp = (1.0-tt*t12);
- else if (porder == 2)
- tmp = ( (1.0 - t12 + tx*t12*t12));
- else
- gmx_fatal(FARGS,"porder = %d in usqsq",porder);
-
- return tmp*tmp;
-}
-
real ursum(int term,int porder,real acut,real r1,
real k1,real k2,real k3,real h1,real h2,real h3,int nalias)
{
return urs;
}
-real ursum1D(int term,int porder,real acut,real r1,real k1,real h1,int nalias)
-{
- real kt,ksq,kmag;
-/* real kcutsq; */
- real kn1,urs,tmp;
- real h_1;
- int n1;
-
- real twopi=2*M_PI;
- h_1=twopi/h1;
- /*
- c
- c for large enough values of k, the terms become negligable
- c if shat(k) = exp(-k^2/4*acut) < eps
- c kcutsq = 4*alpha* (-ln(eps))
- c eps = 10^-6, -ln(eps) = 14
- c eps = 10^-10, -ln(eps) = 23
- c eps = 10^-20, -ln(eps) = 46
- c
- */
-/* kcutsq = 4.0*acut*115; */
-
- if (nalias==0) {
- if (term==1) kt = k1;
- ksq = k1*k1;
- kmag = sqrt(ksq);
- tmp = uhat1D(porder,k1,h1);
- urs = tmp*tmp*kt*shat(acut,kmag,r1)/(EPSILON0*ksq);
- }
- else {
- urs = 0.0;
- for(n1 = -nalias; (n1<= nalias); n1++) {
- kn1 = k1 + n1*h_1;
- ksq = kn1*kn1;
- /*c if (ksq.lt.kcutsq) then*/
- if (term==XX) kt = kn1;
- if (kt != 0.0) {
- kmag = sqrt(ksq);
- tmp = uhat1D(porder,kn1,h1);
- if (tmp != 0.0)
- urs = urs + tmp*tmp*kt*shat(acut,kmag,r1)/(EPSILON0*ksq);
- }
- /*c endif*/
- }
- }
- return urs;
-}
-
real sym(int indx,int maxind)
{
if ( (indx == 0 ) || (indx == maxind/2) )
*qqopt = qopt/(EPSILON0*box1*box2*box3);
}
-void calc1D(gmx_bool bSym,gmx_bool bVerbose,
- const int n1max,const int n2max,const int n3max,
- const real h1,const real h2,const real h3,
- int nalias,int porder,real acut,real r1,const real alpha,
- const gmx_bool bSearch,
- real ***ghat,real *ppval,real *zzval,real *eeref,real *qqopt)
-{
- real box1,box2,box3;
- real k1,k2,k3;
- real gnumer,dsq,gdenom;
- real rsqal;
- real symfac;
- int l1;
- real twopi=2*M_PI;
- real d1,u1;
- real pval,zval,eref,qopt;
- int N1MAX;
-/* int N2MAX,N3MAX; */
-
- if (bSym) {
- N1MAX = n1max/2+1;
-/* N2MAX = n2max/2+1; */
-/* N3MAX = n3max/2+1; */
- }
- else {
- N1MAX = n1max;
-/* N2MAX = n2max; */
-/* N3MAX = n3max; */
- }
-
- box1 = n1max*h1;
- box2 = n2max*h2;
- box3 = n3max*h3;
-
- pval = 0.0;
- zval = 0.0;
- eref = 0.0;
- qopt = 0.0;
-
- k2 = k3 = 0;
-
- for(l1=0; (l1<N1MAX); l1++) {
- if (bVerbose)
- fprintf(stderr,"\rl1=%5d qopt=%12.6e",l1,qopt);
-
- k1 = twopi*l1/box1;
- d1 = dhat(alpha,k1,h1);
-
- if (l1 == 0)
- ghat[0][0][0] = 0.0;
- else {
- u1 = ursum1D(XX,porder,acut,r1,k1,h1,nalias);
-
- gnumer = d1*u1;
- dsq = d1*d1;
- gdenom = dsq*usqsq(porder,k1,k2,k3,h1,h2,h3);
- if (bSym)
- symfac = sym(l1,n1max);
- else
- symfac = 1.0;
-
- rsqal = crsqal(acut,r1,k1,k2,k3,h1,h2,h3,nalias);
-
- if (gdenom != 0)
- qopt += symfac*(rsqal - (gnumer*gnumer)/gdenom);
- }
- }
- if (bVerbose)
- fprintf(stderr,"\n");
- *ppval = pval/(box1*box2*box3);
- *zzval = zval/(box1*box2*box3);
- *eeref = eref/(box1*box2*box3);
- *qqopt = qopt/(box1*box2*box3);
-}
-
void read_params(char *fn,t_inputrec *ir,rvec boxs)
{
real t,lambda;
if (pluginDir != NULL && *pluginDir != '\0')
{
loadedPlugins = Platform::loadPluginsFromDirectory(pluginDir);
- if (loadedPlugins.size() > 0)
+ if (!loadedPlugins.empty())
{
hasLoadedPlugins = true;
usedPluginDir = pluginDir;
if (!hasLoadedPlugins)
{
loadedPlugins = Platform::loadPluginsFromDirectory(OPENMM_PLUGIN_DIR);
- if (loadedPlugins.size() > 0)
+ if (!loadedPlugins.empty())
{
hasLoadedPlugins = true;
usedPluginDir = OPENMM_PLUGIN_DIR;
if (!hasLoadedPlugins)
{
loadedPlugins = Platform::loadPluginsFromDirectory(Platform::getDefaultPluginsDirectory());
- if (loadedPlugins.size() > 0)
+ if (!loadedPlugins.empty())
{
hasLoadedPlugins = true;
usedPluginDir = Platform::getDefaultPluginsDirectory();
return select_res(eargNR,resnr,lh,expl,"ARGININE",nrr,rr);
}
-static const char *get_cystp(int resnr,int nrr,const rtprename_t *rr)
-{
- enum { ecys, ecysH, ecysNR };
- const char *lh[ecysNR] = { "CYS2", "CYS" };
- const char *expl[ecysNR] = {
- "Cysteine in disulfide bridge",
- "Protonated"
- };
-
- return select_res(ecysNR,resnr,lh,expl,"CYSTEINE",nrr,rr);
-
-}
-
static const char *get_histp(int resnr,int nrr,const rtprename_t *rr)
{
const char *expl[ehisNR] = {
for(i=0; i<nrrn; i++) {
fp = fflib_open(rrn[i]);
read_rtprename(rrn[i],fp,&nrtprename,&rtprename);
- fclose(fp);
+ ffclose(fp);
sfree(rrn[i]);
}
sfree(rrn);
sfree(model[nwm]);
}
}
- fclose(fp);
+ ffclose(fp);
fprintf(stderr,"%2d: %s\n",nwm+1,"None");
do
else
{
strncpy(ffdir_parent,ffdir,STRLEN-1);
+ ffdir_parent[STRLEN-1]='\0'; /*make sure it is 0-terminated even for long string*/
p=strrchr(ffdir_parent,'/');
*p='\0';
}
}
-static gmx_bool inter_res_bond(const t_rbonded *b)
-{
- return (b->AI[0] == '-' || b->AI[0] == '+' ||
- b->AJ[0] == '-' || b->AJ[0] == '+');
-}
-
static void at2bonds(t_params *psb, t_hackblock *hb,
t_atoms *atoms,
rvec x[],
int nres = atoms->nres;
gmx_bool bAddCMAP;
atom_id cmap_atomid[NUM_CMAP_ATOMS];
- int cmap_chainnum, this_residue_index;
+ int cmap_chainnum=-1, this_residue_index;
if (debug)
ptr = "cmap";
#endif
#include "string2.h"
#include "pgutil.h"
-#include "string.h"
+#include <string.h>
#include "gmx_fatal.h"
#define BUFSIZE 1024
--- /dev/null
+/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
+ *
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * VERSION 4.6.0
+ * Written by Christoph Junghans, Brad Lambeth, and possibly others.
+ * Copyright (c) 2009 Christoph Junghans, Brad Lambeth.
+ * All rights reserved.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ *
+ * And Hey:
+ * GROningen Mixture of Alchemy and Childrens' Stories
+ */
+
+#include "readir.h"
+#include "names.h"
+#include "smalloc.h"
+#include "gmx_fatal.h"
+
+#define MAXPTR 254
+
+static char adress_refs[STRLEN],adress_tf_grp_names[STRLEN], adress_cg_grp_names[STRLEN];
+
+void read_adressparams(int *ninp_p,t_inpfile **inp_p,t_adress *adress, warninp_t wi)
+{
+ int nadress_refs,i;
+ const char *tmp;
+ char *ptr1[MAXPTR];
+
+
+ int ninp;
+ t_inpfile *inp;
+
+ ninp = *ninp_p;
+ inp = *inp_p;
+
+ EETYPE("adress_type", adress->type, eAdresstype_names);
+ RTYPE ("adress_const_wf", adress->const_wf, 1);
+ RTYPE ("adress_ex_width", adress->ex_width, 0);
+ RTYPE ("adress_hy_width", adress->hy_width, 0);
+ RTYPE ("adress_ex_forcecap", adress->ex_forcecap, 0);
+ EETYPE("adress_interface_correction",adress->icor, eAdressICtype_names);
+ EETYPE("adress_site", adress->site, eAdressSITEtype_names);
+ STYPE ("adress_reference_coords", adress_refs, NULL);
+ STYPE ("adress_tf_grp_names", adress_tf_grp_names, NULL);
+ STYPE ("adress_cg_grp_names", adress_cg_grp_names, NULL);
+ EETYPE("adress_do_hybridpairs", adress->do_hybridpairs, yesno_names);
+
+ nadress_refs = str_nelem(adress_refs,MAXPTR,ptr1);
+
+ for(i=0; (i<nadress_refs); i++) /*read vector components*/
+ adress->refs[i]=strtod(ptr1[i],NULL);
+ for( ;(i<DIM); i++) /*remaining undefined components of the vector set to zero*/
+ adress->refs[i]=0;
+}
+
+void do_adress_index(t_adress *adress, gmx_groups_t *groups,char **gnames,t_grpopts *opts,warninp_t wi){
+ int nr,i,j,k;
+ char *ptr1[MAXPTR];
+ int nadress_cg_grp_names, nadress_tf_grp_names;
+
+ /* AdResS coarse grained groups input */
+
+ nr = groups->grps[egcENER].nr;
+ snew(adress->group_explicit, nr);
+ for (i=0; i <nr; i++){
+ adress->group_explicit[i] = TRUE;
+ }
+ adress->n_energy_grps = nr;
+
+ nadress_cg_grp_names = str_nelem(adress_cg_grp_names,MAXPTR,ptr1);
+
+ if (nadress_cg_grp_names > 0){
+ for (i=0; i <nadress_cg_grp_names; i++){
+ /* search for the group name mathching the tf group name */
+ k = 0;
+ while ((k < nr) &&
+ gmx_strcasecmp(ptr1[i],(char*)(gnames[groups->grps[egcENER].nm_ind[k]])))
+ k++;
+ if (k==nr) gmx_fatal(FARGS,"Adress cg energy group %s not found\n",ptr1[i]);
+ adress->group_explicit[k] = FALSE;
+ printf ("AdResS: Energy group %s is treated as coarse-grained \n",
+ (char*)(gnames[groups->grps[egcENER].nm_ind[k]]));
+ }
+ /* set energy group exclusions between all coarse-grained and explicit groups */
+ for (j = 0; j < nr; j++) {
+ for (k = 0; k < nr; k++) {
+ if (!(adress->group_explicit[k] == adress->group_explicit[j])){
+ opts->egp_flags[nr * j + k] |= EGP_EXCL;
+ if (debug) fprintf(debug,"AdResS excl %s %s \n",
+ (char*)(gnames[groups->grps[egcENER].nm_ind[j]]),
+ (char*)(gnames[groups->grps[egcENER].nm_ind[k]]));
+ }
+ }
+ }
+ }else{
+ warning(wi,"For an AdResS simulation at least one coarse-grained energy group has to be specified in adress_cg_grp_names");
+ }
+
+
+ /* AdResS multiple tf tables input */
+ nadress_tf_grp_names = str_nelem(adress_tf_grp_names,MAXPTR,ptr1);
+ adress->n_tf_grps = nadress_tf_grp_names;
+ snew(adress->tf_table_index, nadress_tf_grp_names);
+
+ nr = groups->grps[egcENER].nr;
+
+ if (nadress_tf_grp_names > 0){
+ for (i=0; i <nadress_tf_grp_names; i++){
+ /* search for the group name mathching the tf group name */
+ k = 0;
+ while ((k < nr) &&
+ gmx_strcasecmp(ptr1[i],(char*)(gnames[groups->grps[egcENER].nm_ind[k]])))
+ k++;
+ if (k==nr) gmx_fatal(FARGS,"Adress tf energy group %s not found\n",ptr1[i]);
+
+ adress->tf_table_index[i] = k;
+ if (debug) fprintf(debug,"found tf group %s id %d \n",ptr1[i], k);
+ if (adress->group_explicit[k]){
+ gmx_fatal(FARGS,"Thermodynamic force group %s is not a coarse-grained group in adress_cg_grp_names. The thermodynamic force has to act on the coarse-grained vsite of a molecule.\n",ptr1[i]);
+ }
+
+ }
+ }
+ /* end AdResS multiple tf tables input */
+
+
+}
wall_atomtype[STRLEN],wall_density[STRLEN],deform[STRLEN],QMMM[STRLEN];
static char foreign_lambda[STRLEN];
static char **pull_grp;
+static char **rot_grp;
static char anneal[STRLEN],anneal_npoints[STRLEN],
anneal_time[STRLEN],anneal_temp[STRLEN];
static char QMmethod[STRLEN],QMbasis[STRLEN],QMcharge[STRLEN],QMmult[STRLEN],
{
dt_pcoupl = ir->nstpcouple*ir->delta_t;
- sprintf(err_buf,"tau_p must be > 0 instead of %g\n",ir->tau_p);
+ sprintf(err_buf,"tau-p must be > 0 instead of %g\n",ir->tau_p);
CHECK(ir->tau_p <= 0);
if (ir->tau_p/dt_pcoupl < pcouple_min_integration_steps(ir->epc))
{
- sprintf(warn_buf,"For proper integration of the %s barostat, tau_p (%g) should be at least %d times larger than nstpcouple*dt (%g)",
+ sprintf(warn_buf,"For proper integration of the %s barostat, tau-p (%g) should be at least %d times larger than nstpcouple*dt (%g)",
EPCOUPLTYPE(ir->epc),ir->tau_p,pcouple_min_integration_steps(ir->epc),dt_pcoupl);
warning(wi,warn_buf);
}
}
if (ir->epsilon_r!=1 && ir->implicit_solvent==eisGBSA) {
- sprintf(warn_buf,"epsilon_r = %g with GB implicit solvent, will use this value for inner dielectric",ir->epsilon_r);
+ sprintf(warn_buf,"epsilon-r = %g with GB implicit solvent, will use this value for inner dielectric",ir->epsilon_r);
warning_note(wi,warn_buf);
}
if (EEL_RF(ir->coulombtype) && ir->epsilon_rf==1 && ir->epsilon_r!=1) {
- sprintf(warn_buf,"epsilon_r = %g and epsilon_rf = 1 with reaction field, assuming old format and exchanging epsilon_r and epsilon_rf",ir->epsilon_r);
+ sprintf(warn_buf,"epsilon-r = %g and epsilon-rf = 1 with reaction field, assuming old format and exchanging epsilon-r and epsilon-rf",ir->epsilon_r);
warning(wi,warn_buf);
ir->epsilon_rf = ir->epsilon_r;
ir->epsilon_r = 1.0;
}
if (getenv("GALACTIC_DYNAMICS") == NULL) {
- sprintf(err_buf,"epsilon_r must be >= 0 instead of %g\n",ir->epsilon_r);
+ sprintf(err_buf,"epsilon-r must be >= 0 instead of %g\n",ir->epsilon_r);
CHECK(ir->epsilon_r < 0);
}
/* reaction field (at the cut-off) */
if (ir->coulombtype == eelRF_ZERO) {
- sprintf(err_buf,"With coulombtype = %s, epsilon_rf must be 0",
+ sprintf(err_buf,"With coulombtype = %s, epsilon-rf must be 0",
eel_names[ir->coulombtype]);
CHECK(ir->epsilon_rf != 0);
}
- sprintf(err_buf,"epsilon_rf must be >= epsilon_r");
+ sprintf(err_buf,"epsilon-rf must be >= epsilon-r");
CHECK((ir->epsilon_rf < ir->epsilon_r && ir->epsilon_rf != 0) ||
(ir->epsilon_r == 0));
if (ir->epsilon_rf == ir->epsilon_r) {
- sprintf(warn_buf,"Using epsilon_rf = epsilon_r with %s does not make sense",
+ sprintf(warn_buf,"Using epsilon-rf = epsilon-r with %s does not make sense",
eel_names[ir->coulombtype]);
warning(wi,warn_buf);
}
if (EEL_PME(ir->coulombtype)) {
if (ir->pme_order < 3) {
- warning_error(wi,"pme_order can not be smaller than 3");
+ warning_error(wi,"pme-order can not be smaller than 3");
}
}
if (ir->nwall==2 && EEL_FULL(ir->coulombtype)) {
if (ir->ewald_geometry == eewg3D) {
- sprintf(warn_buf,"With pbc=%s you should use ewald_geometry=%s",
+ sprintf(warn_buf,"With pbc=%s you should use ewald-geometry=%s",
epbc_names[ir->ePBC],eewg_names[eewg3DC]);
warning(wi,warn_buf);
}
/* This check avoids extra pbc coding for exclusion corrections */
- sprintf(err_buf,"wall_ewald_zfac should be >= 2");
+ sprintf(err_buf,"wall-ewald-zfac should be >= 2");
CHECK(ir->wall_ewald_zfac < 2);
}
if (EVDW_SWITCHED(ir->vdwtype)) {
- sprintf(err_buf,"With vdwtype = %s rvdw_switch must be < rvdw",
+ sprintf(err_buf,"With vdwtype = %s rvdw-switch must be < rvdw",
evdw_names[ir->vdwtype]);
CHECK(ir->rvdw_switch >= ir->rvdw);
} else if (ir->vdwtype == evdwCUT) {
ir->implicit_solvent=eisGBSA;
fprintf(stderr,"Note: Old option for generalized born electrostatics given:\n"
"Changing coulombtype from \"generalized-born\" to \"cut-off\" and instead\n"
- "setting implicit_solvent value to \"GBSA\" in input section.\n");
+ "setting implicit-solvent value to \"GBSA\" in input section.\n");
}
if(ir->sa_algorithm==esaSTILL)
}
}
+
+ if (ir->bAdress && !EI_SD(ir->eI)){
+ warning_error(wi,"AdresS simulation supports only stochastic dynamics");
+ }
+ if (ir->bAdress && ir->epc != epcNO){
+ warning_error(wi,"AdresS simulation does not support pressure coupling");
+ }
+ if (ir->bAdress && (EEL_PME(ir->coulombtype))){
+ warning_error(wi,"AdresS simulation does not support long-range electrostatics");
+ }
+
}
-static int str_nelem(const char *str,int maxptr,char *ptr[])
+int str_nelem(const char *str,int maxptr,char *ptr[])
{
int np=0;
char *copy0,*copy;
nstr = str_nelem(wall_density,MAXPTR,names);
if (nstr != ir->nwall)
{
- gmx_fatal(FARGS,"Expected %d elements for wall_density, found %d",ir->nwall,nstr);
+ gmx_fatal(FARGS,"Expected %d elements for wall-density, found %d",ir->nwall,nstr);
}
for(i=0; i<ir->nwall; i++)
{
sscanf(names[i],"%lf",&dbl);
if (dbl <= 0)
{
- gmx_fatal(FARGS,"wall_density[%d] = %f\n",i,dbl);
+ gmx_fatal(FARGS,"wall-density[%d] = %f\n",i,dbl);
}
ir->wall_density[i] = dbl;
}
RTYPE ("dt", ir->delta_t, 0.001);
STEPTYPE ("nsteps", ir->nsteps, 0);
CTYPE ("For exact run continuation or redoing part of a run");
- STEPTYPE ("init_step",ir->init_step, 0);
+ STEPTYPE ("init-step",ir->init_step, 0);
CTYPE ("Part index is updated automatically on checkpointing (keeps files separate)");
- ITYPE ("simulation_part", ir->simulation_part, 1);
+ ITYPE ("simulation-part", ir->simulation_part, 1);
CTYPE ("mode for center of mass motion removal");
EETYPE("comm-mode", ir->comm_mode, ecm_names);
CTYPE ("number of steps for center of mass motion removal");
CTYPE ("Force tolerance and initial step-size");
RTYPE ("emtol", ir->em_tol, 10.0);
RTYPE ("emstep", ir->em_stepsize,0.01);
- CTYPE ("Max number of iterations in relax_shells");
+ CTYPE ("Max number of iterations in relax-shells");
ITYPE ("niter", ir->niter, 20);
CTYPE ("Step size (ps^2) for minimization of flexible constraints");
RTYPE ("fcstep", ir->fc_stepsize, 0);
ir->ndelta = 2;
CTYPE ("Periodic boundary conditions: xyz, no, xy");
EETYPE("pbc", ir->ePBC, epbc_names);
- EETYPE("periodic_molecules", ir->bPeriodicMols, yesno_names);
+ EETYPE("periodic-molecules", ir->bPeriodicMols, yesno_names);
CTYPE ("nblist cut-off");
RTYPE ("rlist", ir->rlist, 1.0);
CTYPE ("long-range cut-off for switched potentials");
RTYPE ("rcoulomb-switch", ir->rcoulomb_switch, 0.0);
RTYPE ("rcoulomb", ir->rcoulomb, 1.0);
CTYPE ("Relative dielectric constant for the medium and the reaction field");
- RTYPE ("epsilon_r", ir->epsilon_r, 1.0);
- RTYPE ("epsilon_rf", ir->epsilon_rf, 1.0);
+ RTYPE ("epsilon-r", ir->epsilon_r, 1.0);
+ RTYPE ("epsilon-rf", ir->epsilon_rf, 0.0);
CTYPE ("Method for doing Van der Waals");
EETYPE("vdw-type", ir->vdwtype, evdw_names);
CTYPE ("cut-off lengths");
CTYPE ("Extension of the potential lookup tables beyond the cut-off");
RTYPE ("table-extension", ir->tabext, 1.0);
CTYPE ("Seperate tables between energy group pairs");
- STYPE ("energygrp_table", egptable, NULL);
+ STYPE ("energygrp-table", egptable, NULL);
CTYPE ("Spacing for the PME/PPPM FFT grid");
RTYPE ("fourierspacing", opts->fourierspacing,0.12);
CTYPE ("FFT grid size, when a value is 0 fourierspacing will be used");
- ITYPE ("fourier_nx", ir->nkx, 0);
- ITYPE ("fourier_ny", ir->nky, 0);
- ITYPE ("fourier_nz", ir->nkz, 0);
+ ITYPE ("fourier-nx", ir->nkx, 0);
+ ITYPE ("fourier-ny", ir->nky, 0);
+ ITYPE ("fourier-nz", ir->nkz, 0);
CTYPE ("EWALD/PME/PPPM parameters");
- ITYPE ("pme_order", ir->pme_order, 4);
- RTYPE ("ewald_rtol", ir->ewald_rtol, 0.00001);
- EETYPE("ewald_geometry", ir->ewald_geometry, eewg_names);
- RTYPE ("epsilon_surface", ir->epsilon_surface, 0.0);
- EETYPE("optimize_fft",ir->bOptFFT, yesno_names);
+ ITYPE ("pme-order", ir->pme_order, 4);
+ RTYPE ("ewald-rtol", ir->ewald_rtol, 0.00001);
+ EETYPE("ewald-geometry", ir->ewald_geometry, eewg_names);
+ RTYPE ("epsilon-surface", ir->epsilon_surface, 0.0);
+ EETYPE("optimize-fft",ir->bOptFFT, yesno_names);
CCTYPE("IMPLICIT SOLVENT ALGORITHM");
- EETYPE("implicit_solvent", ir->implicit_solvent, eis_names);
+ EETYPE("implicit-solvent", ir->implicit_solvent, eis_names);
CCTYPE ("GENERALIZED BORN ELECTROSTATICS");
CTYPE ("Algorithm for calculating Born radii");
- EETYPE("gb_algorithm", ir->gb_algorithm, egb_names);
+ EETYPE("gb-algorithm", ir->gb_algorithm, egb_names);
CTYPE ("Frequency of calculating the Born radii inside rlist");
ITYPE ("nstgbradii", ir->nstgbradii, 1);
CTYPE ("Cutoff for Born radii calculation; the contribution from atoms");
CTYPE ("between rlist and rgbradii is updated every nstlist steps");
RTYPE ("rgbradii", ir->rgbradii, 1.0);
CTYPE ("Dielectric coefficient of the implicit solvent");
- RTYPE ("gb_epsilon_solvent",ir->gb_epsilon_solvent, 80.0);
+ RTYPE ("gb-epsilon-solvent",ir->gb_epsilon_solvent, 80.0);
CTYPE ("Salt concentration in M for Generalized Born models");
- RTYPE ("gb_saltconc", ir->gb_saltconc, 0.0);
+ RTYPE ("gb-saltconc", ir->gb_saltconc, 0.0);
CTYPE ("Scaling factors used in the OBC GB model. Default values are OBC(II)");
- RTYPE ("gb_obc_alpha", ir->gb_obc_alpha, 1.0);
- RTYPE ("gb_obc_beta", ir->gb_obc_beta, 0.8);
- RTYPE ("gb_obc_gamma", ir->gb_obc_gamma, 4.85);
- RTYPE ("gb_dielectric_offset", ir->gb_dielectric_offset, 0.009);
- EETYPE("sa_algorithm", ir->sa_algorithm, esa_names);
+ RTYPE ("gb-obc-alpha", ir->gb_obc_alpha, 1.0);
+ RTYPE ("gb-obc-beta", ir->gb_obc_beta, 0.8);
+ RTYPE ("gb-obc-gamma", ir->gb_obc_gamma, 4.85);
+ RTYPE ("gb-dielectric-offset", ir->gb_dielectric_offset, 0.009);
+ EETYPE("sa-algorithm", ir->sa_algorithm, esa_names);
CTYPE ("Surface tension (kJ/mol/nm^2) for the SA (nonpolar surface) part of GBSA");
CTYPE ("The value -1 will set default value for Still/HCT/OBC GB-models.");
- RTYPE ("sa_surface_tension", ir->sa_surface_tension, -1);
+ RTYPE ("sa-surface-tension", ir->sa_surface_tension, -1);
/* Coupling stuff */
CCTYPE ("OPTIONS FOR WEAK COUPLING ALGORITHMS");
CTYPE ("Time constant (ps) and reference temperature (K)");
STYPE ("tau-t", tau_t, NULL);
STYPE ("ref-t", ref_t, NULL);
- CTYPE ("Pressure coupling");
- EETYPE("Pcoupl", ir->epc, epcoupl_names);
- EETYPE("Pcoupltype", ir->epct, epcoupltype_names);
+ CTYPE ("pressure coupling");
+ EETYPE("pcoupl", ir->epc, epcoupl_names);
+ EETYPE("pcoupltype", ir->epct, epcoupltype_names);
ITYPE ("nstpcouple", ir->nstpcouple, -1);
CTYPE ("Time constant (ps), compressibility (1/bar) and reference P (bar)");
RTYPE ("tau-p", ir->tau_p, 1.0);
STYPE ("compressibility", dumstr[0], NULL);
STYPE ("ref-p", dumstr[1], NULL);
CTYPE ("Scaling of reference coordinates, No, All or COM");
- EETYPE ("refcoord_scaling",ir->refcoord_scaling,erefscaling_names);
+ EETYPE ("refcoord-scaling",ir->refcoord_scaling,erefscaling_names);
CTYPE ("Random seed for Andersen thermostat");
- ITYPE ("andersen_seed", ir->andersen_seed, 815131);
+ ITYPE ("andersen-seed", ir->andersen_seed, 815131);
/* QMMM */
CCTYPE ("OPTIONS FOR QMMM calculations");
CTYPE ("Type of annealing for each temperature group (no/single/periodic)");
STYPE ("annealing", anneal, NULL);
CTYPE ("Number of time points to use for specifying annealing in each group");
- STYPE ("annealing_npoints", anneal_npoints, NULL);
+ STYPE ("annealing-npoints", anneal_npoints, NULL);
CTYPE ("List of times at the annealing points for each group");
- STYPE ("annealing_time", anneal_time, NULL);
+ STYPE ("annealing-time", anneal_time, NULL);
CTYPE ("Temp. at each annealing point, for each group.");
- STYPE ("annealing_temp", anneal_temp, NULL);
+ STYPE ("annealing-temp", anneal_temp, NULL);
/* Startup run */
CCTYPE ("GENERATE VELOCITIES FOR STARTUP RUN");
/* Energy group exclusions */
CCTYPE ("ENERGY GROUP EXCLUSIONS");
CTYPE ("Pairs of energy groups for which all non-bonded interactions are excluded");
- STYPE ("energygrp_excl", egpexcl, NULL);
+ STYPE ("energygrp-excl", egpexcl, NULL);
/* Walls */
CCTYPE ("WALLS");
CTYPE ("Number of walls, type, atom types, densities and box-z scale factor for Ewald");
ITYPE ("nwall", ir->nwall, 0);
- EETYPE("wall_type", ir->wall_type, ewt_names);
- RTYPE ("wall_r_linpot", ir->wall_r_linpot, -1);
- STYPE ("wall_atomtype", wall_atomtype, NULL);
- STYPE ("wall_density", wall_density, NULL);
- RTYPE ("wall_ewald_zfac", ir->wall_ewald_zfac, 3);
+ EETYPE("wall-type", ir->wall_type, ewt_names);
+ RTYPE ("wall-r-linpot", ir->wall_r_linpot, -1);
+ STYPE ("wall-atomtype", wall_atomtype, NULL);
+ STYPE ("wall-density", wall_density, NULL);
+ RTYPE ("wall-ewald-zfac", ir->wall_ewald_zfac, 3);
/* COM pulling */
CCTYPE("COM PULLING");
- CTYPE("Pull type: no, umbrella, constraint or constant_force");
+ CTYPE("Pull type: no, umbrella, constraint or constant-force");
EETYPE("pull", ir->ePull, epull_names);
if (ir->ePull != epullNO) {
snew(ir->pull,1);
pull_grp = read_pullparams(&ninp,&inp,ir->pull,&opts->pull_start,wi);
}
+
+ /* Enforced rotation */
+ CCTYPE("ENFORCED ROTATION");
+ CTYPE("Enforced rotation: No or Yes");
+ EETYPE("rotation", ir->bRot, yesno_names);
+ if (ir->bRot) {
+ snew(ir->rot,1);
+ rot_grp = read_rotparams(&ninp,&inp,ir->rot,wi);
+ }
/* Refinement */
CCTYPE("NMR refinement stuff");
EETYPE("free-energy", ir->efep, efep_names);
RTYPE ("init-lambda", ir->init_lambda,0.0);
RTYPE ("delta-lambda",ir->delta_lambda,0.0);
- STYPE ("foreign_lambda", foreign_lambda, NULL);
+ STYPE ("foreign-lambda", foreign_lambda, NULL);
RTYPE ("sc-alpha",ir->sc_alpha,0.0);
ITYPE ("sc-power",ir->sc_power,0);
RTYPE ("sc-sigma",ir->sc_sigma,0.3);
EETYPE("separate-dhdl-file", ir->separate_dhdl_file,
separate_dhdl_file_names);
EETYPE("dhdl-derivatives", ir->dhdl_derivatives, dhdl_derivatives_names);
- ITYPE ("dh_hist_size", ir->dh_hist_size, 0);
- RTYPE ("dh_hist_spacing", ir->dh_hist_spacing, 0.1);
+ ITYPE ("dh-hist-size", ir->dh_hist_size, 0);
+ RTYPE ("dh-hist-spacing", ir->dh_hist_spacing, 0.1);
STYPE ("couple-moltype", couple_moltype, NULL);
EETYPE("couple-lambda0", opts->couple_lam0, couple_lam);
EETYPE("couple-lambda1", opts->couple_lam1, couple_lam);
STYPE ("E-z", efield_z, NULL);
STYPE ("E-zt", efield_zt, NULL);
+ /* AdResS defined thingies */
+ CCTYPE ("AdResS parameters");
+ EETYPE("adress", ir->bAdress, yesno_names);
+ if (ir->bAdress) {
+ snew(ir->adress,1);
+ read_adressparams(&ninp,&inp,ir->adress,wi);
+ }
+
/* User defined thingies */
CCTYPE ("User defined thingies");
STYPE ("user1-grps", user1, NULL);
warning(wi,"For proper sampling of the (nearly) decoupled state, stochastic dynamics should be used");
}
} else {
- warning(wi,"Can not couple a molecule with free_energy = no");
+ warning(wi,"Can not couple a molecule with free-energy = no");
}
}
nref_t = str_nelem(ref_t,MAXPTR,ptr2);
ntcg = str_nelem(tcgrps,MAXPTR,ptr3);
if ((ntau_t != ntcg) || (nref_t != ntcg)) {
- gmx_fatal(FARGS,"Invalid T coupling input: %d groups, %d ref_t values and "
- "%d tau_t values",ntcg,nref_t,ntau_t);
+ gmx_fatal(FARGS,"Invalid T coupling input: %d groups, %d ref-t values and "
+ "%d tau-t values",ntcg,nref_t,ntau_t);
}
bSetTCpar = (ir->etc || EI_SD(ir->eI) || ir->eI==eiBD || EI_TPI(ir->eI));
snew(ir->opts.tau_t,nr);
snew(ir->opts.ref_t,nr);
if (ir->eI==eiBD && ir->bd_fric==0) {
- fprintf(stderr,"bd_fric=0, so tau_t will be used as the inverse friction constant(s)\n");
+ fprintf(stderr,"bd-fric=0, so tau-t will be used as the inverse friction constant(s)\n");
}
if (bSetTCpar)
{
if (nr != nref_t)
{
- gmx_fatal(FARGS,"Not enough ref_t and tau_t values!");
+ gmx_fatal(FARGS,"Not enough ref-t and tau-t values!");
}
tau_min = 1e20;
ir->opts.tau_t[i] = strtod(ptr1[i],NULL);
if ((ir->eI == eiBD || ir->eI == eiSD2) && ir->opts.tau_t[i] <= 0)
{
- sprintf(warn_buf,"With integrator %s tau_t should be larger than 0",ei_names[ir->eI]);
+ sprintf(warn_buf,"With integrator %s tau-t should be larger than 0",ei_names[ir->eI]);
warning_error(wi,warn_buf);
}
if ((ir->etc == etcVRESCALE && ir->opts.tau_t[i] >= 0) ||
{
if (tau_min/(ir->delta_t*ir->nsttcouple) < nstcmin)
{
- sprintf(warn_buf,"For proper integration of the %s thermostat, tau_t (%g) should be at least %d times larger than nsttcouple*dt (%g)",
+ sprintf(warn_buf,"For proper integration of the %s thermostat, tau-t (%g) should be at least %d times larger than nsttcouple*dt (%g)",
ETCOUPLTYPE(ir->etc),
tau_min,nstcmin,
ir->nsttcouple*ir->delta_t);
ir->opts.ref_t[i] = strtod(ptr2[i],NULL);
if (ir->opts.ref_t[i] < 0)
{
- gmx_fatal(FARGS,"ref_t for group %d negative",i);
+ gmx_fatal(FARGS,"ref-t for group %d negative",i);
}
}
}
/* Read the other fields too */
nSA_points = str_nelem(anneal_npoints,MAXPTR,ptr1);
if(nSA_points!=nSA)
- gmx_fatal(FARGS,"Found %d annealing_npoints values for %d groups\n",nSA_points,nSA);
+ gmx_fatal(FARGS,"Found %d annealing-npoints values for %d groups\n",nSA_points,nSA);
for(k=0,i=0;i<nr;i++) {
ir->opts.anneal_npoints[i]=strtol(ptr1[i],NULL,10);
if(ir->opts.anneal_npoints[i]==1)
nSA_time = str_nelem(anneal_time,MAXPTR,ptr1);
if(nSA_time!=k)
- gmx_fatal(FARGS,"Found %d annealing_time values, wanter %d\n",nSA_time,k);
+ gmx_fatal(FARGS,"Found %d annealing-time values, wanter %d\n",nSA_time,k);
nSA_temp = str_nelem(anneal_temp,MAXPTR,ptr2);
if(nSA_temp!=k)
- gmx_fatal(FARGS,"Found %d annealing_temp values, wanted %d\n",nSA_temp,k);
+ gmx_fatal(FARGS,"Found %d annealing-temp values, wanted %d\n",nSA_temp,k);
for(i=0,k=0;i<nr;i++) {
if (ir->ePull != epullNO) {
make_pull_groups(ir->pull,pull_grp,grps,gnames);
}
+
+ if (ir->bRot) {
+ make_rotation_groups(ir->rot,rot_grp,grps,gnames);
+ }
nacc = str_nelem(acc,MAXPTR,ptr1);
nacg = str_nelem(accgrps,MAXPTR,ptr2);
nr = groups->grps[egcENER].nr;
snew(ir->opts.egp_flags,nr*nr);
- bExcl = do_egp_flag(ir,groups,"energygrp_excl",egpexcl,EGP_EXCL);
+ bExcl = do_egp_flag(ir,groups,"energygrp-excl",egpexcl,EGP_EXCL);
if (bExcl && EEL_FULL(ir->coulombtype))
warning(wi,"Can not exclude the lattice Coulomb energy between energy groups");
- bTable = do_egp_flag(ir,groups,"energygrp_table",egptable,EGP_TABLE);
+ bTable = do_egp_flag(ir,groups,"energygrp-table",egptable,EGP_TABLE);
if (bTable && !(ir->vdwtype == evdwUSER) &&
!(ir->coulombtype == eelUSER) && !(ir->coulombtype == eelPMEUSER) &&
!(ir->coulombtype == eelPMEUSERSWITCH))
decode_cos(efield_yt,&(ir->et[YY]),TRUE);
decode_cos(efield_z,&(ir->ex[ZZ]),FALSE);
decode_cos(efield_zt,&(ir->et[ZZ]),TRUE);
-
+
+ if (ir->bAdress)
+ do_adress_index(ir->adress,groups,gnames,&(ir->opts),wi);
+
for(i=0; (i<grps->nr); i++)
sfree(gnames[i]);
sfree(gnames);
eel_names[eelGRF]);
CHECK((ir->coulombtype == eelGRF) && (ir->opts.ref_t[0] <= 0));
}
-
- if (ir->eI == eiSD1) {
- gdt_max = 0;
- for(i=0; (i<ir->opts.ngtc); i++)
- gdt_max = max(gdt_max,ir->delta_t/ir->opts.tau_t[i]);
- if (0.5*gdt_max > 0.0015) {
- sprintf(warn_buf,"The relative error with integrator %s is 0.5*delta_t/tau_t = %g, you might want to switch to integrator %s\n",
- ei_names[ir->eI],0.5*gdt_max,ei_names[eiSD2]);
- warning_note(wi,warn_buf);
- }
- }
+ if (ir->eI == eiSD1 &&
+ (gmx_mtop_ftype_count(sys,F_CONSTR) > 0 ||
+ gmx_mtop_ftype_count(sys,F_SETTLE) > 0))
+ {
+ sprintf(warn_buf,"With constraints integrator %s is less accurate, consider using %s instead",ei_names[ir->eI],ei_names[eiSD2]);
+ warning_note(wi,warn_buf);
+ }
+
bAcc = FALSE;
for(i=0; (i<sys->groups.grps[egcACC].nr); i++) {
for(m=0; (m<DIM); m++) {
if (bConstr && ir->eConstrAlg == econtSHAKE) {
if (ir->shake_tol <= 0.0) {
- sprintf(warn_buf,"ERROR: shake_tol must be > 0 instead of %g\n",
+ sprintf(warn_buf,"ERROR: shake-tol must be > 0 instead of %g\n",
ir->shake_tol);
warning_error(wi,warn_buf);
}
}
if ((ir->eI == eiCG || ir->eI == eiLBFGS) && (ir->nProjOrder<8)) {
- sprintf(warn_buf,"For accurate %s with LINCS constraints, lincs_order should be 8 or more.",ei_names[ir->eI]);
+ sprintf(warn_buf,"For accurate %s with LINCS constraints, lincs-order should be 8 or more.",ei_names[ir->eI]);
warning_note(wi,warn_buf);
}
if (ir->epc==epcMTTK) {
* If bStart adds the distance to the initial reference location.
*/
+extern int str_nelem(const char *str,int maxptr,char *ptr[]);
+/* helper function from readir.c to convert strings */
+
+extern void read_adressparams(int *ninp_p,t_inpfile **inp_p,t_adress *adress, warninp_t wi);
+/* Reads in AdResS related parameters */
+
+extern void do_adress_index(t_adress *adress, gmx_groups_t *groups,char **gnames,t_grpopts *opts,warninp_t wi);
+/* Generate adress groups */
+
+extern char **read_rotparams(int *ninp_p,t_inpfile **inp,t_rot *rot,warninp_t wi);
+/* Reads enforced rotation parameters, returns a list of the rot group names */
+
+extern void make_rotation_groups(t_rot *rot,char **rotgnames,
+ t_blocka *grps,char **gnames);
+/* Process the rotation parameters after reading the index groups */
+
+extern void set_reference_positions(t_rot *rot, gmx_mtop_t *mtop, rvec *x, matrix box,
+ const char *fn, gmx_bool bSet, warninp_t wi);
+
#endif /* _readir_h */
#include "symtab.h"
#include "readinp.h"
#include "readir.h"
-#include "string.h"
+#include <string.h>
#include "mdatoms.h"
#include "pbc.h"
#include "pull.h"
--- /dev/null
+/*
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2004, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ *
+ * And Hey:
+ * GROwing Monsters And Cloning Shrimps
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "vec.h"
+#include "smalloc.h"
+#include "readir.h"
+#include "names.h"
+#include "futil.h"
+#include "trnio.h"
+#include "txtdump.h"
+
+static char *RotStr = {"Enforced rotation:"};
+
+
+static char s_vec[STRLEN];
+
+
+static void string2dvec(char buf[], dvec nums)
+{
+ if (sscanf(buf,"%lf%lf%lf",&nums[0],&nums[1],&nums[2]) != 3)
+ gmx_fatal(FARGS,"Expected three numbers at input line %s",buf);
+}
+
+
+extern char **read_rotparams(int *ninp_p,t_inpfile **inp_p,t_rot *rot,
+ warninp_t wi)
+{
+ int ninp,g,m;
+ t_inpfile *inp;
+ const char *tmp;
+ char **grpbuf;
+ char buf[STRLEN];
+ char warn_buf[STRLEN];
+ dvec vec;
+ t_rotgrp *rotg;
+
+ ninp = *ninp_p;
+ inp = *inp_p;
+
+ /* read rotation parameters */
+ CTYPE("Output frequency for angle, torque and rotation potential energy for the whole group");
+ ITYPE("rot_nstrout", rot->nstrout, 100);
+ CTYPE("Output frequency for per-slab data (angles, torques and slab centers)");
+ ITYPE("rot_nstsout", rot->nstsout, 1000);
+ CTYPE("Number of rotation groups");
+ ITYPE("rot_ngroups", rot->ngrp,1);
+
+ if (rot->ngrp < 1)
+ {
+ gmx_fatal(FARGS,"rot_ngroups should be >= 1");
+ }
+
+ snew(rot->grp,rot->ngrp);
+
+ /* Read the rotation groups */
+ snew(grpbuf,rot->ngrp);
+ for(g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ snew(grpbuf[g],STRLEN);
+ CTYPE("Rotation group name");
+ sprintf(buf,"rot_group%d",g);
+ STYPE(buf, grpbuf[g], "");
+
+ CTYPE("Rotation potential. Can be iso, iso-pf, pm, pm-pf, rm, rm-pf, rm2, rm2-pf, flex, flex-t, flex2, flex2-t");
+ sprintf(buf,"rot_type%d",g);
+ ETYPE(buf, rotg->eType, erotg_names);
+
+ CTYPE("Use mass-weighting of the rotation group positions");
+ sprintf(buf,"rot_massw%d",g);
+ ETYPE(buf, rotg->bMassW, yesno_names);
+
+ CTYPE("Rotation vector, will get normalized");
+ sprintf(buf,"rot_vec%d",g);
+ STYPE(buf, s_vec, "1.0 0.0 0.0");
+ string2dvec(s_vec,vec);
+ /* Normalize the rotation vector */
+ if (dnorm(vec) != 0)
+ {
+ dsvmul(1.0/dnorm(vec),vec,vec);
+ }
+ else
+ {
+ sprintf(warn_buf, "rot_vec%d = 0", g);
+ warning_error(wi, warn_buf);
+ }
+ fprintf(stderr, "%s Group %d (%s) normalized rot. vector: %f %f %f\n",
+ RotStr, g, erotg_names[rotg->eType], vec[0], vec[1], vec[2]);
+ for(m=0; m<DIM; m++)
+ rotg->vec[m] = vec[m];
+
+ CTYPE("Pivot point for the potentials iso, pm, rm, and rm2 (nm)");
+ sprintf(buf,"rot_pivot%d",g);
+ STYPE(buf, s_vec, "0.0 0.0 0.0");
+ clear_dvec(vec);
+ if ( (rotg->eType==erotgISO) || (rotg->eType==erotgPM) || (rotg->eType==erotgRM) || (rotg->eType==erotgRM2) )
+ string2dvec(s_vec,vec);
+ for(m=0; m<DIM; m++)
+ rotg->pivot[m] = vec[m];
+
+ CTYPE("Rotation rate (degree/ps) and force constant (kJ/(mol*nm^2))");
+ sprintf(buf,"rot_rate%d",g);
+ RTYPE(buf, rotg->rate, 0.0);
+
+ sprintf(buf,"rot_k%d",g);
+ RTYPE(buf, rotg->k, 0.0);
+ if (rotg->k <= 0.0)
+ {
+ sprintf(warn_buf, "rot_k%d <= 0", g);
+ warning_note(wi, warn_buf);
+ }
+
+ CTYPE("Slab distance for flexible axis rotation (nm)");
+ sprintf(buf,"rot_slab_dist%d",g);
+ RTYPE(buf, rotg->slab_dist, 1.5);
+ if (rotg->slab_dist <= 0.0)
+ {
+ sprintf(warn_buf, "rot_slab_dist%d <= 0", g);
+ warning_error(wi, warn_buf);
+ }
+
+ CTYPE("Minimum value of Gaussian function for the force to be evaluated (for flex* potentials)");
+ sprintf(buf,"rot_min_gauss%d",g);
+ RTYPE(buf, rotg->min_gaussian, 1e-3);
+ if (rotg->min_gaussian <= 0.0)
+ {
+ sprintf(warn_buf, "rot_min_gauss%d <= 0", g);
+ warning_error(wi, warn_buf);
+ }
+
+ CTYPE("Value of additive constant epsilon' (nm^2) for rm2* and flex2* potentials");
+ sprintf(buf, "rot_eps%d",g);
+ RTYPE(buf, rotg->eps, 1e-4);
+ if ( (rotg->eps <= 0.0) && (rotg->eType==erotgRM2 || rotg->eType==erotgFLEX2) )
+ {
+ sprintf(warn_buf, "rot_eps%d <= 0", g);
+ warning_error(wi, warn_buf);
+ }
+
+ CTYPE("Fitting method to determine angle of rotation group (rmsd, norm, or potential)");
+ sprintf(buf,"rot_fit_method%d",g);
+ ETYPE(buf, rotg->eFittype, erotg_fitnames);
+ CTYPE("For fit type 'potential', nr. of angles around the reference for which the pot. is evaluated");
+ sprintf(buf,"rot_potfit_nsteps%d",g);
+ ITYPE(buf, rotg->PotAngle_nstep, 21);
+ if ( (rotg->eFittype==erotgFitPOT) && (rotg->PotAngle_nstep < 1) )
+ {
+ sprintf(warn_buf, "rot_potfit_nsteps%d < 1", g);
+ warning_error(wi, warn_buf);
+ }
+ CTYPE("For fit type 'potential', distance in degrees between two consecutive angles");
+ sprintf(buf,"rot_potfit_step%d",g);
+ RTYPE(buf, rotg->PotAngle_step, 0.25);
+ }
+
+ *ninp_p = ninp;
+ *inp_p = inp;
+
+ return grpbuf;
+}
+
+
+/* Check whether the box is unchanged */
+static void check_box(matrix f_box, matrix box, char fn[], warninp_t wi)
+{
+ int i,ii;
+ gmx_bool bSame=TRUE;
+ char warn_buf[STRLEN];
+
+
+ for (i=0; i<DIM; i++)
+ for (ii=0; ii<DIM; ii++)
+ if (f_box[i][ii] != box[i][ii])
+ bSame = FALSE;
+ if (!bSame)
+ {
+ sprintf(warn_buf, "%s Box size in reference file %s differs from actual box size!",
+ RotStr, fn);
+ warning(wi, warn_buf);
+ pr_rvecs(stderr,0,"Your box is:",box ,3);
+ pr_rvecs(stderr,0,"Box in file:",f_box,3);
+ }
+}
+
+
+/* Extract the reference positions for the rotation group(s) */
+extern void set_reference_positions(
+ t_rot *rot, gmx_mtop_t *mtop, rvec *x, matrix box,
+ const char *fn, gmx_bool bSet, warninp_t wi)
+{
+ int g,i,ii;
+ t_rotgrp *rotg;
+ t_trnheader header; /* Header information of reference file */
+ char base[STRLEN],extension[STRLEN],reffile[STRLEN];
+ char *extpos;
+ rvec f_box[3]; /* Box from reference file */
+
+
+ /* Base name and extension of the reference file: */
+ strncpy(base, fn, STRLEN - 1);
+ base[STRLEN-1]='\0';
+ extpos = strrchr(base, '.');
+ strcpy(extension,extpos+1);
+ *extpos = '\0';
+
+
+ for (g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ fprintf(stderr, "%s group %d has %d reference positions.\n",RotStr,g,rotg->nat);
+ snew(rotg->x_ref, rotg->nat);
+
+ /* Construct the name for the file containing the reference positions for this group: */
+ sprintf(reffile, "%s.%d.%s", base,g,extension);
+
+ /* If the base filename for the reference position files was explicitly set by
+ * the user, we issue a fatal error if the group file can not be found */
+ if (bSet && !gmx_fexist(reffile))
+ {
+ gmx_fatal(FARGS, "%s The file containing the reference positions was not found.\n"
+ "Expected the file '%s' for group %d.\n",
+ RotStr, reffile, g);
+ }
+
+ if (gmx_fexist(reffile))
+ {
+ fprintf(stderr, " Reading them from %s.\n", reffile);
+ read_trnheader(reffile, &header);
+ if (rotg->nat != header.natoms)
+ gmx_fatal(FARGS,"Number of atoms in file %s (%d) does not match the number of atoms in rotation group (%d)!\n",
+ reffile, header.natoms, rotg->nat);
+ read_trn(reffile, &header.step, &header.t, &header.lambda, f_box, &header.natoms, rotg->x_ref, NULL, NULL);
+
+ /* Check whether the box is unchanged and output a warning if not: */
+ check_box(f_box,box,reffile,wi);
+ }
+ else
+ {
+ fprintf(stderr, " Saving them to %s.\n", reffile);
+ for(i=0; i<rotg->nat; i++)
+ {
+ ii = rotg->ind[i];
+ copy_rvec(x[ii], rotg->x_ref[i]);
+ }
+ write_trn(reffile,g,0.0,0.0,box,rotg->nat,rotg->x_ref,NULL,NULL);
+ }
+ }
+}
+
+
+extern void make_rotation_groups(t_rot *rot,char **rotgnames,t_blocka *grps,char **gnames)
+{
+ int g,ig=-1,i;
+ t_rotgrp *rotg;
+
+
+ for (g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ ig = search_string(rotgnames[g],grps->nr,gnames);
+ rotg->nat = grps->index[ig+1] - grps->index[ig];
+
+ if (rotg->nat > 0)
+ {
+ fprintf(stderr,"Rotation group %d '%s' has %d atoms\n",g,rotgnames[g],rotg->nat);
+ snew(rotg->ind,rotg->nat);
+ for(i=0; i<rotg->nat; i++)
+ rotg->ind[i] = grps->a[grps->index[ig]+i];
+ }
+ else
+ gmx_fatal(FARGS,"Rotation group %d '%s' is empty",g,rotgnames[g]);
+ }
+}
}
}
-#define scopy_rvecs(v,n) copy_rvecs(state->v,state_local->v,n);
-#define scopy_doubles(v,n) copy_doubles(state->v,state_local->v,n);
+#define scopy_rvecs(v,n) copy_rvecs(state->v,state_local->v,n)
+#define scopy_doubles(v,n) copy_doubles(state->v,state_local->v,n)
static void copy_state_nonatomdata(t_state *state,t_state *state_local)
{
return exchange;
}
-static void write_debug_x(t_state *state)
-{
- int i;
-
- if (debug)
- {
- for(i=0; i<state->natoms; i+=10)
- {
- fprintf(debug,"dx %5d %10.5f %10.5f %10.5f\n",i,state->x[i][XX],state->x[i][YY],state->x[i][ZZ]);
- }
- }
-}
-
gmx_bool replica_exchange(FILE *fplog,const t_commrec *cr,struct gmx_repl_ex *re,
t_state *state,real *ener,
t_state *state_local,
* SEARCH ROUTINES
*
***********************************************************/
-static int neq_str(const char *a1,const char *a2)
-{
- int j,l,l1,l2;;
-
- l1 = (int)strlen(a1);
- l2 = (int)strlen(a2);
- l = min(l1,l2);
-
- j=0;
- while (j < l && toupper(a1[j]) == toupper(a2[j]))
- {
- j++;
- }
-
- return j;
-}
-
static gmx_bool is_sign(char c)
{
return (c == '+' || c == '-');
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-
+#ifdef __linux
+#define _GNU_SOURCE
+#include <sched.h>
+#include <sys/syscall.h>
+#endif
#include <signal.h>
#include <stdlib.h>
#include "sighandler.h"
#include "tpxio.h"
#include "txtdump.h"
-
+#include "pull_rotation.h"
#include "md_openmm.h"
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
#include "md_openmm.h"
#endif
+#ifdef GMX_OPENMP
+#include <omp.h>
+#endif
+
typedef struct {
gmx_integrator_t *func;
gmx_large_int_t deform_init_init_step_tpx;
matrix deform_init_box_tpx;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_t deform_init_box_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
struct mdrunner_arglist
{
FILE *fplog;
}
-/* get the number of threads based on how many there were requested,
- which algorithms we're using, and how many particles there are. */
-static int get_nthreads(int nthreads_requested, t_inputrec *inputrec,
- gmx_mtop_t *mtop)
+/* Get the number of threads to use for thread-MPI based on how many
+ * were requested, which algorithms we're using,
+ * and how many particles there are.
+ */
+static int get_nthreads_mpi(int nthreads_requested, t_inputrec *inputrec,
+ gmx_mtop_t *mtop)
{
int nthreads,nthreads_new;
int min_atoms_per_thread;
gmx_large_int_t reset_counters;
gmx_edsam_t ed=NULL;
t_commrec *cr_old=cr;
- int nthreads=1;
+ int nthreads_mpi=1;
+ int nthreads_pme=1;
/* CAUTION: threads may be started later on in this function, so
cr doesn't reflect the final parallel state right now */
read_tpx_state(ftp2fn(efTPX,nfile,fnm),inputrec,state,NULL,mtop);
/* NOW the threads will be started: */
-#ifdef GMX_THREADS
- nthreads = get_nthreads(nthreads_requested, inputrec, mtop);
+#ifdef GMX_THREAD_MPI
+ nthreads_mpi = get_nthreads_mpi(nthreads_requested, inputrec, mtop);
- if (nthreads > 1)
+ if (nthreads_mpi > 1)
{
/* now start the threads. */
- cr=mdrunner_start_threads(nthreads, fplog, cr_old, nfile, fnm,
+ cr=mdrunner_start_threads(nthreads_mpi, fplog, cr_old, nfile, fnm,
oenv, bVerbose, bCompact, nstglobalcomm,
ddxyz, dd_node_order, rdd, rconstr,
dddlb_opt, dlb_scale, ddcsx, ddcsy, ddcsz,
#ifndef GMX_MPI
"but mdrun was compiled without threads or MPI enabled"
#else
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
"but the number of threads (option -nt) is 1"
#else
"but mdrun was not started through mpirun/mpiexec or only one process was requested through mpirun/mpiexec"
if (!EEL_PME(inputrec->coulombtype) || (Flags & MD_PARTDEC))
{
+ if (cr->npmenodes > 0)
+ {
+ if (!EEL_PME(inputrec->coulombtype))
+ {
+ gmx_fatal_collective(FARGS,cr,NULL,
+ "PME nodes are requested, but the system does not use PME electrostatics");
+ }
+ if (Flags & MD_PARTDEC)
+ {
+ gmx_fatal_collective(FARGS,cr,NULL,
+ "PME nodes are requested, but particle decomposition does not support separate PME nodes");
+ }
+ }
+
cr->npmenodes = 0;
}
* This should be thread safe, since they are only written once
* and with identical values.
*/
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&deform_init_box_mutex);
#endif
deform_init_init_step_tpx = inputrec->init_step;
copy_mat(box,deform_init_box_tpx);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&deform_init_box_mutex);
#endif
}
}
if (((MASTER(cr) || (Flags & MD_SEPPOT)) && (Flags & MD_APPENDFILES))
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* With thread MPI only the master node/thread exists in mdrun.c,
* therefore non-master nodes need to open the "seppot" log file here.
*/
gmx_setup_nodecomm(fplog,cr);
}
- wcycle = wallcycle_init(fplog,resetstep,cr);
+ /* get number of OpenMP/PME threads
+ * env variable should be read only on one node to make sure it is identical everywhere */
+#ifdef GMX_OPENMP
+ if (EEL_PME(inputrec->coulombtype))
+ {
+ if (MASTER(cr))
+ {
+ char *ptr;
+ if ((ptr=getenv("GMX_PME_NTHREADS")) != NULL)
+ {
+ sscanf(ptr,"%d",&nthreads_pme);
+ }
+ if (fplog != NULL && nthreads_pme > 1)
+ {
+ fprintf(fplog,"Using %d threads for PME\n",nthreads_pme);
+ }
+ }
+ if (PAR(cr))
+ {
+ gmx_bcast_sim(sizeof(nthreads_pme),&nthreads_pme,cr);
+ }
+ }
+#endif
+
+ wcycle = wallcycle_init(fplog,resetstep,cr,nthreads_pme);
if (PAR(cr))
{
/* Master synchronizes its value of reset_counters with all nodes
fr = mk_forcerec();
init_forcerec(fplog,oenv,fr,fcd,inputrec,mtop,cr,box,FALSE,
opt2fn("-table",nfile,fnm),
+ opt2fn("-tabletf",nfile,fnm),
opt2fn("-tablep",nfile,fnm),
opt2fn("-tableb",nfile,fnm),FALSE,pforce);
/* version for PCA_NOT_READ_NODE (see md.c) */
/*init_forcerec(fplog,fr,fcd,inputrec,mtop,cr,box,FALSE,
- "nofile","nofile","nofile",FALSE,pforce);
+ "nofile","nofile","nofile","nofile",FALSE,pforce);
*/
fr->bSepDVDL = ((Flags & MD_SEPPOT) == MD_SEPPOT);
/* The PME only nodes need to know nChargePerturbed */
gmx_bcast_sim(sizeof(nChargePerturbed),&nChargePerturbed,cr);
}
+
+
+ /* Set CPU affinity. Can be important for performance.
+ On some systems (e.g. Cray) CPU Affinity is set by default.
+ But default assigning doesn't work (well) with only some ranks
+ having threads. This causes very low performance.
+ External tools have cumbersome syntax for setting affinity
+ in the case that only some ranks have threads.
+ Thus it is important that GROMACS sets the affinity internally at
+ if only PME is using threads.
+ */
+
+#ifdef GMX_OPENMP
+#ifdef __linux
+#ifdef GMX_LIB_MPI
+ {
+ int core;
+ MPI_Comm comm_intra; /* intra communicator (but different to nc.comm_intra includes PME nodes) */
+ MPI_Comm_split(MPI_COMM_WORLD,gmx_hostname_num(),gmx_node_rank(),&comm_intra);
+ int local_omp_nthreads = (cr->duty & DUTY_PME) ? nthreads_pme : 1; /* threads on this node */
+ MPI_Scan(&local_omp_nthreads,&core, 1, MPI_INT, MPI_SUM, comm_intra);
+ core-=local_omp_nthreads; /* make exclusive scan */
+#pragma omp parallel firstprivate(core) num_threads(local_omp_nthreads)
+ {
+ cpu_set_t mask;
+ CPU_ZERO(&mask);
+ core+=omp_get_thread_num();
+ CPU_SET(core,&mask);
+ sched_setaffinity((pid_t) syscall (SYS_gettid),sizeof(cpu_set_t),&mask);
+ }
+ }
+#endif /*GMX_MPI*/
+#endif /*__linux*/
+#endif /*GMX_OPENMP*/
+
if (cr->duty & DUTY_PME)
{
status = gmx_pme_init(pmedata,cr,npme_major,npme_minor,inputrec,
mtop ? mtop->natoms : 0,nChargePerturbed,
- (Flags & MD_REPRODUCIBLE));
+ (Flags & MD_REPRODUCIBLE),nthreads_pme);
if (status != 0)
{
gmx_fatal(FARGS,"Error %d initializing PME",status);
init_pull(fplog,inputrec,nfile,fnm,mtop,cr,oenv,
EI_DYNAMICS(inputrec->eI) && MASTER(cr),Flags);
}
+
+ if (inputrec->bRot)
+ {
+ /* Initialize enforced rotation code */
+ init_rot(fplog,inputrec,nfile,fnm,cr,state->x,state->box,mtop,oenv,
+ bVerbose,Flags);
+ }
constr = init_constraints(fplog,mtop,inputrec,ed,state,cr);
{
finish_pull(fplog,inputrec->pull);
}
+
+ if (inputrec->bRot)
+ {
+ finish_rot(fplog,inputrec->rot);
+ }
+
}
else
{
rc=(int)gmx_get_stop_condition();
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* we need to join all threads. The sub-threads join when they
exit this function, but the master thread needs to be told to
wait for that. */
gmx_fatal(FARGS,"Invalid bond type %d",type);
break;
}
+ break;
case d_angles:
case d_angletypes:
switch (type) {
return F_QUARTIC_ANGLES;
case 8:
return F_TABANGLES;
+ case 9:
+ return F_LINEAR_ANGLES;
default:
gmx_fatal(FARGS,"Invalid angle type %d",type);
break;
}
- case d_pairs:
+ break;
+ case d_pairs:
case d_pairtypes:
if (type == 1 || (d == d_pairtypes && type == 2))
return F_LJ14;
return F_LJC14_Q;
else
gmx_fatal(FARGS,"Invalid pairs type %d",type);
+ break;
case d_pairs_nb:
return F_LJC_PAIRS_NB;
case d_dihedrals:
default:
gmx_fatal(FARGS,"Invalid vsites3 type %d",type);
}
+ break;
case d_vsites4:
switch (type) {
case 1:
default:
gmx_fatal(FARGS,"Invalid vsites4 type %d",type);
}
+ break;
case d_vsitesn:
return F_VSITEN;
case d_constraints:
default:
gmx_fatal(FARGS,"Invalid constraints type %d",type);
}
+ break;
case d_settles:
return F_SETTLE;
case d_position_restraints:
return F_POSRES;
case 2:
gmx_fatal(FARGS,"Water polarization should now be listed under [ water_polarization ]\n");
+ break;
default:
gmx_fatal(FARGS,"Invalid position restraint type %d",type);
}
+ break;
case d_polarization:
- return F_POLARIZATION;
+ switch (type) {
+ case 1:
+ return F_POLARIZATION;
+ case 2:
+ return F_ANHARM_POL;
+ default:
+ gmx_fatal(FARGS,"Invalid polarization type %d",type);
+ }
+ break;
case d_thole_polarization:
return F_THOLE_POL;
case d_water_polarization:
* for that we also need to do this an ugly work-about just in case
* the QM group contains the entire system...
*/
- fprintf(stderr,"excluding classical QM-QM interactions...\n");
-
jmax = ir->opts.ngQM;
/* we first search for all the QM atoms and put them in an array
free(blink);
} /* generate_qmexcl */
-void generate_qmexcl(gmx_mtop_t *sys,t_inputrec *ir)
+void generate_qmexcl(gmx_mtop_t *sys,t_inputrec *ir,warninp_t wi)
{
/* This routine expects molt->molt[m].ilist to be of size F_NRE and ordered.
*/
unsigned char *grpnr;
- int mb,mol,nat_mol,i;
+ int mb,mol,nat_mol,i,nr_mol_with_qm_atoms=0;
gmx_molblock_t *molb;
gmx_bool bQMMM;
for(mol=0; mol<molb->nmol; mol++) {
bQMMM = FALSE;
for(i=0; i<nat_mol; i++) {
- if ((grpnr ? grpnr[i] : 0) < ir->opts.ngQM) {
- bQMMM = TRUE;
- }
+ if ((grpnr ? grpnr[i] : 0) < ir->opts.ngQM) {
+ bQMMM = TRUE;
+ }
}
if (bQMMM) {
- if (molb->nmol > 1) {
- /* We need to split this molblock */
- if (mol > 0) {
- /* Split the molblock at this molecule */
- sys->nmolblock++;
- srenew(sys->molblock,sys->nmolblock);
- for(i=mb; i<sys->nmolblock-1; i++) {
- sys->molblock[i+1] = sys->molblock[i];
- }
- sys->molblock[mb ].nmol = mol;
- sys->molblock[mb+1].nmol -= mol;
- mb++;
- molb = &sys->molblock[mb];
- }
- if (molb->nmol > 1) {
- /* Split the molblock after this molecule */
- sys->nmolblock++;
- srenew(sys->molblock,sys->nmolblock);
- for(i=mb; i<sys->nmolblock-1; i++) {
- sys->molblock[i+1] = sys->molblock[i];
- }
- sys->molblock[mb ].nmol = 1;
- sys->molblock[mb+1].nmol -= 1;
- }
-
- /* Add a moltype for the QMMM molecule */
- sys->nmoltype++;
- srenew(sys->moltype,sys->nmoltype);
- /* Copy the moltype struct */
- sys->moltype[sys->nmoltype-1] = sys->moltype[molb->type];
- /* Copy the exclusions to a new array, since this is the only
- * thing that needs to be modified for QMMM.
- */
- copy_blocka(&sys->moltype[molb->type ].excls,
- &sys->moltype[sys->nmoltype-1].excls);
- /* Set the molecule type for the QMMM molblock */
- molb->type = sys->nmoltype - 1;
- }
-
- generate_qmexcl_moltype(&sys->moltype[molb->type],grpnr,ir);
+ nr_mol_with_qm_atoms++;
+ if (molb->nmol > 1) {
+ /* We need to split this molblock */
+ if (mol > 0) {
+ /* Split the molblock at this molecule */
+ sys->nmolblock++;
+ srenew(sys->molblock,sys->nmolblock);
+ for(i=sys->nmolblock-2; i >= mb;i--) {
+ sys->molblock[i+1] = sys->molblock[i];
+ }
+ sys->molblock[mb ].nmol = mol;
+ sys->molblock[mb+1].nmol -= mol;
+ mb++;
+ molb = &sys->molblock[mb];
+ }
+ if (molb->nmol > 1) {
+ /* Split the molblock after this molecule */
+ sys->nmolblock++;
+ srenew(sys->molblock,sys->nmolblock);
+ molb = &sys->molblock[mb];
+ for(i=sys->nmolblock-2; i >= mb;i--) {
+ sys->molblock[i+1] = sys->molblock[i];
+ }
+ sys->molblock[mb ].nmol = 1;
+ sys->molblock[mb+1].nmol -= 1;
+ }
+
+ /* Add a moltype for the QMMM molecule */
+ sys->nmoltype++;
+ srenew(sys->moltype,sys->nmoltype);
+ /* Copy the moltype struct */
+ sys->moltype[sys->nmoltype-1] = sys->moltype[molb->type];
+ /* Copy the exclusions to a new array, since this is the only
+ * thing that needs to be modified for QMMM.
+ */
+ copy_blocka(&sys->moltype[molb->type ].excls,
+ &sys->moltype[sys->nmoltype-1].excls);
+ /* Set the molecule type for the QMMM molblock */
+ molb->type = sys->nmoltype - 1;
+ }
+ generate_qmexcl_moltype(&sys->moltype[molb->type],grpnr,ir);
}
- if (grpnr) {
- grpnr += nat_mol;
+ if (grpnr) {
+ grpnr += nat_mol;
}
}
}
+ if(nr_mol_with_qm_atoms>1){
+ /* generate a warning is there are QM atoms in different
+ * topologies. In this case it is not possible at this stage to
+ * mutualy exclude the non-bonded interactions via the
+ * exclusions (AFAIK). Instead, the user is advised to use the
+ * energy group exclusions in the mdp file
+ */
+ warning_note(wi,
+ "\nThe QM subsystem is divided over multiple topologies. "
+ "The mutual non-bonded interactions cannot be excluded. "
+ "There are two ways to achieve this:\n\n"
+ "1) merge the topologies, such that the atoms of the QM "
+ "subsystem are all present in one single topology file. "
+ "In this case this warning will dissappear\n\n"
+ "2) exclude the non-bonded interactions explicitly via the "
+ "energygrp-excl option in the mdp file. if this is the case "
+ "this warning may be ignored"
+ "\n\n");
+ }
}
/* This routine expects sys->molt[m].ilist to be of size F_NRE and ordered. */
-void generate_qmexcl(gmx_mtop_t *sys,t_inputrec *ir);
+void generate_qmexcl(gmx_mtop_t *sys,t_inputrec *ir,warninp_t wi);
#endif /* _topio_h */
memcpy(bt->param[bt->nr].c, b->c,sizeof(b->c));
memcpy(bt->param[bt->nr].a, b->a,sizeof(b->a));
memcpy(bt->param[bt->nr+1].c,b->c,sizeof(b->c));
-
+
+ /* The definitions of linear angles depend on the order of atoms,
+ * that means that for atoms i-j-k, with certain parameter a, the
+ * corresponding k-j-i angle will have parameter 1-a.
+ */
+ if (ftype == F_LINEAR_ANGLES)
+ {
+ bt->param[bt->nr+1].c[0] = 1-bt->param[bt->nr+1].c[0];
+ bt->param[bt->nr+1].c[2] = 1-bt->param[bt->nr+1].c[2];
+ }
+
for (j=0; (j < nral); j++)
{
bt->param[bt->nr+1].a[j] = b->a[nral-1-j];
/* PRINTING STRUCTURES */
-static void print_nbt (FILE *out,char *title,gpp_atomtype_t at,
- int ftype,t_params *nbt)
-{
- int f,i,j,k,l,nrfp,ntype;
-
- if (ftype == F_LJ)
- f=1;
- else
- f=2;
- nrfp=NRFP(ftype);
-
- if (nbt->nr) {
- /* header */
- fprintf (out,"; %s\n",title);
- fprintf (out,"[ %s ]\n",dir2str(d_nonbond_params));
- fprintf (out,"; %6s %8s","ai","aj");
- fprintf (out," %8s","funct");
- for (j=0; (j<nrfp); j++)
- fprintf (out," %11c%1d",'c',j);
- fprintf (out,"\n");
-
- /* print non-bondtypes */
- ntype = get_atomtype_ntypes(at);
- for (i=k=0; (i<ntype); i++)
- for(j=0; (j<ntype); j++,k++) {
- fprintf (out,"%8s %8s %8d",
- get_atomtype_name(i,at),get_atomtype_name(f,at),f);
- for(l=0; (l<nrfp); l++)
- fprintf (out," %12.5e",nbt->param[k].c[l]);
- fprintf (out,"\n");
- }
- }
- fprintf (out,"\n");
-}
-
void print_bt(FILE *out, directive d, gpp_atomtype_t at,
int ftype,int fsubtype,t_params plist[],
gmx_bool bFullDih)
}
}
}
+static void cmp_adress(FILE *fp,t_adress *ad1,t_adress *ad2,
+ real ftol,real abstol)
+{
+ cmp_int(fp,"ir->adress->type" ,-1,ad1->type,ad2->type);
+ cmp_real(fp,"ir->adress->const_wf" ,-1,ad1->const_wf,ad2->const_wf,ftol,abstol);
+ cmp_real(fp,"ir->adress->ex_width" ,-1,ad1->ex_width,ad2->ex_width,ftol,abstol);
+ cmp_real(fp,"ir->adress->hy_width" ,-1,ad1->hy_width,ad2->hy_width,ftol,abstol);
+ cmp_int(fp,"ir->adress->icor" ,-1,ad1->icor,ad2->icor);
+ cmp_int(fp,"ir->adress->site" ,-1,ad1->site,ad2->site);
+ cmp_rvec(fp,"ir->adress->refs" ,-1,ad1->refs,ad2->refs,ftol,abstol);
+ cmp_real(fp,"ir->adress->ex_forcecap", -1,ad1->ex_forcecap,ad2->ex_forcecap,ftol,abstol);
+}
static void cmp_pull(FILE *fp,t_pull *pull1,t_pull *pull2,real ftol, real abstol)
{
cmp_rvec(fp,"inputrec->deform(a)",-1,ir1->deform[XX],ir2->deform[XX],ftol,abstol);
cmp_rvec(fp,"inputrec->deform(b)",-1,ir1->deform[YY],ir2->deform[YY],ftol,abstol);
cmp_rvec(fp,"inputrec->deform(c)",-1,ir1->deform[ZZ],ir2->deform[ZZ],ftol,abstol);
+
+
+ cmp_bool(fp,"ir->bAdress->type" ,-1,ir1->bAdress,ir2->bAdress);
+ if (ir1->bAdress && ir2->bAdress) {
+ cmp_adress(fp,ir1->adress,ir2->adress,ftol,abstol);
+ }
+
cmp_int(fp,"inputrec->userint1",-1,ir1->userint1,ir2->userint1);
cmp_int(fp,"inputrec->userint2",-1,ir1->userint2,ir2->userint2);
cmp_int(fp,"inputrec->userint3",-1,ir1->userint3,ir2->userint3);
{
fp = fflib_open(f[i]);
get_xlatoms(f[i],fp,&nxlate,&xlatom);
- fclose(fp);
+ ffclose(fp);
sfree(f[i]);
}
sfree(f);
#include "filenm.h"
#include "mshift.h"
#include "force.h"
-#include "time.h"
+#include <time.h>
#include "edsam.h"
#include "mdebin.h"
#include "vcm.h"
static t_range *read_range(const char *db,int *nrange)
{
int nlines,nr,np,i;
- char **lines=NULL;
+ char **lines;
t_range *range;
int atype,ptype;
double rmin,rmax;
+++ /dev/null
-.deps
-.libs
# Files called xxx_test.c are test drivers with a main() function for
# module xxx.c, so they should not be included in the library
-file(GLOB_RECURSE NOT_MDLIB_SOURCES *_test.c *\#*)
-list(REMOVE_ITEM MDLIB_SOURCES ${NOT_MDLIB_SOURCES})
add_library(md ${MDLIB_SOURCES})
target_link_libraries(md gmx ${GMX_EXTRA_LIBRARIES} ${FFT_LIBRARIES} ${XML_LIBRARIES})
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-# Note: Makefile is automatically generated from Makefile.in by the configure
-# script, and Makefile.in is generated from Makefile.am by automake.
-
-AM_CPPFLAGS = -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-libmd@LIBSUFFIX@_la_LIBADD = ../gmxlib/libgmx@LIBSUFFIX@.la
-libmd@LIBSUFFIX@_la_DEPENDENCIES = ../gmxlib/libgmx@LIBSUFFIX@.la
-libmd@LIBSUFFIX@_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@ $(FFT_LIBS) $(XML_LIBS) $(PTHREAD_LIBS)
-
-lib_LTLIBRARIES = libmd@LIBSUFFIX@.la
-
-pkgconfigdir = ${libdir}/pkgconfig
-pkgconfig_DATA = libmd@LIBSUFFIX@.pc
-
-EXTRA_DIST = libmd.pc.cmakein
-
-libmd@LIBSUFFIX@_la_SOURCES = \
- calcmu.c calcvir.c constr.c \
- coupling.c \
- domdec.c domdec_box.c domdec_con.c \
- domdec_network.c domdec_setup.c domdec_top.c \
- ebin.c \
- edsam.c ewald.c \
- force.c forcerec.c \
- ghat.c init.c \
- iteratedconstraints.c md_support.c \
- mdatom.c mdebin.c minimize.c \
- mvxvf.c ns.c nlistheuristics.c nsgrid.c \
- perf_est.c genborn.c \
- genborn_sse2_single.c \
- genborn_sse2_single.h \
- genborn_sse2_double.c \
- genborn_sse2_double.h \
- genborn_allvsall.c \
- genborn_allvsall.h \
- genborn_allvsall_sse2_single.c \
- genborn_allvsall_sse2_single.h \
- genborn_allvsall_sse2_double.c \
- genborn_allvsall_sse2_double.h \
- gmx_qhop_parm.c gmx_qhop_parm.h \
- gmx_qhop_xml.c gmx_qhop_xml.h \
- groupcoord.c groupcoord.h \
- pme.c pme_pp.c pppm.c \
- partdec.c pull.c pullutil.c \
- rf_util.c shakef.c sim_util.c \
- shellfc.c stat.c \
- tables.c tgroup.c tpi.c \
- update.c vcm.c vsite.c \
- wall.c wnblist.c \
- csettle.c clincs.c \
- qmmm.c gmx_fft.c gmx_parallel_3dfft.c \
- fft5d.c fft5d.h \
- gmx_wallcycle.c \
- qm_gaussian.c qm_mopac.c qm_gamess.c \
- gmx_fft_fftw2.c gmx_fft_fftw3.c gmx_fft_fftpack.c \
- gmx_fft_mkl.c qm_orca.c mdebin_bar.c \
- mdebin_bar.h
-
-LDADD = ../mdlib/libmd@LIBSUFFIX@.la ../gmxlib/libgmx@LIBSUFFIX@.la
-
-EXTRA_PROGRAMS = gmx_qhop_db_test
-
-gmx_qhop_db_test_LDADD = ../mdlib/libmd@LIBSUFFIX@.la ../gmxlib/libgmx@LIBSUFFIX@.la ../kernel/libgmxpreprocess@LIBSUFFIX@.la
-
-# clean all libtool libraries, since the target names might have changed
-CLEANFILES = *.la *~ \\\#*
--- /dev/null
+/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
+ *
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * VERSION 4.0.5
+ * Written by Christoph Junghans, Brad Lambeth, and possibly others.
+ * Copyright (c) 2009 Christoph Junghans, Brad Lambeth.
+ * All rights reserved.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ *
+ * And Hey:
+ * GROningen Mixture of Alchemy and Childrens' Stories
+ */
+
+#include "adress.h"
+#include "maths.h"
+#include "pbc.h"
+#include "types/simple.h"
+#include "typedefs.h"
+#include "vec.h"
+
+real
+adress_weight(rvec x,
+ int adresstype,
+ real adressr,
+ real adressw,
+ rvec * ref,
+ t_pbc * pbc,
+ t_forcerec * fr )
+{
+ int i;
+ real l2 = adressr+adressw;
+ real sqr_dl,dl;
+ real tmp;
+ rvec dx;
+
+ sqr_dl = 0.0;
+
+ if (pbc)
+ {
+ pbc_dx(pbc,(*ref),x,dx);
+ }
+ else
+ {
+ rvec_sub((*ref),x,dx);
+ }
+
+ switch(adresstype)
+ {
+ case eAdressOff:
+ /* default to explicit simulation */
+ return 1;
+ case eAdressConst:
+ /* constant value for weighting function = adressw */
+ return fr->adress_const_wf;
+ case eAdressXSplit:
+ /* plane through center of ref, varies in x direction */
+ sqr_dl = dx[0]*dx[0];
+ break;
+ case eAdressSphere:
+ /* point at center of ref, assuming cubic geometry */
+ for(i=0;i<3;i++){
+ sqr_dl += dx[i]*dx[i];
+ }
+ break;
+ default:
+ /* default to explicit simulation */
+ return 1;
+ }
+
+ dl=sqrt(sqr_dl);
+
+ /* molecule is coarse grained */
+ if (dl > l2)
+ {
+ return 0;
+ }
+ /* molecule is explicit */
+ else if (dl < adressr)
+ {
+ return 1;
+ }
+ /* hybrid region */
+ else
+ {
+ tmp=cos((dl-adressr)*M_PI/2/adressw);
+ return tmp*tmp;
+ }
+}
+
+void
+update_adress_weights_com(FILE * fplog,
+ int cg0,
+ int cg1,
+ t_block * cgs,
+ rvec x[],
+ t_forcerec * fr,
+ t_mdatoms * mdatoms,
+ t_pbc * pbc)
+{
+ int icg,k,k0,k1,d;
+ real nrcg,inv_ncg,mtot,inv_mtot;
+ atom_id * cgindex;
+ rvec ix;
+ int adresstype;
+ real adressr,adressw;
+ rvec * ref;
+ real * massT;
+ real * wf;
+
+
+ int n_hyb, n_ex, n_cg;
+
+ n_hyb=0;
+ n_cg=0;
+ n_ex=0;
+
+ adresstype = fr->adress_type;
+ adressr = fr->adress_ex_width;
+ adressw = fr->adress_hy_width;
+ massT = mdatoms->massT;
+ wf = mdatoms->wf;
+ ref = &(fr->adress_refs);
+
+
+ /* Since this is center of mass AdResS, the vsite is not guaranteed
+ * to be on the same node as the constructing atoms. Therefore we
+ * loop over the charge groups, calculate their center of mass,
+ * then use this to calculate wf for each atom. This wastes vsite
+ * construction, but it's the only way to assure that the explicit
+ * atoms have the same wf as their vsite. */
+
+#ifdef DEBUG
+ fprintf(fplog,"Calculating center of mass for charge groups %d to %d\n",
+ cg0,cg1);
+#endif
+ cgindex = cgs->index;
+
+ /* Compute the center of mass for all charge groups */
+ for(icg=cg0; (icg<cg1); icg++)
+ {
+ k0 = cgindex[icg];
+ k1 = cgindex[icg+1];
+ nrcg = k1-k0;
+ if (nrcg == 1)
+ {
+ wf[k0] = adress_weight(x[k0],adresstype,adressr,adressw,ref,pbc,fr);
+ if (wf[k0]==0){ n_cg++;}
+ else if (wf[k0]==1){ n_ex++;}
+ else {n_hyb++;}
+ }
+ else
+ {
+ mtot = 0.0;
+ for(k=k0; (k<k1); k++)
+ {
+ mtot += massT[k];
+ }
+ if (mtot > 0.0)
+ {
+ inv_mtot = 1.0/mtot;
+
+ clear_rvec(ix);
+ for(k=k0; (k<k1); k++)
+ {
+ for(d=0; (d<DIM); d++)
+ {
+ ix[d] += x[k][d]*massT[k];
+ }
+ }
+ for(d=0; (d<DIM); d++)
+ {
+ ix[d] *= inv_mtot;
+ }
+ }
+ /* Calculate the center of gravity if the charge group mtot=0 (only vsites) */
+ else
+ {
+ inv_ncg = 1.0/nrcg;
+
+ clear_rvec(ix);
+ for(k=k0; (k<k1); k++)
+ {
+ for(d=0; (d<DIM); d++)
+ {
+ ix[d] += x[k][d];
+ }
+ }
+ for(d=0; (d<DIM); d++)
+ {
+ ix[d] *= inv_ncg;
+ }
+ }
+
+ /* Set wf of all atoms in charge group equal to wf of com */
+ wf[k0] = adress_weight(ix,adresstype,adressr,adressw,ref,pbc, fr);
+
+ if (wf[k0]==0){ n_cg++;}
+ else if (wf[k0]==1){ n_ex++;}
+ else {n_hyb++;}
+
+ for(k=(k0+1); (k<k1); k++)
+ {
+ wf[k] = wf[k0];
+ }
+ }
+ }
+
+
+ adress_set_kernel_flags(n_ex, n_hyb, n_cg, mdatoms);
+
+
+}
+void update_adress_weights_atom_per_atom(
+ int cg0,
+ int cg1,
+ t_block * cgs,
+ rvec x[],
+ t_forcerec * fr,
+ t_mdatoms * mdatoms,
+ t_pbc * pbc)
+{
+ int icg,k,k0,k1,d;
+ real nrcg,inv_ncg,mtot,inv_mtot;
+ atom_id * cgindex;
+ rvec ix;
+ int adresstype;
+ real adressr,adressw;
+ rvec * ref;
+ real * massT;
+ real * wf;
+
+
+ int n_hyb, n_ex, n_cg;
+
+ n_hyb=0;
+ n_cg=0;
+ n_ex=0;
+
+ adresstype = fr->adress_type;
+ adressr = fr->adress_ex_width;
+ adressw = fr->adress_hy_width;
+ massT = mdatoms->massT;
+ wf = mdatoms->wf;
+ ref = &(fr->adress_refs);
+
+ cgindex = cgs->index;
+
+ /* Weighting function is determined for each atom individually.
+ * This is an approximation
+ * as in the theory requires an interpolation based on the center of masses.
+ * Should be used with caution */
+
+ for (icg = cg0; (icg < cg1); icg++) {
+ k0 = cgindex[icg];
+ k1 = cgindex[icg + 1];
+ nrcg = k1 - k0;
+
+ for (k = (k0); (k < k1); k++) {
+ wf[k] = adress_weight(x[k], adresstype, adressr, adressw, ref, pbc, fr);
+ if (wf[k] == 0) {
+ n_cg++;
+ } else if (wf[k] == 1) {
+ n_ex++;
+ } else {
+ n_hyb++;
+ }
+ }
+
+ }
+ adress_set_kernel_flags(n_ex, n_hyb, n_cg, mdatoms);
+}
+
+void
+update_adress_weights_cog(t_iparams ip[],
+ t_ilist ilist[],
+ rvec x[],
+ t_forcerec * fr,
+ t_mdatoms * mdatoms,
+ t_pbc * pbc)
+{
+ int i,j,k,nr,nra,inc;
+ int ftype,adresstype;
+ t_iatom avsite,ai,aj,ak,al;
+ t_iatom * ia;
+ real adressr,adressw;
+ rvec * ref;
+ real * wf;
+ int n_hyb, n_ex, n_cg;
+
+ adresstype = fr->adress_type;
+ adressr = fr->adress_ex_width;
+ adressw = fr->adress_hy_width;
+ wf = mdatoms->wf;
+ ref = &(fr->adress_refs);
+
+
+ n_hyb=0;
+ n_cg=0;
+ n_ex=0;
+
+
+ /* Since this is center of geometry AdResS, we know the vsite
+ * is in the same charge group node as the constructing atoms.
+ * Loop over vsite types, calculate the weight of the vsite,
+ * then assign that weight to the constructing atoms. */
+
+ for(ftype=0; (ftype<F_NRE); ftype++)
+ {
+ if (interaction_function[ftype].flags & IF_VSITE)
+ {
+ nra = interaction_function[ftype].nratoms;
+ nr = ilist[ftype].nr;
+ ia = ilist[ftype].iatoms;
+
+ for(i=0; (i<nr); )
+ {
+ /* The vsite and first constructing atom */
+ avsite = ia[1];
+ ai = ia[2];
+ wf[avsite] = adress_weight(x[avsite],adresstype,adressr,adressw,ref,pbc,fr);
+ wf[ai] = wf[avsite];
+
+ if (wf[ai] == 0) {
+ n_cg++;
+ } else if (wf[ai] == 1) {
+ n_ex++;
+ } else {
+ n_hyb++;
+ }
+
+ /* Assign the vsite wf to rest of constructing atoms depending on type */
+ inc = nra+1;
+ switch (ftype) {
+ case F_VSITE2:
+ aj = ia[3];
+ wf[aj] = wf[avsite];
+ break;
+ case F_VSITE3:
+ aj = ia[3];
+ wf[aj] = wf[avsite];
+ ak = ia[4];
+ wf[ak] = wf[avsite];
+ break;
+ case F_VSITE3FD:
+ aj = ia[3];
+ wf[aj] = wf[avsite];
+ ak = ia[4];
+ wf[ak] = wf[avsite];
+ break;
+ case F_VSITE3FAD:
+ aj = ia[3];
+ wf[aj] = wf[avsite];
+ ak = ia[4];
+ wf[ak] = wf[avsite];
+ break;
+ case F_VSITE3OUT:
+ aj = ia[3];
+ wf[aj] = wf[avsite];
+ ak = ia[4];
+ wf[ak] = wf[avsite];
+ break;
+ case F_VSITE4FD:
+ aj = ia[3];
+ wf[aj] = wf[avsite];
+ ak = ia[4];
+ wf[ak] = wf[avsite];
+ al = ia[5];
+ wf[al] = wf[avsite];
+ break;
+ case F_VSITE4FDN:
+ aj = ia[3];
+ wf[aj] = wf[avsite];
+ ak = ia[4];
+ wf[ak] = wf[avsite];
+ al = ia[5];
+ wf[al] = wf[avsite];
+ break;
+ case F_VSITEN:
+ inc = 3*ip[ia[0]].vsiten.n;
+ for(j=3; j<inc; j+=3)
+ {
+ ai = ia[j+2];
+ wf[ai] = wf[avsite];
+ }
+ break;
+ default:
+ gmx_fatal(FARGS,"No such vsite type %d in %s, line %d",
+ ftype,__FILE__,__LINE__);
+ }
+
+ /* Increment loop variables */
+ i += inc;
+ ia += inc;
+ }
+ }
+ }
+
+ adress_set_kernel_flags(n_ex, n_hyb, n_cg, mdatoms);
+}
+
+void
+update_adress_weights_atom(int cg0,
+ int cg1,
+ t_block * cgs,
+ rvec x[],
+ t_forcerec * fr,
+ t_mdatoms * mdatoms,
+ t_pbc * pbc)
+{
+ int icg,k,k0,k1;
+ atom_id * cgindex;
+ int adresstype;
+ real adressr,adressw;
+ rvec * ref;
+ real * massT;
+ real * wf;
+
+ adresstype = fr->adress_type;
+ adressr = fr->adress_ex_width;
+ adressw = fr->adress_hy_width;
+ massT = mdatoms->massT;
+ wf = mdatoms->wf;
+ ref = &(fr->adress_refs);
+ cgindex = cgs->index;
+
+ /* Only use first atom in charge group.
+ * We still can't be sure that the vsite and constructing
+ * atoms are on the same processor, so we must calculate
+ * in the same way as com adress. */
+
+ for(icg=cg0; (icg<cg1); icg++)
+ {
+ k0 = cgindex[icg];
+ k1 = cgindex[icg+1];
+ wf[k0] = adress_weight(x[k0],adresstype,adressr,adressw,ref,pbc,fr);
+
+ /* Set wf of all atoms in charge group equal to wf of first atom in charge group*/
+ for(k=(k0+1); (k<k1); k++)
+ {
+ wf[k] = wf[k0];
+ }
+ }
+}
+
+void adress_set_kernel_flags(int n_ex, int n_hyb, int n_cg, t_mdatoms * mdatoms){
+
+ /* With domain decomposition we can check weather a cpu calculates only
+ * coarse-grained or explicit interactions. If so we use standard gromacs kernels
+ * on this proc. See also nonbonded.c */
+
+ if (n_hyb ==0 && n_ex == 0){
+ /* all particles on this proc are coarse-grained, use standard gromacs kernels */
+ if (!mdatoms->purecg){
+ mdatoms->purecg = TRUE;
+ if (debug) fprintf (debug, "adress.c: pure cg kernels on this proc\n");
+ }
+ }
+ else
+ {
+ if (mdatoms->purecg){
+ /* now this processor has hybrid particles again, call the hybrid kernels */
+ mdatoms->purecg = FALSE;
+ }
+ }
+
+ if (n_hyb ==0 && n_cg == 0){
+ /* all particles on this proc are atomistic, use standard gromacs kernels */
+ if (!mdatoms->pureex){
+ mdatoms->pureex = TRUE;
+ if (debug) fprintf (debug, "adress.c: pure ex kernels on this proc\n");
+ }
+ }
+ else
+ {
+ if (mdatoms->pureex){
+ mdatoms->pureex = FALSE;
+ }
+ }
+}
+
+void
+adress_thermo_force(int start,
+ int homenr,
+ t_block * cgs,
+ rvec x[],
+ rvec f[],
+ t_forcerec * fr,
+ t_mdatoms * mdatoms,
+ t_pbc * pbc)
+{
+ int iatom,n0,nnn,nrcg, i;
+ int adresstype;
+ real adressw, adressr;
+ atom_id * cgindex;
+ unsigned short * ptype;
+ rvec * ref;
+ real * wf;
+ real tabscale;
+ real * ATFtab;
+ rvec dr;
+ real w,wsq,wmin1,wmin1sq,wp,wt,rinv, sqr_dl, dl;
+ real eps,eps2,F,Geps,Heps2,Fp,dmu_dwp,dwp_dr,fscal;
+
+ adresstype = fr->adress_type;
+ adressw = fr->adress_hy_width;
+ adressr = fr->adress_ex_width;
+ cgindex = cgs->index;
+ ptype = mdatoms->ptype;
+ ref = &(fr->adress_refs);
+ wf = mdatoms->wf;
+
+ for(iatom=start; (iatom<start+homenr); iatom++)
+ {
+ if (egp_coarsegrained(fr, mdatoms->cENER[iatom]))
+ {
+ if (ptype[iatom] == eptVSite)
+ {
+ w = wf[iatom];
+ /* is it hybrid or apply the thermodynamics force everywhere?*/
+ if ( mdatoms->tf_table_index[iatom] != NO_TF_TABLE)
+ {
+ if (fr->n_adress_tf_grps > 0 ){
+ /* multi component tf is on, select the right table */
+ ATFtab = fr->atf_tabs[mdatoms->tf_table_index[iatom]].tab;
+ tabscale = fr->atf_tabs[mdatoms->tf_table_index[iatom]].scale;
+ }
+ else {
+ /* just on component*/
+ ATFtab = fr->atf_tabs[DEFAULT_TF_TABLE].tab;
+ tabscale = fr->atf_tabs[DEFAULT_TF_TABLE].scale;
+ }
+
+ fscal = 0;
+ if (pbc)
+ {
+ pbc_dx(pbc,(*ref),x[iatom],dr);
+ }
+ else
+ {
+ rvec_sub((*ref),x[iatom],dr);
+ }
+
+
+
+
+ /* calculate distace to adress center again */
+ sqr_dl =0.0;
+ switch(adresstype)
+ {
+ case eAdressXSplit:
+ /* plane through center of ref, varies in x direction */
+ sqr_dl = dr[0]*dr[0];
+ rinv = gmx_invsqrt(dr[0]*dr[0]);
+ break;
+ case eAdressSphere:
+ /* point at center of ref, assuming cubic geometry */
+ for(i=0;i<3;i++){
+ sqr_dl += dr[i]*dr[i];
+ }
+ rinv = gmx_invsqrt(sqr_dl);
+ break;
+ default:
+ /* This case should not happen */
+ rinv = 0.0;
+ }
+
+ dl=sqrt(sqr_dl);
+ /* table origin is adress center */
+ wt = dl*tabscale;
+ n0 = wt;
+ eps = wt-n0;
+ eps2 = eps*eps;
+ nnn = 4*n0;
+ F = ATFtab[nnn+1];
+ Geps = eps*ATFtab[nnn+2];
+ Heps2 = eps2*ATFtab[nnn+3];
+ Fp = F+Geps+Heps2;
+ F = (Fp+Geps+2.0*Heps2)*tabscale;
+
+ fscal = F*rinv;
+
+ f[iatom][0] += fscal*dr[0];
+ if (adresstype != eAdressXSplit)
+ {
+ f[iatom][1] += fscal*dr[1];
+ f[iatom][2] += fscal*dr[2];
+ }
+ }
+ }
+ }
+ }
+}
+
+gmx_bool egp_explicit(t_forcerec * fr, int egp_nr)
+{
+ return fr->adress_group_explicit[egp_nr];
+}
+
+gmx_bool egp_coarsegrained(t_forcerec * fr, int egp_nr)
+{
+ return !fr->adress_group_explicit[egp_nr];
+}
--- /dev/null
+/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
+ *
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * VERSION 4.0.5
+ * Written by Christoph Junghans, Brad Lambeth, and possibly others.
+ * Copyright (c) 2009 Christoph Junghans, Brad Lambeth.
+ * All rights reserved.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ *
+ * And Hey:
+ * GROningen Mixture of Alchemy and Childrens' Stories
+ */
+
+#ifndef _adress_h_
+#define _adress_h_
+
+/** \file adress.h
+ *
+ * \brief Implementation of the AdResS method
+ *
+ */
+
+#include "types/simple.h"
+#include "typedefs.h"
+
+/** \brief calculates the AdResS weight of a particle
+ *
+ * \param[in] x position of the particle
+ * \param[in] adresstype type of address weight function
+ * eAdressOff - explicit simulation
+ * eAdressConst - constant weight all over the box
+ * eAdressXSplit - split in x direction with ref as center
+ * eAdressSphere - spherical splitting with ref as center
+ * else - weight = 1 - explicit simulation
+ * \param[in] adressr radius/size of the explicit zone
+ * \param[in] adressw size of the hybrid zone
+ * \param[in] ref center of the explicit zone
+ * for adresstype 1 - unused
+ * for adresstype 2 - only ref[0] is used
+ * \param[in] pbc for calculating shortest distance to ref
+ *
+ * \return weight of the particle
+ *
+ */
+real
+adress_weight(rvec x,
+ int adresstype,
+ real adressr,
+ real adressw,
+ rvec * ref,
+ t_pbc * pbc,
+ t_forcerec * fr);
+
+/** \brief update the weight of all coarse-grained particles in several charge groups for com vsites
+ *
+ * \param[in,out] fplog log file in case of debug
+ * \param[in] cg0 first charge group to update
+ * \param[in] cg1 last+1 charge group to update
+ * \param[in] cgs block containing the cg index
+ * \param[in] x array with all the particle positions
+ * \param[in] fr the forcerec containing all the parameters
+ * \param[in,out] mdatoms the struct containing all the atoms properties
+ * \param[in] pbc for shortest distance in adress_weight
+ */
+void
+update_adress_weights_com(FILE * fplog,
+ int cg0,
+ int cg1,
+ t_block * cgs,
+ rvec x[],
+ t_forcerec * fr,
+ t_mdatoms * mdatoms,
+ t_pbc * pbc);
+
+/** \brief update the weight of all coarse-grained particles for cog vsites
+ *
+ * \param[in] ip contains interaction parameters, in this case the number of constructing atoms n for vsitesn
+ * \param[in] ilist list of interaction types, in this case the virtual site types are what's important
+ * \param[in] x array with all the particle positions
+ * \param[in] fr the forcerec containing all the parameters
+ * \param[in,out] mdatoms the struct containing all the atoms properties
+ * \param[in] pbc for shortest distance in adress_weight
+ */
+void
+update_adress_weights_cog(t_iparams ip[],
+ t_ilist ilist[],
+ rvec x[],
+ t_forcerec * fr,
+ t_mdatoms * mdatoms,
+ t_pbc * pbc);
+/** \brief update the weight of all coarse-grained particles in several charge groups for atom vsites
+ *
+ * \param[in] cg0 first charge group to update
+ * \param[in] cg1 last+1 charge group to update
+ * \param[in] cgs block containing the cg index
+ * \param[in] x array with all the particle positions
+ * \param[in] fr the forcerec containing all the parameters
+ * \param[in,out] mdatoms the struct containing all the atoms properties
+ * \param[in] pbc for shortest distance in adress_weight
+ */
+void
+update_adress_weights_atom(int cg0,
+ int cg1,
+ t_block * cgs,
+ rvec x[],
+ t_forcerec * fr,
+ t_mdatoms * mdatoms,
+ t_pbc * pbc);
+
+void
+update_adress_weights_atom_per_atom(int cg0,
+ int cg1,
+ t_block * cgs,
+ rvec x[],
+ t_forcerec * fr,
+ t_mdatoms * mdatoms,
+ t_pbc * pbc);
+
+/** \brief add AdResS IC thermodynamic force to f_novirsum
+ *
+ * \param[in] cg0 first charge group to update
+ * \param[in] cg1 last+1 charge group to update
+ * \param[in] cgs block containing the cg index
+ * \param[in] x array with all the particle positions
+ * \param[in,out] f the force array pointing at f_novirsum from sim_util.c
+ * \param[in] fr the forcerec containing all the parameters
+ * \param[in] mdatoms the struct containing all the atoms properties
+ * \param[in] pbc for shortest distance to fr->adress_refs
+ */
+void
+adress_thermo_force(int cg0,
+ int cg1,
+ t_block * cgs,
+ rvec x[],
+ rvec f[],
+ t_forcerec * fr,
+ t_mdatoms * mdatoms,
+ t_pbc * pbc);
+
+void adress_set_kernel_flags(int n_ex, int n_hyb, int n_cg, t_mdatoms * mdatoms);
+
+/* functions to look up if a energy group is explicit or coarse-grained*/
+gmx_bool egp_explicit(t_forcerec * fr, int egp_nr);
+gmx_bool egp_coarsegrained(t_forcerec * fr, int egp_nr);
+#endif
#include "mshift.h"
#include "macros.h"
-static void dprod1(rvec vir,real x,rvec f)
-{
- vir[XX]+=x*f[XX];
- vir[YY]+=x*f[YY];
- vir[ZZ]+=x*f[ZZ];
-}
-
static void upd_vir(rvec vir,real dvx,real dvy,real dvz)
{
vir[XX]-=0.5*dvx;
#include "force.h"
#include "pme.h"
#include "pull.h"
+#include "pull_rotation.h"
#include "gmx_wallcycle.h"
#include "mdrun.h"
#include "nsgrid.h"
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
}
for(est=0; est<estNR; est++)
{
- if (EST_DISTR(est) && state_local->flags & (1<<est))
+ if (EST_DISTR(est) && (state_local->flags & (1<<est)))
{
switch (est) {
case estX:
for(est=0; est<estNR; est++)
{
- if (EST_DISTR(est) && state->flags & (1<<est))
+ if (EST_DISTR(est) && (state->flags & (1<<est)))
{
switch(est) {
case estX:
}
for(i=0; i<estNR; i++)
{
- if (EST_DISTR(i) && state_local->flags & (1<<i))
+ if (EST_DISTR(i) && (state_local->flags & (1<<i)))
{
switch (i) {
case estX:
}
else
{
- if (dd->nc[d] > 1 && d < ddbox->npbcdim)
+ if (d < ddbox->npbcdim && dd->nc[d] > 1)
{
tric[d][i] = box[i][d]/box[i][i];
}
for(est=0; est<estNR; est++)
{
- if (EST_DISTR(est) && state->flags & (1<<est)) {
+ if (EST_DISTR(est) && (state->flags & (1<<est))) {
switch (est) {
case estX:
/* Rotate the complete state; for a rectangular box only */
static void make_load_communicator(gmx_domdec_t *dd,MPI_Group g_all,
int dim_ind,ivec loc)
{
- MPI_Group g_row;
+ MPI_Group g_row = MPI_GROUP_EMPTY;
MPI_Comm c_row;
int dim,i,*rank;
ivec loc_c;
gmx_domdec_root_t *root;
+ gmx_bool bPartOfGroup = FALSE;
dim = dd->dim[dim_ind];
copy_ivec(loc,loc_c);
{
loc_c[dim] = i;
rank[i] = dd_index(dd->nc,loc_c);
+ if (rank[i] == dd->rank)
+ {
+ /* This process is part of the group */
+ bPartOfGroup = TRUE;
+ }
+ }
+ if (bPartOfGroup)
+ {
+ MPI_Group_incl(g_all,dd->nc[dim],rank,&g_row);
}
- /* Here we create a new group, that does not necessarily
- * include our process. But MPI_Comm_create needs to be
- * called by all the processes in the original communicator.
- * Calling MPI_Group_free afterwards gives errors, so I assume
- * also the group is needed by all processes. (B. Hess)
- */
- MPI_Group_incl(g_all,dd->nc[dim],rank,&g_row);
MPI_Comm_create(dd->mpi_comm_all,g_row,&c_row);
- if (c_row != MPI_COMM_NULL)
+ if (bPartOfGroup)
{
- /* This process is part of the group */
dd->comm->mpi_comm_load[dim_ind] = c_row;
if (dd->comm->eDLB != edlbNO)
{
/* Reorder the state */
for(i=0; i<estNR; i++)
{
- if (EST_DISTR(i) && state->flags & (1<<i))
+ if (EST_DISTR(i) && (state->flags & (1<<i)))
{
switch (i)
{
/* Update the local pull groups */
dd_make_local_pull_groups(dd,ir->pull,mdatoms);
}
+
+ if (ir->bRot)
+ {
+ /* Update the local rotation groups */
+ dd_make_local_rotation_groups(dd,ir->rot);
+ }
+
add_dd_statistics(dd);
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
{
if (cr->npmenodes < 0)
{
- if (cr->nnodes <= 10)
+ /* Use PME nodes when the number of nodes is more than 16 */
+ if (cr->nnodes <= 18)
{
cr->npmenodes = 0;
}
#include "vec.h"
#include "physics.h"
-static real rms_ener(t_energy *e,int nsteps)
-{
- return sqrt(e->eav/nsteps);
-}
-
t_ebin *mk_ebin(void)
{
t_ebin *eb;
#include "mvdata.h"
#include "txtdump.h"
#include "vec.h"
-#include "time.h"
+#include <time.h>
#include "nrnb.h"
#include "mshift.h"
#include "mdrun.h"
{
if (readmagic==666 || readmagic==667 || readmagic==668)
gmx_fatal(FARGS,"Wrong magic number: Use newest version of make_edi to produce edi file");
- else if (readmagic == 669)
- ;
- else
+ else if (readmagic != 669)
gmx_fatal(FARGS,"Wrong magic number %d in %s",readmagic,ed->edinam);
}
*
* GROningen MAchine for Chemical Simulations
*
- * VERSION 4.5
* Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2008, The GROMACS development team,
+ * Copyright (c) 2001-2012, The GROMACS development team,
* check out http://www.gromacs.org for more information.
* This program is free software; you can redistribute it and/or
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
+#ifdef GMX_OPENMP
+#define FFT5D_THREADS
+#endif
#ifdef FFT5D_THREADS
#include <omp.h>
/* requires fftw compiled with openmp */
-#define FFT5D_FFTW_THREADS
+/* #define FFT5D_FFTW_THREADS (now set by cmake) */
#endif
#include "fft5d.h"
#include <float.h>
#include <math.h>
#include <assert.h>
+#include "smalloc.h"
#ifndef __FLT_EPSILON__
#define __FLT_EPSILON__ FLT_EPSILON
#ifdef GMX_FFT_FFTW3
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* none of the fftw3 calls, except execute(), are thread-safe, so
we need to serialize them with this mutex. */
static tMPI_Thread_mutex_t big_fftw_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
-#define FFTW_LOCK tMPI_Thread_mutex_lock(&big_fftw_mutex);
-#define FFTW_UNLOCK tMPI_Thread_mutex_unlock(&big_fftw_mutex);
-#else /* GMX_THREADS */
+#define FFTW_LOCK tMPI_Thread_mutex_lock(&big_fftw_mutex)
+#define FFTW_UNLOCK tMPI_Thread_mutex_unlock(&big_fftw_mutex)
+#else /* GMX_THREAD_MPI */
#define FFTW_LOCK
#define FFTW_UNLOCK
-#endif /* GMX_THREADS */
+#endif /* GMX_THREAD_MPI */
#endif /* GMX_FFT_FFTW3 */
static double fft5d_fmax(double a, double b){
int i;
for (i=sqrt(z);;i--)
if (z%i==0) return i;
+ return 1;
}
/* largest factor */
if (z==1) return 1;
for (i=z/2;;i--)
if (z%i==0) return i;
+ return 1;
}
/* largest prime factor: WARNING: slow recursion, only use for small numbers */
return max;
}
-/*
-copied here from fftgrid, because:
-1. function there not publically available
-2. not sure whether we keep fftgrid
-3. less dependencies for fft5d
-
-Only used for non-fftw case
-*/
-static void *
-gmx_calloc_aligned(size_t size)
-{
- void *p0,*p;
-
- /*We initialize by zero for Valgrind
- For non-divisible case we communicate more than the data.
- If we don't initialize the data we communicate uninitialized data*/
- p0 = calloc(size+32,1);
-
- if(p0 == NULL)
- {
- gmx_fatal(FARGS,"Failed to allocated %u bytes of aligned memory.",size+32);
- }
-
- p = (void *) (((size_t) p0 + 32) & (~((size_t) 31)));
-
- /* Yeah, yeah, we cannot free this pointer, but who cares... */
- return p;
-}
-
/* NxMxK the size of the data
* comm communicator to use for fft5d
* P0 number of processor in 1st axes (can be null for automatic)
- * lin is allocated by fft5d because size of array is only known after planning phase */
-fft5d_plan fft5d_plan_3d(int NG, int MG, int KG, MPI_Comm comm[2], int flags, t_complex** rlin, t_complex** rlout)
+ * lin is allocated by fft5d because size of array is only known after planning phase
+ * rlout2 is only used as intermediate buffer - only returned after allocation to reuse for back transform - should not be used by caller
+*/
+fft5d_plan fft5d_plan_3d(int NG, int MG, int KG, MPI_Comm comm[2], int flags, t_complex** rlin, t_complex** rlout, t_complex** rlout2, t_complex** rlout3, int nthreads)
{
- int P[2],bMaster,prank[2],i;
+ int P[2],bMaster,prank[2],i,t;
int rNG,rMG,rKG;
int *N0=0, *N1=0, *M0=0, *M1=0, *K0=0, *K1=0, *oN0=0, *oN1=0, *oM0=0, *oM1=0, *oK0=0, *oK1=0;
int N[3],M[3],K[3],pN[3],pM[3],pK[3],oM[3],oK[3],*iNin[3]={0},*oNin[3]={0},*iNout[3]={0},*oNout[3]={0};
int C[3],rC[3],nP[2];
int lsize;
- t_complex *lin=0,*lout=0;
+ t_complex *lin=0,*lout=0,*lout2=0,*lout3=0;
fft5d_plan plan;
int s;
/* comm, prank and P are in the order of the decomposition (plan->cart is in the order of transposes) */
#ifdef GMX_MPI
- if (GMX_PARALLEL_ENV_INITIALIZED && comm[0] != 0)
+ if (GMX_PARALLEL_ENV_INITIALIZED && comm[0] != MPI_COMM_NULL)
{
MPI_Comm_size(comm[0],&P[0]);
MPI_Comm_rank(comm[0],&prank[0]);
prank[0] = 0;
}
#ifdef GMX_MPI
- if (GMX_PARALLEL_ENV_INITIALIZED && comm[1] != 0)
+ if (GMX_PARALLEL_ENV_INITIALIZED && comm[1] != MPI_COMM_NULL)
{
MPI_Comm_size(comm[1],&P[1]);
MPI_Comm_rank(comm[1],&prank[1]);
lsize = fft5d_fmax(N[0]*M[0]*K[0]*nP[0],fft5d_fmax(N[1]*M[1]*K[1]*nP[1],C[2]*M[2]*K[2]));
/* int lsize = fmax(C[0]*M[0]*K[0],fmax(C[1]*M[1]*K[1],C[2]*M[2]*K[2])); */
if (!(flags&FFT5D_NOMALLOC)) {
- lin = (t_complex*)gmx_calloc_aligned(sizeof(t_complex) * lsize);
- lout = (t_complex*)gmx_calloc_aligned(sizeof(t_complex) * lsize);
+ snew_aligned(lin, lsize, 32);
+ snew_aligned(lout, lsize, 32);
+ snew_aligned(lout2, lsize, 32);
+ snew_aligned(lout3, lsize, 32);
} else {
lin = *rlin;
lout = *rlout;
+ lout2 = *rlout2;
+ lout3 = *rlout3;
}
plan = (fft5d_plan)calloc(1,sizeof(struct fft5d_plan_t));
-#ifdef FFT5D_THREADS
-#ifdef FFT5D_FFTW_THREADS
- FFTW(init_threads)();
- int nthreads;
- #pragma omp parallel
- {
- #pragma omp master
- {
- nthreads = omp_get_num_threads();
- }
- }
- if (prank[0] == 0 && prank[1] == 0)
+ if (debug)
{
- printf("Running fftw on %d threads\n",nthreads);
+ fprintf(debug, "Running on %d threads\n",nthreads);
}
- FFTW(plan_with_nthreads)(nthreads);
-#endif
-#endif
-#ifdef GMX_FFT_FFTW3 /*if not FFTW - then we don't do a 3d plan but insead only 1D plans */
- if ((!(flags&FFT5D_INPLACE)) && (!(P[0]>1 || P[1]>1))) { /*don't do 3d plan in parallel or if in_place requested */
+#ifdef GMX_FFT_FFTW3 /*if not FFTW - then we don't do a 3d plan but instead use only 1D plans */
+ /* It is possible to use the 3d plan with OMP threads - but in that case it is not allowed to be called from
+ * within a parallel region. For now deactivated. If it should be supported it has to made sure that
+ * that the execute of the 3d plan is in a master/serial block (since it contains it own parallel region)
+ * and that the 3d plan is faster than the 1d plan.
+ */
+ if ((!(flags&FFT5D_INPLACE)) && (!(P[0]>1 || P[1]>1)) && nthreads==1) { /*don't do 3d plan in parallel or if in_place requested */
int fftwflags=FFTW_DESTROY_INPUT;
FFTW(iodim) dims[3];
int inNG=NG,outMG=MG,outKG=KG;
dims[2].os = 1;
}
}
+#ifdef FFT5D_THREADS
+#ifdef FFT5D_FFTW_THREADS
+ FFTW(plan_with_nthreads)(nthreads);
+#endif
+#endif
if ((flags&FFT5D_REALCOMPLEX) && !(flags&FFT5D_BACKWARD)) {
plan->p3d = FFTW(plan_guru_dft_r2c)(/*rank*/ 3, dims,
/*howmany*/ 0, /*howmany_dims*/0 ,
(FFTW(complex) *)lin, (FFTW(complex) *)lout,
/*sign*/ (flags&FFT5D_BACKWARD)?1:-1, /*flags*/ fftwflags);
}
+#ifdef FFT5D_THREADS
+#ifdef FFT5D_FFTW_THREADS
+ FFTW(plan_with_nthreads)(1);
+#endif
+#endif
FFTW_UNLOCK;
}
if (!plan->p3d) { /* for decomposition and if 3d plan did not work */
fprintf(debug,"FFT5D: Plan s %d rC %d M %d pK %d C %d lsize %d\n",
s,rC[s],M[s],pK[s],C[s],lsize);
}
- if ((flags&FFT5D_REALCOMPLEX) && ((!(flags&FFT5D_BACKWARD) && s==0) || ((flags&FFT5D_BACKWARD) && s==2))) {
- gmx_fft_init_many_1d_real( &plan->p1d[s], rC[s], pM[s]*pK[s], (flags&FFT5D_NOMEASURE)?GMX_FFT_FLAG_CONSERVATIVE:0 );
- } else {
- gmx_fft_init_many_1d ( &plan->p1d[s], C[s], pM[s]*pK[s], (flags&FFT5D_NOMEASURE)?GMX_FFT_FLAG_CONSERVATIVE:0 );
+ plan->p1d[s] = (gmx_fft_t*)malloc(sizeof(gmx_fft_t)*nthreads);
+
+ /* Make sure that the init routines are only called by one thread at a time and in order
+ (later is only important to not confuse valgrind)
+ */
+#pragma omp parallel for num_threads(nthreads) schedule(static) ordered
+ for(t=0; t<nthreads; t++)
+ {
+ int tsize = ((t+1)*pM[s]*pK[s]/nthreads)-(t*pM[s]*pK[s]/nthreads);
+
+ if ((flags&FFT5D_REALCOMPLEX) && ((!(flags&FFT5D_BACKWARD) && s==0) || ((flags&FFT5D_BACKWARD) && s==2))) {
+ gmx_fft_init_many_1d_real( &plan->p1d[s][t], rC[s], tsize, (flags&FFT5D_NOMEASURE)?GMX_FFT_FLAG_CONSERVATIVE:0 );
+ } else {
+ gmx_fft_init_many_1d ( &plan->p1d[s][t], C[s], tsize, (flags&FFT5D_NOMEASURE)?GMX_FFT_FLAG_CONSERVATIVE:0 );
+ }
}
}
+
#ifdef GMX_FFT_FFTW3
}
#endif
plan->cart[1]=comm[0]; plan->cart[0]=comm[1];
}
#ifdef FFT5D_MPI_TRANSPOSE
- FFTW_LOCK
+ FFTW_LOCK;
for (s=0;s<2;s++) {
if ((s==0 && !(flags&FFT5D_ORDER_YZ)) || (s==1 && (flags&FFT5D_ORDER_YZ)))
- plan->mpip[s] = FFTW(mpi_plan_many_transpose)(nP[s], nP[s], N[s]*K[s]*pM[s]*2, 1, 1, (real*)lin, (real*)lout, plan->cart[s], FFTW_PATIENT);
+ plan->mpip[s] = FFTW(mpi_plan_many_transpose)(nP[s], nP[s], N[s]*K[s]*pM[s]*2, 1, 1, (real*)lout2, (real*)lout3, plan->cart[s], FFTW_PATIENT);
else
- plan->mpip[s] = FFTW(mpi_plan_many_transpose)(nP[s], nP[s], N[s]*pK[s]*M[s]*2, 1, 1, (real*)lin, (real*)lout, plan->cart[s], FFTW_PATIENT);
+ plan->mpip[s] = FFTW(mpi_plan_many_transpose)(nP[s], nP[s], N[s]*pK[s]*M[s]*2, 1, 1, (real*)lout2, (real*)lout3, plan->cart[s], FFTW_PATIENT);
}
- FFTW_UNLOCK
+ FFTW_UNLOCK;
#endif
plan->lin=lin;
plan->lout=lout;
+ plan->lout2=lout2;
+ plan->lout3=lout3;
plan->NG=NG;plan->MG=MG;plan->KG=KG;
plan->realcomplex=realcomplex;
*/
plan->flags=flags;
+ plan->nthreads=nthreads;
*rlin=lin;
*rlout=lout;
+ *rlout2=lout2;
+ *rlout3=lout3;
return plan;
}
NG, MG, KG is size of global data*/
static void splitaxes(t_complex* lout,const t_complex* lin,
int maxN,int maxM,int maxK, int pN, int pM, int pK,
- int P,int NG,int *N, int* oN)
+ int P,int NG,int *N, int* oN,int starty,int startz,int endy, int endz)
{
int x,y,z,i;
int in_i,out_i,in_z,out_z,in_y,out_y;
+ int s_y,e_y;
-#ifdef FFT5D_THREADS
- int zi;
-
- /* In the thread parallel case we want to loop over z and i
- * in a single for loop to allow for better load balancing.
- */
-#pragma omp parallel for private(z,in_z,out_z,i,in_i,out_i,y,in_y,out_y,x) schedule(static)
- for (zi=0; zi<pK*P; zi++)
+ for (z=startz; z<endz+1; z++) /*3. z l*/
{
- z = zi/P;
- i = zi - z*P;
-#else
- for (z=0; z<pK; z++) /*3. z l*/
- {
-#endif
- in_z = z*maxN*maxM;
- out_z = z*NG*pM;
+ if (z==startz) {
+ s_y=starty;
+ } else {
+ s_y=0;
+ }
+ if (z==endz) {
+ e_y=endy;
+ } else {
+ e_y=pM;
+ }
+ out_z = z*maxN*maxM;
+ in_z = z*NG*pM;
-#ifndef FFT5D_THREADS
for (i=0; i<P; i++) /*index cube along long axis*/
-#endif
{
- in_i = in_z + i*maxN*maxM*maxK;
- out_i = out_z + oN[i];
- for (y=0;y<pM;y++) { /*2. y k*/
- in_y = in_i + y*maxN;
- out_y = out_i + y*NG;
+ out_i = out_z + i*maxN*maxM*maxK;
+ in_i = in_z + oN[i];
+ for (y=s_y;y<e_y;y++) { /*2. y k*/
+ out_y = out_i + y*maxN;
+ in_y = in_i + y*NG;
for (x=0;x<N[i];x++) { /*1. x j*/
- lout[in_y+x] = lin[out_y+x];
+ lout[out_y+x] = lin[in_y+x]; /*in=z*NG*pM+oN[i]+y*NG+x*/
/*after split important that each processor chunk i has size maxN*maxM*maxK and thus being the same size*/
/*before split data contiguos - thus if different processor get different amount oN is different*/
}
the major, middle, minor order is only correct for x,y,z (N,M,K) for the input
N,M,K local dimensions
KG global size*/
-static void joinAxesTrans13(t_complex* lin,const t_complex* lout,
+static void joinAxesTrans13(t_complex* lout,const t_complex* lin,
int maxN,int maxM,int maxK,int pN, int pM, int pK,
- int P,int KG, int* K, int* oK)
+ int P,int KG, int* K, int* oK,int starty, int startx, int endy, int endx)
{
int i,x,y,z;
- int in_i,out_i,in_x,out_x,in_z,out_z;
+ int out_i,in_i,out_x,in_x,out_z,in_z;
+ int s_y,e_y;
-#ifdef FFT5D_THREADS
- int xi;
-
- /* In the thread parallel case we want to loop over x and i
- * in a single for loop to allow for better load balancing.
- */
-#pragma omp parallel for private(x,in_x,out_x,i,in_i,out_i,z,in_z,out_z,y) schedule(static)
- for (xi=0; xi<pN*P; xi++)
+ for (x=startx;x<endx+1;x++) /*1.j*/
{
- x = xi/P;
- i = xi - x*P;
-#else
- for (x=0;x<pN;x++) /*1.j*/
- {
-#endif
- in_x = x*KG*pM;
- out_x = x;
+ if (x==startx)
+ {
+ s_y=starty;
+ }
+ else
+ {
+ s_y=0;
+ }
+ if (x==endx)
+ {
+ e_y=endy;
+ }
+ else
+ {
+ e_y=pM;
+ }
+
+ out_x = x*KG*pM;
+ in_x = x;
-#ifndef FFT5D_THREADS
for (i=0;i<P;i++) /*index cube along long axis*/
-#endif
{
- in_i = in_x + oK[i];
- out_i = out_x + i*maxM*maxN*maxK;
+ out_i = out_x + oK[i];
+ in_i = in_x + i*maxM*maxN*maxK;
for (z=0;z<K[i];z++) /*3.l*/
{
- in_z = in_i + z;
- out_z = out_i + z*maxM*maxN;
- for (y=0;y<pM;y++) { /*2.k*/
- lin[in_z+y*KG] = lout[out_z+y*maxN];
+ out_z = out_i + z;
+ in_z = in_i + z*maxM*maxN;
+ for (y=s_y;y<e_y;y++) /*2.k*/
+ {
+ lout[out_z+y*KG] = lin[in_z+y*maxN]; /*out=x*KG*pM+oK[i]+z+y*KG*/
}
}
}
the minor, middle, major order is only correct for x,y,z (N,M,K) for the input
N,M,K local size
MG, global size*/
-static void joinAxesTrans12(t_complex* lin,const t_complex* lout,int maxN,int maxM,int maxK,int pN, int pM, int pK,
- int P,int MG, int* M, int* oM) {
+static void joinAxesTrans12(t_complex* lout,const t_complex* lin,int maxN,int maxM,int maxK,int pN, int pM, int pK,
+ int P,int MG, int* M, int* oM, int startx, int startz, int endx, int endz) {
int i,z,y,x;
- int in_i,out_i,in_z,out_z,in_x,out_x;
+ int out_i,in_i,out_z,in_z,out_x,in_x;
+ int s_x,e_x;
-#ifdef FFT5D_THREADS
- int zi;
-
- /* In the thread parallel case we want to loop over z and i
- * in a single for loop to allow for better load balancing.
- */
-#pragma omp parallel for private(i,in_i,out_i,z,in_z,out_z,in_x,out_x,x,y) schedule(static)
- for (zi=0; zi<pK*P; zi++)
+ for (z=startz; z<endz+1; z++)
{
- z = zi/P;
- i = zi - z*P;
-#else
- for (z=0; z<pK; z++)
- {
-#endif
- in_z = z*MG*pN;
- out_z = z*maxM*maxN;
+ if (z==startz)
+ {
+ s_x=startx;
+ }
+ else
+ {
+ s_x=0;
+ }
+ if (z==endz)
+ {
+ e_x=endx;
+ }
+ else
+ {
+ e_x=pN;
+ }
+ out_z = z*MG*pN;
+ in_z = z*maxM*maxN;
-#ifndef FFT5D_THREADS
for (i=0; i<P; i++) /*index cube along long axis*/
-#endif
{
- in_i = in_z + oM[i];
- out_i = out_z + i*maxM*maxN*maxK;
- for (x=0;x<pN;x++) {
- in_x = in_i + x*MG;
- out_x = out_i + x;
- for (y=0;y<M[i];y++) {
- lin[in_x+y] = lout[out_x+y*maxN];
+ out_i = out_z + oM[i];
+ in_i = in_z + i*maxM*maxN*maxK;
+ for (x=s_x;x<e_x;x++)
+ {
+ out_x = out_i + x*MG;
+ in_x = in_i + x;
+ for (y=0;y<M[i];y++)
+ {
+ lout[out_x+y] = lin[in_x+y*maxN]; /*out=z*MG*pN+oM[i]+x*MG+y*/
}
}
}
rotate(NG);
}
}
- if (plan->flags&FFT5D_REALCOMPLEX && ((!(plan->flags&FFT5D_BACKWARD) && s==0) || (plan->flags&FFT5D_BACKWARD && s==2))) {
+ if ((plan->flags&FFT5D_REALCOMPLEX) && ((!(plan->flags&FFT5D_BACKWARD) && s==0) || ((plan->flags&FFT5D_BACKWARD) && s==2))) {
xl[0] = rC[s];
}
}
static void print_localdata(const t_complex* lin, const char* txt, int s, fft5d_plan plan) {
- int x,y,z,l;
+ int x,y,z,l,t;
int *coor = plan->coor;
int xs[3],xl[3],xc[3],NG[3];
int ll=(plan->flags&FFT5D_REALCOMPLEX)?1:2;
}
}
-void fft5d_execute(fft5d_plan plan,fft5d_time times) {
+void fft5d_execute(fft5d_plan plan,int thread,fft5d_time times) {
t_complex *lin = plan->lin;
t_complex *lout = plan->lout;
+ t_complex *lout2 = plan->lout2;
+ t_complex *lout3 = plan->lout3;
+ t_complex *fftout,*joinin;
- gmx_fft_t *p1d=plan->p1d;
+ gmx_fft_t **p1d=plan->p1d;
#ifdef FFT5D_MPI_TRANSPOSE
FFTW(plan) *mpip=plan->mpip;
#endif
double time_fft=0,time_local=0,time_mpi[2]={0},time=0;
int *N=plan->N,*M=plan->M,*K=plan->K,*pN=plan->pN,*pM=plan->pM,*pK=plan->pK,
*C=plan->C,*P=plan->P,**iNin=plan->iNin,**oNin=plan->oNin,**iNout=plan->iNout,**oNout=plan->oNout;
- int s=0;
+ int s=0,tstart,tend,bParallelDim;
#ifdef GMX_FFT_FFTW3
- if (plan->p3d) {
- if (times!=0)
- time=MPI_Wtime();
- FFTW(execute)(plan->p3d);
- if (times!=0)
- times->fft+=MPI_Wtime()-time;
+ if (plan->p3d)
+ {
+ if (thread == 0)
+ {
+#ifdef NOGMX
+ if (times!=0)
+ {
+ time=MPI_Wtime();
+ }
+#endif
+ FFTW(execute)(plan->p3d);
+#ifdef NOGMX
+ if (times!=0)
+ {
+ times->fft+=MPI_Wtime()-time;
+ }
+#endif
+ }
return;
}
#endif
+ s=0;
+
/*lin: x,y,z*/
- if (plan->flags&FFT5D_DEBUG) print_localdata(lin, "%d %d: copy in lin\n", s, plan);
- for (s=0;s<2;s++) {
- if (times!=0)
- time=MPI_Wtime();
-
- if ((plan->flags&FFT5D_REALCOMPLEX) && !(plan->flags&FFT5D_BACKWARD) && s==0) {
- gmx_fft_many_1d_real(p1d[s],(plan->flags&FFT5D_BACKWARD)?GMX_FFT_COMPLEX_TO_REAL:GMX_FFT_REAL_TO_COMPLEX,lin,lout);
- } else {
- gmx_fft_many_1d( p1d[s],(plan->flags&FFT5D_BACKWARD)?GMX_FFT_BACKWARD:GMX_FFT_FORWARD, lin,lout);
+ if (plan->flags&FFT5D_DEBUG && thread == 0)
+ {
+ print_localdata(lin, "%d %d: copy in lin\n", s, plan);
}
- if (times!=0)
- time_fft+=MPI_Wtime()-time;
-
- if (plan->flags&FFT5D_DEBUG) print_localdata(lout, "%d %d: FFT %d\n", s, plan);
-
+
+ for (s=0;s<2;s++) { /*loop over first two FFT steps (corner rotations)*/
+
#ifdef GMX_MPI
if (GMX_PARALLEL_ENV_INITIALIZED && cart[s] !=0 && P[s]>1 )
{
- if (times!=0)
- time=MPI_Wtime();
- /*prepare for AllToAll
- 1. (most outer) axes (x) is split into P[s] parts of size N[s]
- for sending*/
- splitaxes(lin,lout,N[s],M[s],K[s], pN[s],pM[s],pK[s],P[s],C[s],iNout[s],oNout[s]);
+ bParallelDim = 1;
+ }
+ else
+#endif
+ {
+ bParallelDim = 0;
+ }
- if (times!=0)
+ /* ---------- START FFT ------------ */
+#ifdef NOGMX
+ if (times!=0 && thread == 0)
+ {
+ time=MPI_Wtime();
+ }
+#endif
+
+ if (bParallelDim) {
+ fftout = lout;
+ }
+ else
+ {
+ if (s==0)
+ {
+ fftout = lout3;
+ } else
+ {
+ fftout = lout2;
+ }
+ }
+
+ tstart = (thread*pM[s]*pK[s]/plan->nthreads)*C[s];
+ if ((plan->flags&FFT5D_REALCOMPLEX) && !(plan->flags&FFT5D_BACKWARD) && s==0)
+ {
+ gmx_fft_many_1d_real(p1d[s][thread],(plan->flags&FFT5D_BACKWARD)?GMX_FFT_COMPLEX_TO_REAL:GMX_FFT_REAL_TO_COMPLEX,lin+tstart,fftout+tstart);
+ } else
+ {
+ gmx_fft_many_1d( p1d[s][thread],(plan->flags&FFT5D_BACKWARD)?GMX_FFT_BACKWARD:GMX_FFT_FORWARD, lin+tstart,fftout+tstart);
+
+ }
+
+#ifdef NOGMX
+ if (times != NULL && thread == 0)
+ {
+ time_fft+=MPI_Wtime()-time;
+ }
+#endif
+ if (plan->flags&FFT5D_DEBUG && thread == 0)
+ {
+ print_localdata(lout, "%d %d: FFT %d\n", s, plan);
+ }
+ /* ---------- END FFT ------------ */
+
+ /* ---------- START SPLIT + TRANSPOSE------------ (if parallel in in this dimension)*/
+ if (bParallelDim) {
+#ifdef NOGMX
+ if (times != NULL && thread == 0)
{
- time_local+=MPI_Wtime()-time;
-
- /*send, recv*/
time=MPI_Wtime();
}
+#endif
+ /*prepare for A
+llToAll
+ 1. (most outer) axes (x) is split into P[s] parts of size N[s]
+ for sending*/
+ if (pM[s]>0)
+ {
+ tend = ((thread+1)*pM[s]*pK[s]/plan->nthreads);
+ tstart/=C[s];
+ splitaxes(lout2,lout,N[s],M[s],K[s], pN[s],pM[s],pK[s],P[s],C[s],iNout[s],oNout[s],tstart%pM[s],tstart/pM[s],tend%pM[s],tend/pM[s]);
+ }
+#pragma omp barrier /*barrier required before AllToAll (all input has to be their) - before timing to make timing more acurate*/
+#ifdef NOGMX
+ if (times != NULL && thread == 0)
+ {
+ time_local+=MPI_Wtime()-time;
+ }
+#endif
+ /* ---------- END SPLIT , START TRANSPOSE------------ */
+
+ if (thread == 0)
+ {
+#ifdef NOGMX
+ if (times!=0)
+ {
+ time=MPI_Wtime();
+ }
+#else
+ wallcycle_start(times,ewcPME_FFTCOMM);
+#endif
#ifdef FFT5D_MPI_TRANSPOSE
- FFTW(execute)(mpip[s]);
+ FFTW(execute)(mpip[s]);
#else
- if ((s==0 && !(plan->flags&FFT5D_ORDER_YZ)) || (s==1 && (plan->flags&FFT5D_ORDER_YZ)))
- MPI_Alltoall(lin,N[s]*pM[s]*K[s]*sizeof(t_complex)/sizeof(real),GMX_MPI_REAL,lout,N[s]*pM[s]*K[s]*sizeof(t_complex)/sizeof(real),GMX_MPI_REAL,cart[s]);
- else
- MPI_Alltoall(lin,N[s]*M[s]*pK[s]*sizeof(t_complex)/sizeof(real),GMX_MPI_REAL,lout,N[s]*M[s]*pK[s]*sizeof(t_complex)/sizeof(real),GMX_MPI_REAL,cart[s]);
-#endif /*FFT5D_MPI_TRANSPOSE*/
- if (times!=0)
- time_mpi[s]=MPI_Wtime()-time;
- }
+#ifdef GMX_MPI
+ if ((s==0 && !(plan->flags&FFT5D_ORDER_YZ)) || (s==1 && (plan->flags&FFT5D_ORDER_YZ)))
+ MPI_Alltoall(lout2,N[s]*pM[s]*K[s]*sizeof(t_complex)/sizeof(real),GMX_MPI_REAL,lout3,N[s]*pM[s]*K[s]*sizeof(t_complex)/sizeof(real),GMX_MPI_REAL,cart[s]);
+ else
+ MPI_Alltoall(lout2,N[s]*M[s]*pK[s]*sizeof(t_complex)/sizeof(real),GMX_MPI_REAL,lout3,N[s]*M[s]*pK[s]*sizeof(t_complex)/sizeof(real),GMX_MPI_REAL,cart[s]);
+#else
+ gmx_incons("fft5d MPI call without MPI configuration");
#endif /*GMX_MPI*/
+#endif /*FFT5D_MPI_TRANSPOSE*/
+#ifdef NOGMX
+ if (times!=0)
+ {
+ time_mpi[s]=MPI_Wtime()-time;
+ }
+#else
+ wallcycle_stop(times,ewcPME_FFTCOMM);
+#endif
+ } /*master*/
+ } /* bPrallelDim */
+#pragma omp barrier /*both needed for parallel and non-parallel dimension (either have to wait on data from AlltoAll or from last FFT*/
-
- if (times!=0)
+ /* ---------- END SPLIT + TRANSPOSE------------ */
+
+ /* ---------- START JOIN ------------ */
+#ifdef NOGMX
+ if (times != NULL && thread == 0)
+ {
time=MPI_Wtime();
+ }
+#endif
+
+ if (bParallelDim) {
+ joinin = lout3;
+ } else {
+ joinin = fftout;
+ }
/*bring back in matrix form
thus make new 1. axes contiguos
- also local transpose 1 and 2/3 */
- if ((s==0 && !(plan->flags&FFT5D_ORDER_YZ)) || (s==1 && (plan->flags&FFT5D_ORDER_YZ)))
- joinAxesTrans13(lin,lout,N[s],pM[s],K[s],pN[s],pM[s],pK[s],P[s],C[s+1],iNin[s+1],oNin[s+1]);
- else
- joinAxesTrans12(lin,lout,N[s],M[s],pK[s],pN[s],pM[s],pK[s],P[s],C[s+1],iNin[s+1],oNin[s+1]);
- if (times!=0)
+ also local transpose 1 and 2/3
+ runs on thread used for following FFT (thus needing a barrier before but not afterwards)
+ */
+ if ((s==0 && !(plan->flags&FFT5D_ORDER_YZ)) || (s==1 && (plan->flags&FFT5D_ORDER_YZ))) {
+ if (pM[s]>0)
+ {
+ tstart = ( thread *pM[s]*pN[s]/plan->nthreads);
+ tend = ((thread+1)*pM[s]*pN[s]/plan->nthreads);
+ joinAxesTrans13(lin,joinin,N[s],pM[s],K[s],pN[s],pM[s],pK[s],P[s],C[s+1],iNin[s+1],oNin[s+1],tstart%pM[s],tstart/pM[s],tend%pM[s],tend/pM[s]);
+ }
+ }
+ else {
+ if (pN[s]>0)
+ {
+ tstart = ( thread *pK[s]*pN[s]/plan->nthreads);
+ tend = ((thread+1)*pK[s]*pN[s]/plan->nthreads);
+ joinAxesTrans12(lin,joinin,N[s],M[s],pK[s],pN[s],pM[s],pK[s],P[s],C[s+1],iNin[s+1],oNin[s+1],tstart%pN[s],tstart/pN[s],tend%pN[s],tend/pN[s]);
+ }
+ }
+
+#ifdef NOGMX
+ if (times != NULL && thread == 0)
+ {
time_local+=MPI_Wtime()-time;
-
- if (plan->flags&FFT5D_DEBUG) print_localdata(lin, "%d %d: tranposed %d\n", s+1, plan);
-
+ }
+#endif
+ if (plan->flags&FFT5D_DEBUG && thread == 0)
+ {
+ print_localdata(lin, "%d %d: tranposed %d\n", s+1, plan);
+ }
+ /* ---------- END JOIN ------------ */
+
/*if (debug) print_localdata(lin, "%d %d: transposed x-z\n", N1, M0, K, ZYX, coor);*/
- }
-
- if (times!=0)
- time=MPI_Wtime();
- if (plan->flags&FFT5D_INPLACE) lout=lin;
+ } /* for(s=0;s<2;s++) */
+#ifdef NOGMX
+ if (times != NULL && thread == 0)
+ {
+ time=MPI_Wtime();
+ }
+#endif
+
+ if (plan->flags&FFT5D_INPLACE) lout=lin; /*in place currently not supported*/
+
+ /* ----------- FFT ----------- */
+ tstart = (thread*pM[s]*pK[s]/plan->nthreads)*C[s];
if ((plan->flags&FFT5D_REALCOMPLEX) && (plan->flags&FFT5D_BACKWARD)) {
- gmx_fft_many_1d_real(p1d[s],(plan->flags&FFT5D_BACKWARD)?GMX_FFT_COMPLEX_TO_REAL:GMX_FFT_REAL_TO_COMPLEX,lin,lout);
+ gmx_fft_many_1d_real(p1d[s][thread],(plan->flags&FFT5D_BACKWARD)?GMX_FFT_COMPLEX_TO_REAL:GMX_FFT_REAL_TO_COMPLEX,lin+tstart,lout+tstart);
} else {
- gmx_fft_many_1d( p1d[s],(plan->flags&FFT5D_BACKWARD)?GMX_FFT_BACKWARD:GMX_FFT_FORWARD, lin,lout);
+ gmx_fft_many_1d( p1d[s][thread],(plan->flags&FFT5D_BACKWARD)?GMX_FFT_BACKWARD:GMX_FFT_FORWARD, lin+tstart,lout+tstart);
}
+ /* ------------ END FFT ---------*/
- if (times!=0)
+#ifdef NOGMX
+ if (times != NULL && thread == 0)
+ {
time_fft+=MPI_Wtime()-time;
- if (plan->flags&FFT5D_DEBUG) print_localdata(lout, "%d %d: FFT %d\n", s, plan);
- /*if (debug) print_localdata(lout, "%d %d: FFT in y\n", N1, M, K0, YZX, coor);*/
-
- if (times!=0) {
+
times->fft+=time_fft;
times->local+=time_local;
times->mpi2+=time_mpi[1];
times->mpi1+=time_mpi[0];
}
+#endif
+
+ if (plan->flags&FFT5D_DEBUG && thread == 0)
+ {
+ print_localdata(lout, "%d %d: FFT %d\n", s, plan);
+ }
}
void fft5d_destroy(fft5d_plan plan) {
- int s;
- for (s=0;s<3;s++) {
- gmx_many_fft_destroy(plan->p1d[s]);
- if (plan->iNin[s]) {
+ int s,t;
+ for (s=0;s<3;s++)
+ {
+ if (plan->p1d[s])
+ {
+ for (t=0;t<plan->nthreads;t++)
+ {
+ gmx_many_fft_destroy(plan->p1d[s][t]);
+ }
+ free(plan->p1d[s]);
+ }
+ if (plan->iNin[s])
+ {
free(plan->iNin[s]);
plan->iNin[s]=0;
}
- if (plan->oNin[s]) {
+ if (plan->oNin[s])
+ {
free(plan->oNin[s]);
plan->oNin[s]=0;
}
- if (plan->iNout[s]) {
+ if (plan->iNout[s])
+ {
free(plan->iNout[s]);
plan->iNout[s]=0;
}
- if (plan->oNout[s]) {
+ if (plan->oNout[s])
+ {
free(plan->oNout[s]);
plan->oNout[s]=0;
}
FFTW_LOCK;
#ifdef FFT5D_MPI_TRANSPOS
for (s=0;s<2;s++)
+ {
FFTW(destroy_plan)(plan->mpip[s]);
+ }
+ if (plan->p3d)
+ {
+ FFTW(destroy_plan)(plan->p3d);
+ }
#endif /* FFT5D_MPI_TRANSPOS */
#endif /* GMX_FFT_FFTW3 */
- /*We can't free lin/lout here - is allocated by gmx_calloc_aligned which can't be freed*/
-
+ if (!(plan->flags&FFT5D_NOMALLOC))
+ {
+ sfree_aligned(plan->lin);
+ sfree_aligned(plan->lout);
+ sfree_aligned(plan->lout2);
+ sfree_aligned(plan->lout3);
+ }
#ifdef FFT5D_THREADS
#ifdef FFT5D_FFTW_THREADS
- FFTW(cleanup_threads)();
+ /*FFTW(cleanup_threads)();*/
#endif
#endif
/*same as fft5d_plan_3d but with cartesian coordinator and automatic splitting
of processor dimensions*/
-fft5d_plan fft5d_plan_3d_cart(int NG, int MG, int KG, MPI_Comm comm, int P0, int flags, t_complex** rlin, t_complex** rlout) {
+fft5d_plan fft5d_plan_3d_cart(int NG, int MG, int KG, MPI_Comm comm, int P0, int flags, t_complex** rlin, t_complex** rlout, t_complex** rlout2, t_complex** rlout3, int nthreads) {
MPI_Comm cart[2]={0};
#ifdef GMX_MPI
int size=1,prank=0;
MPI_Comm_rank(comm,&prank);
if (P0==0) P0 = lfactor(size);
- if (size%P0!=0) {
+ if (size%P0!=0)
+ {
if (prank==0) printf("FFT5D: WARNING: Number of processors %d not evenly dividable by %d\n",size,P0);
P0 = lfactor(size);
}
MPI_Cart_sub(gcart, rdim1 , &cart[0]);
MPI_Cart_sub(gcart, rdim2 , &cart[1]);
#endif
- return fft5d_plan_3d(NG, MG, KG, cart, flags, rlin, rlout);
+ return fft5d_plan_3d(NG, MG, KG, cart, flags, rlin, rlout,rlout2,rlout3,nthreads);
}
int x,y,z,l;
int *coor = plan->coor;
int ll=2; /*compare ll values per element (has to be 2 for complex)*/
- if (plan->flags&FFT5D_REALCOMPLEX && plan->flags&FFT5D_BACKWARD)
+ if ((plan->flags&FFT5D_REALCOMPLEX) && (plan->flags&FFT5D_BACKWARD))
{
ll=1;
}
+/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2012, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ *
+ * And Hey:
+ * Groningen Machine for Chemical Simulation
+ */
+
#ifndef FFT5D_H_
#define FFT5D_H_
#define FFTW(x) fftw_##x
#endif
+#ifdef NOGMX
struct fft5d_time_t {
- double fft,local,mpi1,mpi2;
+ double fft,local,mpi1,mpi2;
};
typedef struct fft5d_time_t *fft5d_time;
+#else
+#include "gmx_wallcycle.h"
+typedef gmx_wallcycle_t fft5d_time;
+#endif
typedef enum fft5d_flags_t {
- FFT5D_ORDER_YZ=1,
- FFT5D_BACKWARD=2,
- FFT5D_REALCOMPLEX=4,
- FFT5D_DEBUG=8,
- FFT5D_NOMEASURE=16,
- FFT5D_INPLACE=32,
- FFT5D_NOMALLOC=64
+ FFT5D_ORDER_YZ=1,
+ FFT5D_BACKWARD=2,
+ FFT5D_REALCOMPLEX=4,
+ FFT5D_DEBUG=8,
+ FFT5D_NOMEASURE=16,
+ FFT5D_INPLACE=32,
+ FFT5D_NOMALLOC=64
} fft5d_flags;
struct fft5d_plan_t {
- t_complex *lin;
- t_complex *lout;
- gmx_fft_t p1d[3]; /*1D plans*/
+ t_complex *lin;
+ t_complex *lout,*lout2,*lout3;
+ gmx_fft_t* p1d[3]; /*1D plans*/
#ifdef GMX_FFT_FFTW3
- FFTW(plan) p2d; /*2D plan: used for 1D decomposition if FFT supports transposed output*/
- FFTW(plan) p3d; /*3D plan: used for 0D decomposition if FFT supports transposed output*/
- FFTW(plan) mpip[2];
+ FFTW(plan) p2d; /*2D plan: used for 1D decomposition if FFT supports transposed output*/
+ FFTW(plan) p3d; /*3D plan: used for 0D decomposition if FFT supports transposed output*/
+ FFTW(plan) mpip[2];
#endif
- MPI_Comm cart[2];
+ MPI_Comm cart[2];
int N[3],M[3],K[3]; /*local length in transposed coordinate system (if not divisisable max)*/
int pN[3],pM[3], pK[3]; /*local length - not max but length for this processor*/
int oM[3],oK[3]; /*offset for current processor*/
int *iNin[3],*oNin[3],*iNout[3],*oNout[3]; /*size for each processor (if divisisable=max) for out(=split)
- and in (=join) and offsets in transposed coordinate system*/
+ and in (=join) and offsets in transposed coordinate system*/
int C[3],rC[3]; /*global length (of the one global axes) */
/* C!=rC for real<->complex. then C=rC/2 but with potential padding*/
int P[2]; /*size of processor grid*/
-/* int fftorder;*/
-/* int direction;*/
-/* int realcomplex;*/
- int flags;
+/* int fftorder;*/
+/* int direction;*/
+/* int realcomplex;*/
+ int flags;
/*int N0,N1,M0,M1,K0,K1;*/
- int NG,MG,KG;
- /*int P[2];*/
- int coor[2];
+ int NG,MG,KG;
+ /*int P[2];*/
+ int coor[2];
+ int nthreads;
};
typedef struct fft5d_plan_t *fft5d_plan;
-void fft5d_execute(fft5d_plan plan,fft5d_time times);
-fft5d_plan fft5d_plan_3d(int N, int M, int K, MPI_Comm comm[2], int flags, t_complex** lin, t_complex** lin2);
+void fft5d_execute(fft5d_plan plan,int thread,fft5d_time times);
+fft5d_plan fft5d_plan_3d(int N, int M, int K, MPI_Comm comm[2], int flags, t_complex** lin, t_complex** lin2, t_complex** lout2, t_complex** lout3, int nthreads);
void fft5d_local_size(fft5d_plan plan,int* N1,int* M0,int* K0,int* K1,int** coor);
void fft5d_destroy(fft5d_plan plan);
-fft5d_plan fft5d_plan_3d_cart(int N, int M, int K, MPI_Comm comm, int P0, int flags, t_complex** lin, t_complex** lin2);
+fft5d_plan fft5d_plan_3d_cart(int N, int M, int K, MPI_Comm comm, int P0, int flags, t_complex** lin, t_complex** lin2, t_complex** lout2, t_complex** lout3, int nthreads);
void fft5d_compare_data(const t_complex* lin, const t_complex* in, fft5d_plan plan, int bothLocal, int normarlize);
#endif /*FFTLIB_H_*/
+
{
char buf[STRLEN];
int i,j;
- void * p_tmp;
if (tabfn == NULL) {
if (debug)
*/
/* For performance reasons we want
- * the table data to be aligned to 16-byte. This is accomplished
- * by allocating 16 bytes extra to a temporary pointer, and then
- * calculating an aligned pointer. This new pointer must not be
- * used in a free() call, but thankfully we're sloppy enough not
- * to do this...
+ * the table data to be aligned to 16-byte. The pointer could be freed
+ * but currently isn't.
*/
-
- /* 8 fp entries per vdw table point, n+1 points, and 16 bytes extra to align it. */
- p_tmp = malloc(8*(nbl->tab.n+1)*sizeof(real)+16);
-
- /* align it - size_t has the same same as a pointer */
- nbl->vdwtab = (real *) (((size_t) p_tmp + 16) & (~((size_t) 15)));
-
- /* 4 fp entries per coul table point, n+1 points, and 16 bytes extra to align it. */
- p_tmp = malloc(4*(nbl->tab.n+1)*sizeof(real)+16);
-
- /* align it - size_t has the same same as a pointer */
- nbl->coultab = (real *) (((size_t) p_tmp + 16) & (~((size_t) 15)));
-
+ snew_aligned(nbl->vdwtab,8*(nbl->tab.n+1),16);
+ snew_aligned(nbl->coultab,4*(nbl->tab.n+1),16);
for(i=0; i<=nbl->tab.n; i++) {
for(j=0; j<4; j++)
return cutoff;
}
+static void make_adress_tf_tables(FILE *fp,const output_env_t oenv,
+ t_forcerec *fr,const t_inputrec *ir,
+ const char *tabfn, const gmx_mtop_t *mtop,
+ matrix box)
+{
+ char buf[STRLEN];
+ int i,j;
+
+ if (tabfn == NULL) {
+ gmx_fatal(FARGS,"No thermoforce table file given. Use -tabletf to specify a file\n");
+ return;
+ }
+
+ snew(fr->atf_tabs, ir->adress->n_tf_grps);
+
+ for (i=0; i<ir->adress->n_tf_grps; i++){
+ j = ir->adress->tf_table_index[i]; /* get energy group index */
+ sprintf(buf + strlen(tabfn) - strlen(ftp2ext(efXVG)) - 1,"tf_%s.%s",
+ *(mtop->groups.grpname[mtop->groups.grps[egcENER].nm_ind[j]]) ,ftp2ext(efXVG));
+ printf("loading tf table for energygrp index %d from %s\n", ir->adress->tf_table_index[j], buf);
+ fr->atf_tabs[i] = make_atf_table(fp,oenv,fr,buf, box);
+ }
+
+}
+
gmx_bool can_use_allvsall(const t_inputrec *ir, const gmx_mtop_t *mtop,
gmx_bool bPrintNote,t_commrec *cr,FILE *fp)
{
matrix box,
gmx_bool bMolEpot,
const char *tabfn,
+ const char *tabafn,
const char *tabpfn,
const char *tabbfn,
gmx_bool bNoSolvOpt,
fr->n_tpi = 0;
}
+ /* Copy AdResS parameters */
+ if (ir->bAdress) {
+ fr->adress_type = ir->adress->type;
+ fr->adress_const_wf = ir->adress->const_wf;
+ fr->adress_ex_width = ir->adress->ex_width;
+ fr->adress_hy_width = ir->adress->hy_width;
+ fr->adress_icor = ir->adress->icor;
+ fr->adress_site = ir->adress->site;
+ fr->adress_ex_forcecap = ir->adress->ex_forcecap;
+ fr->adress_do_hybridpairs = ir->adress->do_hybridpairs;
+
+
+ snew(fr->adress_group_explicit , ir->adress->n_energy_grps);
+ for (i=0; i< ir->adress->n_energy_grps; i++){
+ fr->adress_group_explicit[i]= ir->adress->group_explicit[i];
+ }
+
+ fr->n_adress_tf_grps = ir->adress->n_tf_grps;
+ snew(fr->adress_tf_table_index, fr->n_adress_tf_grps);
+ for (i=0; i< fr->n_adress_tf_grps; i++){
+ fr->adress_tf_table_index[i]= ir->adress->tf_table_index[i];
+ }
+ copy_rvec(ir->adress->refs,fr->adress_refs);
+ } else {
+ fr->adress_type = eAdressOff;
+ fr->adress_do_hybridpairs = FALSE;
+ }
+
/* Copy the user determined parameters */
fr->userint1 = ir->userint1;
fr->userint2 = ir->userint2;
fr->bF_NoVirSum = (EEL_FULL(fr->eeltype) ||
gmx_mtop_ftype_count(mtop,F_POSRES) > 0 ||
- IR_ELEC_FIELD(*ir));
+ IR_ELEC_FIELD(*ir) ||
+ (fr->adress_icor != eAdressICOff)
+ );
/* Mask that says whether or not this NBF list should be computed */
/* if (fr->bMask == NULL) {
fr->tab14 = make_tables(fp,oenv,fr,MASTER(cr),tabpfn,rtab,
GMX_MAKETABLES_14ONLY);
}
+
+ /* Read AdResS Thermo Force table if needed */
+ if(fr->adress_icor == eAdressICThermoForce)
+ {
+ /* old todo replace */
+
+ if (ir->adress->n_tf_grps > 0){
+ make_adress_tf_tables(fp,oenv,fr,ir,tabfn, mtop, box);
+
+ }else{
+ /* load the default table */
+ snew(fr->atf_tabs, 1);
+ fr->atf_tabs[DEFAULT_TF_TABLE] = make_atf_table(fp,oenv,fr,tabafn, box);
+ }
+ }
/* Wall stuff */
fr->nwall = ir->nwall;
/* Initialize neighbor search */
init_ns(fp,cr,&fr->ns,fr,mtop,box);
- if (cr->duty & DUTY_PP)
+ if (cr->duty & DUTY_PP){
gmx_setup_kernels(fp,bGenericKernelOnly);
+ if (ir->bAdress)
+ gmx_setup_adress_kernels(fp,bGenericKernelOnly);
+ }
}
#define pr_real(fp,r) fprintf(fp,"%s: %e\n",#r,r)
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
return 0;
}
-int print_nblist(int natoms, t_nblist *nl)
-{
- int i,k,ai,aj,nj0,nj1;
-
- printf("genborn.c: print_nblist, natoms=%d\n",nl->nri);
-
- for(i=0;i<nl->nri;i++)
- {
- ai=nl->iinr[i];
- nj0=nl->jindex[i];
- nj1=nl->jindex[i+1];
-
- for(k=nj0;k<nj1;k++)
- {
- aj=nl->jjnr[k];
- printf("ai=%d, aj=%d\n",ai,aj);
- }
- }
-
- return 0;
-}
-
-
void gb_pd_send(t_commrec *cr, real *send_data, int nr)
{
#ifdef GMX_MPI
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
+++ /dev/null
-/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
- *
- *
- * Gromacs 4.0 Copyright (c) 1991-2003
- * David van der Spoel, Erik Lindahl, University of Groningen.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the research papers on the package. Check out http://www.gromacs.org
- *
- * And Hey:
- * Gnomes, ROck Monsters And Chili Sauce
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef GMX_FFT_FFTW2
-
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-
-#include "gmx_fft.h"
-#include "gmx_fatal.h"
-
-
-
-#ifdef FFTW2_NAME_FFTW
-# include<fftw.h>
-# include<rfftw.h>
-#elif defined FFTW2_NAME_SFFTW
-# include<sfftw.h>
-# include<srfftw.h>
-#elif defined FFTW2_NAME_DFFTW
-# include<dfftw.h>
-# include<drfftw.h>
-#else
-#error No FFTW2 name defined - you must define one of:
-#error FFTW2_NAME_FFTW, FFTW2_NAME_SFFTW, FFTW2_NAME_DFFTW
-#endif
-
-
-/* Contents of the FFTW2 setup */
-struct gmx_fft
-{
- int ndim; /**< Number of dimensions in transform. */
- int nx; /**< Data X dimension */
- int ny; /**< Data Y dimension */
- int nz; /**< Data Z dimension */
- /* Arrays with fftw2 plans.
- * First index is 0 for out-of-place, 1 for in-place transform.
- * Second index is 0 for backward, 1 for forward.
- */
- fftw_plan single[2][2]; /**< Plans for 1d transforms. */
- fftwnd_plan multi[2][2]; /**< Plans for n-d transforms. */
- real * work; /**< Avoid overwriting input for c2r ffts */
-};
-
-
-
-int
-gmx_fft_init_1d(gmx_fft_t * pfft,
- int nx,
- gmx_fft_flag flags)
-{
- int i,j;
- gmx_fft_t fft;
- int fftw_flags;
-
- /* FFTW2 is slow to measure, so we do not use it */
-
- /* If you change this, add an #ifndef for GMX_DISABLE_FFTW_MEASURE around it! */
- fftw_flags = FFTW_ESTIMATE;
-
- if(pfft==NULL)
- {
- gmx_fatal(FARGS,"Invalid opaque FFT datatype pointer.");
- return EINVAL;
- }
- *pfft = NULL;
-
- if( (fft = (gmx_fft_t)malloc(sizeof(struct gmx_fft))) == NULL)
- {
- return ENOMEM;
- }
-
-
- fft->single[0][0] = fftw_create_plan(nx,FFTW_BACKWARD,FFTW_OUT_OF_PLACE|fftw_flags);
- fft->single[0][1] = fftw_create_plan(nx,FFTW_FORWARD,FFTW_OUT_OF_PLACE|fftw_flags);
- fft->single[1][0] = fftw_create_plan(nx,FFTW_BACKWARD,FFTW_IN_PLACE|fftw_flags);
- fft->single[1][1] = fftw_create_plan(nx,FFTW_FORWARD,FFTW_IN_PLACE|fftw_flags);
-
-
- fft->multi[0][0] = NULL;
- fft->multi[0][1] = NULL;
- fft->multi[1][0] = NULL;
- fft->multi[1][1] = NULL;
-
- for(i=0;i<2;i++)
- {
- for(j=0;j<2;j++)
- {
- if(fft->single[i][j] == NULL)
- {
- gmx_fatal(FARGS,"Error initializing FFTW2 plan.");
- gmx_fft_destroy(fft);
- return -1;
- }
- }
- }
-
- /* No workspace needed for complex-to-complex FFTs */
- fft->work = NULL;
-
- fft->ndim = 1;
- fft->nx = nx;
-
- *pfft = fft;
- return 0;
-}
-
-
-
-int
-gmx_fft_init_1d_real(gmx_fft_t * pfft,
- int nx,
- gmx_fft_flag flags)
-{
- int i,j;
- gmx_fft_t fft;
- int fftw_flags;
-
- /* FFTW2 is slow to measure, so we do not use it */
- /* If you change this, add an #ifndef for GMX_DISABLE_FFTW_MEASURE around it! */
- fftw_flags = FFTW_ESTIMATE;
-
- if(pfft==NULL)
- {
- gmx_fatal(FARGS,"Invalid opaque FFT datatype pointer.");
- return EINVAL;
- }
- *pfft = NULL;
-
- if( (fft = (gmx_fft_t)malloc(sizeof(struct gmx_fft))) == NULL)
- {
- return ENOMEM;
- }
-
-
- fft->single[0][0] = rfftw_create_plan(nx,FFTW_COMPLEX_TO_REAL,FFTW_OUT_OF_PLACE|fftw_flags);
- fft->single[0][1] = rfftw_create_plan(nx,FFTW_REAL_TO_COMPLEX,FFTW_OUT_OF_PLACE|fftw_flags);
- fft->single[1][0] = rfftw_create_plan(nx,FFTW_COMPLEX_TO_REAL,FFTW_IN_PLACE|fftw_flags);
- fft->single[1][1] = rfftw_create_plan(nx,FFTW_REAL_TO_COMPLEX,FFTW_IN_PLACE|fftw_flags);
-
-
- fft->multi[0][0] = NULL;
- fft->multi[0][1] = NULL;
- fft->multi[1][0] = NULL;
- fft->multi[1][1] = NULL;
-
- for(i=0;i<2;i++)
- {
- for(j=0;j<2;j++)
- {
- if(fft->single[i][j] == NULL)
- {
- gmx_fatal(FARGS,"Error initializing FFTW2 plan.");
- gmx_fft_destroy(fft);
- return -1;
- }
- }
- }
-
- /* FFTW2 overwrites the input when doing out-of-place complex-to-real FFTs.
- * This is not acceptable for the Gromacs interface, so we define a
- * work array and copy the data there before doing complex-to-real FFTs.
- */
- fft->work = (real *)malloc(sizeof(real)*( (nx/2 + 1)*2) );
- if(fft->work == NULL)
- {
- gmx_fatal(FARGS,"Cannot allocate complex-to-real FFT workspace.");
- gmx_fft_destroy(fft);
- return ENOMEM;
- }
-
- fft->ndim = 1;
- fft->nx = nx;
-
- *pfft = fft;
- return 0;
-}
-
-
-
-int
-gmx_fft_init_2d(gmx_fft_t * pfft,
- int nx,
- int ny,
- gmx_fft_flag flags)
-{
- int i,j;
- gmx_fft_t fft;
- int fftw_flags;
-
-
- /* FFTW2 is slow to measure, so we do not use it */
- /* If you change this, add an #ifndef for GMX_DISABLE_FFTW_MEASURE around it! */
- fftw_flags = FFTW_ESTIMATE;
-
- if(pfft==NULL)
- {
- gmx_fatal(FARGS,"Invalid opaque FFT datatype pointer.");
- return EINVAL;
- }
- *pfft = NULL;
-
- if( (fft = (gmx_fft_t)malloc(sizeof(struct gmx_fft))) == NULL)
- {
- return ENOMEM;
- }
-
- fft->single[0][0] = NULL;
- fft->single[0][1] = NULL;
- fft->single[1][0] = NULL;
- fft->single[1][1] = NULL;
-
- fft->multi[0][0] = fftw2d_create_plan(nx,ny,FFTW_BACKWARD,FFTW_OUT_OF_PLACE|fftw_flags);
- fft->multi[0][1] = fftw2d_create_plan(nx,ny,FFTW_FORWARD,FFTW_OUT_OF_PLACE|fftw_flags);
- fft->multi[1][0] = fftw2d_create_plan(nx,ny,FFTW_BACKWARD,FFTW_IN_PLACE|fftw_flags);
- fft->multi[1][1] = fftw2d_create_plan(nx,ny,FFTW_FORWARD,FFTW_IN_PLACE|fftw_flags);
-
- for(i=0;i<2;i++)
- {
- for(j=0;j<2;j++)
- {
- if(fft->multi[i][j] == NULL)
- {
- gmx_fatal(FARGS,"Error initializing FFTW2 plan.");
- gmx_fft_destroy(fft);
- return -1;
- }
- }
- }
-
- /* No workspace needed for complex-to-complex FFTs */
- fft->work = NULL;
-
- fft->ndim = 2;
- fft->nx = nx;
- fft->ny = ny;
-
- *pfft = fft;
- return 0;
-}
-
-
-
-
-int
-gmx_fft_init_2d_real(gmx_fft_t * pfft,
- int nx,
- int ny,
- gmx_fft_flag flags)
-{
- int i,j;
- gmx_fft_t fft;
- int fftw_flags;
-
-
- /* FFTW2 is slow to measure, so we do not use it */
- /* If you change this, add an #ifndef for GMX_DISABLE_FFTW_MEASURE around it! */
- fftw_flags = FFTW_ESTIMATE;
-
- if(pfft==NULL)
- {
- gmx_fatal(FARGS,"Invalid opaque FFT datatype pointer.");
- return EINVAL;
- }
- *pfft = NULL;
-
- if( (fft = (gmx_fft_t)malloc(sizeof(struct gmx_fft))) == NULL)
- {
- return ENOMEM;
- }
-
- fft->single[0][0] = NULL;
- fft->single[0][1] = NULL;
- fft->single[1][0] = NULL;
- fft->single[1][1] = NULL;
-
-
- fft->multi[0][0] = rfftw2d_create_plan(nx,ny,FFTW_COMPLEX_TO_REAL,FFTW_OUT_OF_PLACE|fftw_flags);
- fft->multi[0][1] = rfftw2d_create_plan(nx,ny,FFTW_REAL_TO_COMPLEX,FFTW_OUT_OF_PLACE|fftw_flags);
- fft->multi[1][0] = rfftw2d_create_plan(nx,ny,FFTW_COMPLEX_TO_REAL,FFTW_IN_PLACE|fftw_flags);
- fft->multi[1][1] = rfftw2d_create_plan(nx,ny,FFTW_REAL_TO_COMPLEX,FFTW_IN_PLACE|fftw_flags);
-
-
- for(i=0;i<2;i++)
- {
- for(j=0;j<2;j++)
- {
- if(fft->multi[i][j] == NULL)
- {
- gmx_fatal(FARGS,"Error initializing FFTW2 plan.");
- gmx_fft_destroy(fft);
- return -1;
- }
- }
- }
-
- /* FFTW2 overwrites the input when doing out-of-place complex-to-real FFTs.
- * This is not acceptable for the Gromacs interface, so we define a
- * work array and copy the data there before doing complex-to-real FFTs.
- */
- fft->work = (real *)malloc(sizeof(real)*( nx*(ny/2 + 1)*2) );
- if(fft->work == NULL)
- {
- gmx_fatal(FARGS,"Cannot allocate complex-to-real FFT workspace.");
- gmx_fft_destroy(fft);
- return ENOMEM;
- }
-
-
- fft->ndim = 2;
- fft->nx = nx;
- fft->ny = ny;
-
- *pfft = fft;
- return 0;
-}
-
-
-int
-gmx_fft_init_3d(gmx_fft_t * pfft,
- int nx,
- int ny,
- int nz,
- gmx_fft_flag flags)
-{
- int i,j;
- gmx_fft_t fft;
- int fftw_flags;
-
-
- /* FFTW2 is slow to measure, so we do not use it */
- /* If you change this, add an #ifndef for GMX_DISABLE_FFTW_MEASURE around it! */
- fftw_flags = FFTW_ESTIMATE;
-
- if(pfft==NULL)
- {
- gmx_fatal(FARGS,"Invalid opaque FFT datatype pointer.");
- return EINVAL;
- }
- *pfft = NULL;
-
- if( (fft = (gmx_fft_t)malloc(sizeof(struct gmx_fft))) == NULL)
- {
- return ENOMEM;
- }
-
- fft->single[0][0] = NULL;
- fft->single[0][1] = NULL;
- fft->single[1][0] = NULL;
- fft->single[1][1] = NULL;
-
-
- fft->multi[0][0] = fftw3d_create_plan(nx,ny,nz,FFTW_BACKWARD,FFTW_OUT_OF_PLACE|fftw_flags);
- fft->multi[0][1] = fftw3d_create_plan(nx,ny,nz,FFTW_FORWARD,FFTW_OUT_OF_PLACE|fftw_flags);
- fft->multi[1][0] = fftw3d_create_plan(nx,ny,nz,FFTW_BACKWARD,FFTW_IN_PLACE|fftw_flags);
- fft->multi[1][1] = fftw3d_create_plan(nx,ny,nz,FFTW_FORWARD,FFTW_IN_PLACE|fftw_flags);
-
-
- for(i=0;i<2;i++)
- {
- for(j=0;j<2;j++)
- {
- if(fft->multi[i][j] == NULL)
- {
- gmx_fatal(FARGS,"Error initializing FFTW2 plan.");
- gmx_fft_destroy(fft);
- return -1;
- }
- }
- }
-
- /* No workspace needed for complex-to-complex FFTs */
- fft->work = NULL;
- fft->nx = nx;
- fft->ny = ny;
- fft->nz = nz;
-
- fft->ndim = 3;
-
- *pfft = fft;
- return 0;
-}
-
-
-
-
-int
-gmx_fft_init_3d_real(gmx_fft_t * pfft,
- int nx,
- int ny,
- int nz,
- gmx_fft_flag flags)
-{
- int i,j;
- gmx_fft_t fft;
- int fftw_flags;
-
-
- /* FFTW2 is slow to measure, so we do not use it */
- /* If you change this, add an #ifndef for GMX_DISABLE_FFTW_MEASURE around it! */
- fftw_flags = FFTW_ESTIMATE;
-
- if(pfft==NULL)
- {
- gmx_fatal(FARGS,"Invalid opaque FFT datatype pointer.");
- return EINVAL;
- }
- *pfft = NULL;
-
- if( (fft = (gmx_fft_t)malloc(sizeof(struct gmx_fft))) == NULL)
- {
- return ENOMEM;
- }
-
- fft->single[0][0] = NULL;
- fft->single[0][1] = NULL;
- fft->single[1][0] = NULL;
- fft->single[1][1] = NULL;
-
-
- fft->multi[0][0] = rfftw3d_create_plan(nx,ny,nz,FFTW_COMPLEX_TO_REAL,FFTW_OUT_OF_PLACE|fftw_flags);
- fft->multi[0][1] = rfftw3d_create_plan(nx,ny,nz,FFTW_REAL_TO_COMPLEX,FFTW_OUT_OF_PLACE|fftw_flags);
- fft->multi[1][0] = rfftw3d_create_plan(nx,ny,nz,FFTW_COMPLEX_TO_REAL,FFTW_IN_PLACE|fftw_flags);
- fft->multi[1][1] = rfftw3d_create_plan(nx,ny,nz,FFTW_REAL_TO_COMPLEX,FFTW_IN_PLACE|fftw_flags);
-
-
- for(i=0;i<2;i++)
- {
- for(j=0;j<2;j++)
- {
- if(fft->multi[i][j] == NULL)
- {
- gmx_fatal(FARGS,"Error initializing FFTW2 plan.");
- gmx_fft_destroy(fft);
- return -1;
- }
- }
- }
-
- /* FFTW2 overwrites the input when doing out-of-place complex-to-real FFTs.
- * This is not acceptable for the Gromacs interface, so we define a
- * work array and copy the data there before doing complex-to-real FFTs.
- */
- fft->work = (real *)malloc(sizeof(real)*( nx*ny*(nz/2 + 1)*2) );
- if(fft->work == NULL)
- {
- gmx_fatal(FARGS,"Cannot allocate complex-to-real FFT workspace.");
- gmx_fft_destroy(fft);
- return ENOMEM;
- }
-
- fft->ndim = 3;
- fft->nx = nx;
- fft->ny = ny;
- fft->nz = nz;
-
- *pfft = fft;
- return 0;
-}
-
-
-int
-gmx_fft_1d(gmx_fft_t fft,
- enum gmx_fft_direction dir,
- void * in_data,
- void * out_data)
-{
- int inplace = (in_data == out_data);
- int isforward = (dir == GMX_FFT_FORWARD);
-
- if((fft->ndim != 1) ||
- ((dir != GMX_FFT_FORWARD) && (dir != GMX_FFT_BACKWARD)))
- {
- gmx_fatal(FARGS,"FFT plan mismatch - bad plan or direction.");
- return EINVAL;
- }
-
- fftw_one(fft->single[inplace][isforward],(fftw_complex *)in_data,(fftw_complex *)out_data);
-
- return 0;
-}
-
-int
-gmx_fft_1d_real(gmx_fft_t fft,
- enum gmx_fft_direction dir,
- void * in_data,
- void * out_data)
-{
- /* FFTW2 1-dimensional real transforms are special.
- *
- * First, the complex data is stored in a special packed half-complex
- * fashion. To enable a standard common Gromacs interface this forces us
- * to always use out-of-place FFTs, and permute the data after
- * real-to-complex FFTs or before complex-to-real FFTs.
- *
- * The input is also destroyed for out-of-place complex-to-real FFTs, but
- * this doesn't matter since we need to permute and copy the data into
- * the work array first anyway.
- */
- real * work = fft->work;
- t_complex * data;
- int n = fft->nx;
- int i;
-
- if((fft->ndim != 1) ||
- ((dir != GMX_FFT_REAL_TO_COMPLEX) && (dir != GMX_FFT_COMPLEX_TO_REAL)))
- {
- gmx_fatal(FARGS,"FFT plan mismatch - bad plan or direction.");
- return EINVAL;
- }
-
- if(dir==GMX_FFT_REAL_TO_COMPLEX)
- {
- rfftw_one(fft->single[0][1],(fftw_real *)in_data,(fftw_real *)work);
- /* permute it back into data, in standard complex format
- * instead of halfcomplex...
- */
- data = (t_complex *)out_data;
-
- data[0].re = work[0];
- data[0].im = 0;
-
- for(i=1;i<n/2;i++)
- {
- data[i].re = work[i];
- data[i].im = work[n-i];
- }
-
- data[i].re=work[i];
-
- if(2*i==n)
- {
- data[i].im=0;
- }
- else
- {
- data[i].im=work[n-i];
- }
- }
- else
- {
- /* Complex-to-real. First permute standard format into halfcomplex */
- data = (t_complex *)in_data;
-
- work[0]=data[0].re;
-
- for(i=1;i<n/2;i++)
- {
- work[i] =data[i].re;
- work[n-i]=data[i].im;
- }
-
- if(2*i!=n)
- {
- work[n-i]=data[i].im;
- }
-
- rfftw_one(fft->single[0][0],(fftw_real *)work,(fftw_real *)out_data);
- }
-
- return 0;
-}
-
-
-int
-gmx_fft_2d(gmx_fft_t fft,
- enum gmx_fft_direction dir,
- void * in_data,
- void * out_data)
-{
- int inplace = (in_data == out_data);
- int isforward = (dir == GMX_FFT_FORWARD);
-
- if((fft->ndim != 2) ||
- ((dir != GMX_FFT_FORWARD) && (dir != GMX_FFT_BACKWARD)))
- {
- gmx_fatal(FARGS,"FFT plan mismatch - bad plan or direction.");
- return EINVAL;
- }
-
- fftwnd_one(fft->multi[inplace][isforward],(fftw_complex *)in_data,(fftw_complex *)out_data);
-
- return 0;
-}
-
-
-int
-gmx_fft_2d_real(gmx_fft_t fft,
- enum gmx_fft_direction dir,
- void * in_data,
- void * out_data)
-{
- int inplace = (in_data == out_data);
- int isforward = (dir == GMX_FFT_REAL_TO_COMPLEX);
- int sz;
-
- if((fft->ndim != 2) ||
- ((dir != GMX_FFT_REAL_TO_COMPLEX) && (dir != GMX_FFT_COMPLEX_TO_REAL)))
- {
- gmx_fatal(FARGS,"FFT plan mismatch - bad plan or direction.");
- return EINVAL;
- }
-
- if(inplace == 0)
- {
- /* Copy data to avoid overwriting input, and redirect input ptr to work array */
- sz = fft->nx*(fft->ny/2 + 1)*2;
- memcpy(fft->work,in_data,sz*sizeof(real));
- in_data = fft->work;
- }
-
- if(isforward)
- {
- rfftwnd_one_real_to_complex(fft->multi[inplace][isforward],(fftw_real *)in_data,(fftw_complex *)out_data);
- }
- else
- {
- rfftwnd_one_complex_to_real(fft->multi[inplace][isforward],(fftw_complex *)in_data,(fftw_real *)out_data);
- }
-
- return 0;
-}
-
-
-int
-gmx_fft_3d(gmx_fft_t fft,
- enum gmx_fft_direction dir,
- void * in_data,
- void * out_data)
-{
- int inplace = (in_data == out_data);
- int isforward = (dir == GMX_FFT_FORWARD);
-
- if((fft->ndim != 3) ||
- ((dir != GMX_FFT_FORWARD) && (dir != GMX_FFT_BACKWARD)))
- {
- gmx_fatal(FARGS,"FFT plan mismatch - bad plan or direction.");
- return EINVAL;
- }
-
- fftwnd_one(fft->multi[inplace][isforward],(fftw_complex *)in_data,(fftw_complex *)out_data);
-
- return 0;
-}
-
-
-int
-gmx_fft_3d_real(gmx_fft_t fft,
- enum gmx_fft_direction dir,
- void * in_data,
- void * out_data)
-{
- int inplace = (in_data == out_data);
- int isforward = (dir == GMX_FFT_REAL_TO_COMPLEX);
- int sz;
-
- if((fft->ndim != 3) ||
- ((dir != GMX_FFT_REAL_TO_COMPLEX) && (dir != GMX_FFT_COMPLEX_TO_REAL)))
- {
- gmx_fatal(FARGS,"FFT plan mismatch - bad plan or direction.");
- return EINVAL;
- }
-
- if(inplace == 0)
- {
- /* Copy data to avoid overwriting input, and redirect input ptr to work array */
- sz = fft->nx*fft->ny*(fft->nz/2 + 1)*2;
- memcpy(fft->work,in_data,sz*sizeof(real));
- in_data = fft->work;
- }
-
- if(isforward)
- {
- rfftwnd_one_real_to_complex(fft->multi[inplace][isforward],(fftw_real *)in_data,(fftw_complex *)out_data);
- }
- else
- {
- rfftwnd_one_complex_to_real(fft->multi[inplace][isforward],(fftw_complex *)in_data,(fftw_real *)out_data);
- }
-
- return 0;
-}
-
-
-
-
-void
-gmx_fft_destroy(gmx_fft_t fft)
-{
- int i,j;
-
- if(fft != NULL)
- {
- for(i=0;i<2;i++)
- {
- for(j=0;j<2;j++)
- {
- if(fft->single[i][j] != NULL)
- {
- rfftw_destroy_plan(fft->single[i][j]);
- fft->single[i][j] = NULL;
- }
- if(fft->multi[i][j] != NULL)
- {
- rfftwnd_destroy_plan(fft->multi[i][j]);
- fft->multi[i][j] = NULL;
- }
- }
- }
- free(fft);
- }
-}
-
-
-#else
-int
-gmx_fft_fftw2_empty;
-#endif /* GMX_FFT_FFTW2 */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* none of the fftw3 calls, except execute(), are thread-safe, so
we need to serialize them with this mutex. */
static tMPI_Thread_mutex_t big_fftw_mutex=TMPI_THREAD_MUTEX_INITIALIZER;
static gmx_bool gmx_fft_threads_initialized=FALSE;
-#define FFTW_LOCK tMPI_Thread_mutex_lock(&big_fftw_mutex);
-#define FFTW_UNLOCK tMPI_Thread_mutex_unlock(&big_fftw_mutex);
-#else /* GMX_THREADS */
+#define FFTW_LOCK tMPI_Thread_mutex_lock(&big_fftw_mutex)
+#define FFTW_UNLOCK tMPI_Thread_mutex_unlock(&big_fftw_mutex)
+#else /* GMX_THREAD_MPI */
#define FFTW_LOCK
#define FFTW_UNLOCK
-#endif /* GMX_THREADS */
+#endif /* GMX_THREAD_MPI */
/* We assume here that aligned memory starts at multiple of 16 bytes and unaligned memory starts at multiple of 8 bytes. The later is guranteed for all malloc implementation.
Consequesences:
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
fft5d_plan p1,p2;
};
-
-static int *copy_int_array(int n,int *src)
-{
- int *dest,i;
-
- dest = (int*)malloc(n*sizeof(int));
- for(i=0; i<n; i++)
- dest[i] = src[i];
-
- return dest;
-}
-
-static int *make_slab2grid(int nnodes,int ngrid)
-{
- int *s2g,i;
-
- s2g = (int*)malloc((nnodes+1)*sizeof(int));
- for(i=0; i<nnodes+1; i++) {
- /* We always round up */
- s2g[i] = (i*ngrid + nnodes - 1)/nnodes;
- }
-
- return s2g;
-}
-
int
gmx_parallel_3dfft_init (gmx_parallel_3dfft_t * pfft_setup,
ivec ndata,
MPI_Comm comm[2],
int * slab2index_major,
int * slab2index_minor,
- gmx_bool bReproducible)
+ gmx_bool bReproducible,
+ int nthreads)
{
int rN=ndata[2],M=ndata[1],K=ndata[0];
int flags = FFT5D_REALCOMPLEX | FFT5D_ORDER_YZ; /* FFT5D_DEBUG */
MPI_Comm rcomm[]={comm[1],comm[0]};
int Nb,Mb,Kb; /* dimension for backtransform (in starting order) */
+ t_complex *buf1, *buf2; /*intermediate buffers - used internally.*/
snew(*pfft_setup,1);
if (bReproducible) flags |= FFT5D_NOMEASURE;
Nb=K;Mb=rN;Kb=M; /* currently always true because ORDER_YZ always set */
}
- (*pfft_setup)->p1 = fft5d_plan_3d(rN,M,K,rcomm, flags, (t_complex**)real_data, complex_data);
+ (*pfft_setup)->p1 = fft5d_plan_3d(rN,M,K,rcomm, flags, (t_complex**)real_data, complex_data, &buf1, &buf2, nthreads);
(*pfft_setup)->p2 = fft5d_plan_3d(Nb,Mb,Kb,rcomm,
- (flags|FFT5D_BACKWARD|FFT5D_NOMALLOC)^FFT5D_ORDER_YZ, complex_data, (t_complex**)real_data);
+ (flags|FFT5D_BACKWARD|FFT5D_NOMALLOC)^FFT5D_ORDER_YZ, complex_data, (t_complex**)real_data, &buf1, &buf2, nthreads);
return (*pfft_setup)->p1 != 0 && (*pfft_setup)->p2 !=0;
}
gmx_parallel_3dfft_execute(gmx_parallel_3dfft_t pfft_setup,
enum gmx_fft_direction dir,
void * in_data,
- void * out_data) {
- if ((!(pfft_setup->p1->flags&FFT5D_REALCOMPLEX)) ^ (dir==GMX_FFT_FORWARD ||dir==GMX_FFT_BACKWARD)) {
+ void * out_data,
+ int thread,
+ gmx_wallcycle_t wcycle) {
+ if ((!(pfft_setup->p1->flags&FFT5D_REALCOMPLEX)) ^ (dir==GMX_FFT_FORWARD ||dir==GMX_FFT_BACKWARD))
+ {
gmx_fatal(FARGS,"Invalid transform. Plan and execution don't match regarding reel/complex");
}
if (dir==GMX_FFT_FORWARD || dir==GMX_FFT_REAL_TO_COMPLEX) {
- fft5d_execute(pfft_setup->p1,0);
+ fft5d_execute(pfft_setup->p1,thread,wcycle);
} else {
- fft5d_execute(pfft_setup->p2,0);
+ fft5d_execute(pfft_setup->p2,thread,wcycle);
}
return 0;
}
+++ /dev/null
-#ifndef _GMX_QHOP_DB_H
-#define _GMX_QHOP_DB_H
-
-typedef struct{
- real alpha, beta, gamma;
- real k_1, k_2, k_3, m_1, m_2, m_3;
- real s_A, t_A, v_A, s_B, s_C, t_C, v_C;
- real f, g, h;
- real p_1, q_1, q_2, q_3, r_1, r_2, r_3;
-} t_qhop_parameters;
-
-typedef struct gmx_qhop_db_t *gmx_qhop_db;
-
-/* Return database if successful, or NULL on failure */
-extern gmx_qhop_db gmx_qhop_db_read(char *forcefield);
-
-/* Write the database to a filename. Return 1 on success, or 0 for
- failure */
-extern int gmx_qhop_db_write(char *fn,gmx_qhop_db qdb);
-
-/* Destroy the internal datastructures to free memory. Return 1 on
- success, 0 for failure */
-extern int gmx_qhop_db_done(gmx_qhop_db qdb);
-
-/* Return the number of states in the database for a given residue
- name: e.g. 1 for alanine, 2 for lysine, 4 for histidine. Returns
- NOTSET when the residue is not present in the database. */
-extern int gmx_qhop_db_get_nstates(gmx_qhop_db qdb,char *resname);
-
-/* Return the net charge for a given state for a given
- residue. Returns NOTSET when the residue is not in the database, or
- when the state is invalid for the residue. */
-extern int gmx_qhop_db_get_qstate(gmx_qhop_db qdb,char *resname,int state);
-
-/* Return a NULL-terminated list of atomnames of the donors in the
- residue for the indicated state. If NULL there are no donors in the
- residue. This assumes atomnames are unique, which is true for
- proteins and nucleic acids at least. */
-extern char **gmx_qhop_db_get_donors(gmx_qhop_db qdb,char *resname,int state);
-
-/* Return a NULL-terminated list of atomnames of the acceptors in the
- residue for the indicated state. If NULL there are no acceptors in
- the residue. This assumes atomnames are unique, which is true for
- proteins and nucleic acids at least. */
-extern char **gmx_qhop_db_get_acceptors(gmx_qhop_db qdb,char *resname,int state);
-
-/* Fills the array q (length natoms) with the charges corresponding to
- residue name and state. Return 1 on success, NOTSET if the resname
- is not found or the state is incorrect. */
-extern int gmx_qhop_db_set_charges(gmx_qhop_db qdb,char *resname,int state,
- int natoms,real q[]);
-
-/* Fill the qhop_parameters for a given donor/acceptor pair. Returns 1
- if OK or 0 if either donor or acceptor does not exist. */
-extern int gmx_qhop_db_get_parameters(gmx_qhop_db qdb,
- char *donor,char *acceptor,
- t_qhop_parameters *qp);
-
-#endif
+++ /dev/null
-/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 4.5
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2008, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Groningen Machine for Chemical Simulation
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include "gmx_fatal.h"
-#include "macros.h"
-#include "gmx_qhop_db.h"
-
-int main(int argc,char *argv[])
-{
- gmx_qhop_db db;
- char *donors[] = { "H3O+", "ACE" };
- char *acceptors[] = { "H2O", "GLU" };
- t_qhop_parameters qp;
- int i,j;
-
- if ((db = gmx_qhop_db_read("ffoplsaa")) == NULL)
- gmx_fatal(FARGS,"Can not read qhop database information");
- if (gmx_qhop_db_write("koe.dat",db) != 1)
- gmx_fatal(FARGS,"Can not write qhop database information");
-
- for(i=0; (i<asize(donors)); i++) {
- for(j=0; (j<asize(acceptors)); j++) {
- if (gmx_qhop_db_get_parameters(db,donors[i],acceptors[j],&qp) == 1) {
- printf("Found qhop parameters for donor %s and acceptor %s\n",
- donors[i],acceptors[j]);
- }
- else {
- printf("Could not find qhop parameters for donor %s and acceptor %s\n",
- donors[i],acceptors[j]);
- }
- }
- }
-
- if (gmx_qhop_db_done(db) != 1)
- gmx_fatal(FARGS,"Error destroying qhop data");
-
- return 0;
-}
+++ /dev/null
-/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 4.5
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2008, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Groningen Machine for Chemical Simulation
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include "smalloc.h"
-#include "string2.h"
-
-#include "gmx_qhop_parm.h"
-
-typedef struct gmx_qhop {
- char *donor,*acceptor;
- int nparam,nparam_c;
- char **value,**unit,**name;
-} gmx_qhop;
-
-#define assign_str(dst,src) if (NULL != src) { if (NULL != dst) *dst = strdup(src); } else { *dst = NULL; }
-#define assign_scal(dst,src) if (NULL != dst) *dst = src
-
-/* Return a new gmx_qhop structure */
-gmx_qhop_t gmx_qhop_init()
-{
- struct gmx_qhop *qht;
-
- snew(qht,1);
-
- return qht;
-}
-
-void gmx_qhop_set_donor(gmx_qhop_t gqh,char *donor)
-{
- gqh->donor = strdup(donor);
-}
-
-void gmx_qhop_set_acceptor(gmx_qhop_t gqh,char *acceptor)
-{
- gqh->acceptor = strdup(acceptor);
-}
-
-char *gmx_qhop_get_donor(gmx_qhop_t gqh)
-{
- return gqh->donor;
-}
-
-char *gmx_qhop_get_acceptor(gmx_qhop_t gqh)
-{
- return gqh->acceptor;
-}
-
-/* Add parameter to gqh, return 1 if OK, 0 if not OK */
-int gmx_qhop_add_param(gmx_qhop_t gqh,char *name,char *value,char *unit)
-{
- srenew(gqh->name,gqh->nparam+1);
- srenew(gqh->value,gqh->nparam+1);
- srenew(gqh->unit,gqh->nparam+1);
- gqh->name[gqh->nparam] = strdup(name);
- gqh->value[gqh->nparam] = strdup(value);
- gqh->unit[gqh->nparam] = strdup(unit);
- gqh->nparam++;
-
- return 1;
-}
-
-/* Lists the parameters, one by one on repeatedly calling the
- function. Returns 1 if OK, 0 if not OK */
-int gmx_qhop_get_param(gmx_qhop_t gqh,char **name,char **value,char **unit)
-{
- if (gqh->nparam_c < gqh->nparam) {
- assign_str(name,gqh->name[gqh->nparam_c]);
- assign_str(value,gqh->value[gqh->nparam_c]);
- assign_str(unit,gqh->unit[gqh->nparam_c]);
- gqh->nparam_c++;
-
- return 1;
- }
- else
- gqh->nparam_c = 0;
-
- return 0;
-}
-
-/* Return a value corresponding to name */
-int gmx_qhop_get_value(gmx_qhop_t gqh,char *name,double *x)
-{
- int i;
-
- for(i=0; (i<gqh->nparam); i++)
- if (gmx_strcasecmp(gqh->name[i],name) == 0) {
- *x = strtod(gqh->value[i],NULL);
- return 1;
- }
-
- return 0;
-}
-
-/* Liberate memory */
-void gmx_qhop_done(gmx_qhop_t gqh)
-{
- int i;
-
- for(i=0; (i<gqh->nparam); i++) {
- sfree(gqh->name[i]);
- sfree(gqh->value[i]);
- sfree(gqh->unit[i]);
- }
- if (gqh->nparam > 0) {
- sfree(gqh->name);
- sfree(gqh->value);
- sfree(gqh->unit);
- }
- if (gqh->donor)
- sfree(gqh->donor);
- if (gqh->acceptor)
- sfree(gqh->acceptor);
-}
-
+++ /dev/null
-#ifndef _GMX_QHOP_PARM_H
-#define _GMX_QHOP_PARM_H
-
-typedef struct gmx_qhop *gmx_qhop_t;
-
-/* Return a new gmx_qhop structure */
-extern gmx_qhop_t gmx_qhop_init();
-
-/* These function get and set the obvious */
-extern void gmx_qhop_set_donor(gmx_qhop_t gqh,char *donor);
-
-extern void gmx_qhop_set_acceptor(gmx_qhop_t gqh,char *acceptor);
-
-extern char *gmx_qhop_get_donor(gmx_qhop_t gqh);
-
-extern char *gmx_qhop_get_acceptor(gmx_qhop_t gqh);
-
-/* Add parameter to gqh, return 1 if OK, 0 if not OK */
-extern int gmx_qhop_add_param(gmx_qhop_t gqh,char *name,char *value,char *unit);
-
-/* Lists the parameters, one by one on repeatedly calling the
- function. Returns 1 if OK, 0 if not OK */
-extern int gmx_qhop_get_param(gmx_qhop_t gqh,char **name,char **value,char **unit);
-
-/* Return a value corresponding to name in *x. Return 1 of OK, 0 if
- not OK */
-extern int gmx_qhop_get_value(gmx_qhop_t gqh,char *name,double *x);
-
-/* Liberate memory */
-extern void gmx_qhop_done(gmx_qhop_t gqh);
-
-#endif
+++ /dev/null
-/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 4.5
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2008, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Groningen Machine for Chemical Simulation
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include <string.h>
-#include "gmx_fatal.h"
-#include "smalloc.h"
-#include "macros.h"
-#include "futil.h"
-#include "gmx_qhop_parm.h"
-
-#ifdef HAVE_LIBXML2
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-
-extern int xmlDoValidityCheckingDefaultValue;
-
-#define NN(x) (NULL != (x))
-
-static const char *xmltypes[] = {
- NULL,
- "XML_ELEMENT_NODE",
- "XML_ATTRIBUTE_NODE",
- "XML_TEXT_NODE",
- "XML_CDATA_SECTION_NODE",
- "XML_ENTITY_REF_NODE",
- "XML_ENTITY_NODE",
- "XML_PI_NODE",
- "XML_COMMENT_NODE",
- "XML_DOCUMENT_NODE",
- "XML_DOCUMENT_TYPE_NODE",
- "XML_DOCUMENT_FRAG_NODE",
- "XML_NOTATION_NODE",
- "XML_HTML_DOCUMENT_NODE",
- "XML_DTD_NODE",
- "XML_ELEMENT_DECL",
- "XML_ATTRIBUTE_DECL",
- "XML_ENTITY_DECL",
- "XML_NAMESPACE_DECL",
- "XML_XINCLUDE_START",
- "XML_XINCLUDE_END"
-};
-#define NXMLTYPES asize(xmltypes)
-
-enum {
- exmlQHOPS,
- exmlQHOP, exmlDONOR, exmlACCEPTOR,
- exmlPARAM, exmlNAME, exmlVALUE,
- exmlUNIT,
- exmlNR
-};
-
-static const char *exml_names[exmlNR] = {
- "qhops",
- "qhop", "donor", "acceptor", "parameter",
- "name", "value", "unit"
-};
-
-typedef struct {
- int nqh;
- gmx_qhop_t *gqh;
-} t_xmlrec;
-
-static int find_elem(char *name,int nr,const char *names[])
-{
- int i;
-
- for(i=0; (i<nr); i++)
- if (strcmp(name,names[i]) == 0)
- break;
- if (i == nr)
- gmx_fatal(FARGS,"Unknown element name %s",name);
-
- return i;
-}
-
-void add_xml_int(xmlNodePtr ptr,const char *name,int val)
-{
- xmlChar buf[32];
-
- sprintf((char *)buf,"%d",val);
- if (xmlSetProp(ptr,(xmlChar *)name,buf) == 0)
- gmx_fatal(FARGS,"Setting",(char *)name);
-}
-
-void add_xml_double(xmlNodePtr ptr,const char *name,double val)
-{
- xmlChar buf[32];
-
- sprintf((char *)buf,"%g",val);
- if (xmlSetProp(ptr,(xmlChar *)name,buf) == 0)
- gmx_fatal(FARGS,"Setting",(char *)name);
-}
-
-void add_xml_char(xmlNodePtr ptr,const char *name,char *val)
-{
- if (xmlSetProp(ptr,(xmlChar *)name,(xmlChar *)val) == 0)
- gmx_fatal(FARGS,"Setting",(char *)name);
-}
-
-xmlNodePtr add_xml_child(xmlNodePtr parent,const char *type)
-{
- xmlNodePtr child;
-
- if ((child = xmlNewChild(parent,NULL,(xmlChar *)type,NULL)) == NULL)
- gmx_fatal(FARGS,"Creating element",(char *)type);
-
- return child;
-}
-
-xmlNodePtr add_xml_comment(xmlDocPtr doc,
- xmlNodePtr prev,char *comment)
-{
- xmlNodePtr comm,ptr;
-
- if ((comm = xmlNewComment((xmlChar *)comment)) == NULL)
- gmx_fatal(FARGS,"Creating doc comment element","");
- ptr = prev;
- while (ptr->next != NULL)
- ptr=ptr->next;
- ptr->next = comm;
- comm->prev = ptr;
- comm->doc = doc;
-
- return comm;
-}
-
-static char *sp(int n, char buf[], int maxindent)
-{
- int i;
- if(n>=maxindent)
- n=maxindent-1;
-
- /* Don't indent more than maxindent characters */
- for(i=0; (i<n); i++)
- buf[i] = ' ';
- buf[i] = '\0';
-
- return buf;
-}
-
-static void qhop_process_attr(FILE *fp,xmlAttrPtr attr,int parent,
- int elem,int indent,gmx_qhop_t qht)
-{
- char *attrname,*attrval;
- char buf[100];
- int i,kkk,eprop;
- char *xbuf[exmlNR];
-
- for(i=0; (i<exmlNR); i++)
- xbuf[i] = NULL;
- while (attr != NULL) {
- attrname = (char *)attr->name;
- attrval = (char *)attr->children->content;
-
-#define atest(s) ((gmx_strcasecmp(attrname,s) == 0) && (attrval != NULL))
- kkk = find_elem(attrname,exmlNR,exml_names);
- if (attrval != NULL)
- xbuf[kkk] = strdup(attrval);
-
- if (fp)
- fprintf(fp,"%sProperty: '%s' Value: '%s'\n",sp(indent,buf,99),
- attrname,attrval);
- attr = attr->next;
-#undef atest
- }
-
- switch (elem) {
- case exmlQHOP:
- if (NN(xbuf[exmlDONOR]) && NN(xbuf[exmlACCEPTOR])) {
- gmx_qhop_set_donor(qht,xbuf[exmlDONOR]);
- gmx_qhop_set_acceptor(qht,xbuf[exmlACCEPTOR]);
- }
- break;
- case exmlPARAM:
- if (NN(xbuf[exmlNAME]) && NN(xbuf[exmlUNIT]) && NN(xbuf[exmlVALUE])) {
- gmx_qhop_add_param(qht,xbuf[exmlNAME],xbuf[exmlVALUE],
- xbuf[exmlUNIT]);
- }
- break;
- default:
- break;
- }
- for(i=0; (i<exmlNR); i++)
- if (NN(xbuf[i]))
- sfree(xbuf[i]);
-}
-
-static void qhop_process_element(FILE *fp,xmlNodePtr tree,int parent,
- int indent,t_xmlrec *xml)
-{
- int elem;
- char buf[100];
-
- elem = find_elem((char *)tree->name,exmlNR,exml_names);
- if (fp)
- fprintf(fp,"%sElement node name %s\n",sp(indent,buf,99),
- (char *)tree->name);
- if (elem == exmlQHOP) {
- xml->nqh++;
- srenew(xml->gqh,xml->nqh);
- xml->gqh[xml->nqh-1] = gmx_qhop_init();
- }
- if (elem != exmlQHOPS)
- qhop_process_attr(fp,tree->properties,parent,
- elem,indent+2,xml->gqh[xml->nqh-1]);
-}
-
-static void qhop_process_tree(FILE *fp,xmlNodePtr tree,int parent,
- int indent,t_xmlrec *xml)
-{
- char buf[100];
- int elem;
-
- while (tree != NULL) {
- if (fp) {
- if ((tree->type > 0) && (tree->type < NXMLTYPES))
- fprintf(fp,"Node type %s encountered with name %s\n",
- xmltypes[tree->type],(char *)tree->name);
- else
- fprintf(fp,"Node type %d encountered\n",tree->type);
- }
-
- switch (tree->type) {
- case XML_ELEMENT_NODE:
- qhop_process_element(fp,tree,parent,indent+2,xml);
-
- if (tree->children) {
- elem = find_elem((char *)tree->name,exmlNR,exml_names);
- qhop_process_tree(fp,tree->children,elem,indent+2,xml);
- }
- break;
- default:
- break;
- }
- tree = tree->next;
- }
-}
-
-gmx_qhop_t *
-gmx_qhops_read(char *fn,int *nqhop)
-{
- xmlDocPtr doc;
- int i,npd;
- t_xmlrec *xml;
- const char *db="qhops.dat";
- gmx_bool fna=FALSE;
-
- xmlDoValidityCheckingDefaultValue = 0;
- if (NULL == fn)
- {
- fn = (char *)gmxlibfn(db);
- fna=TRUE;
- }
- if ((doc = xmlParseFile(fn)) == NULL) {
- fprintf(stderr,"Reading XML file %s. Run a syntax checker such as nsgmls.",
- fn);
- exit(1);
- }
-
- snew(xml,1);
- qhop_process_tree(NULL,doc->children,0,0,xml);
-
- xmlFreeDoc(doc);
- if (fna)
- sfree(fn);
-
- *nqhop = xml->nqh;
-
- return xml->gqh;
-}
-
-static void add_xml_qhop(xmlNodePtr parent,gmx_qhop_t qht)
-{
- xmlNodePtr ptr,child,grandchild,comp;
- char *name,*type,*value,*unit;
-
- ptr = add_xml_child(parent,exml_names[exmlQHOP]);
- add_xml_char(ptr,exml_names[exmlDONOR],gmx_qhop_get_donor(qht));
- add_xml_char(ptr,exml_names[exmlACCEPTOR],gmx_qhop_get_acceptor(qht));
-
- while (gmx_qhop_get_param(qht,&name,&value,&unit) == 1) {
- child = add_xml_child(ptr,exml_names[exmlPARAM]);
- add_xml_char(child,exml_names[exmlNAME],name);
- add_xml_char(child,exml_names[exmlVALUE],value);
- add_xml_char(child,exml_names[exmlUNIT],unit);
- sfree(name);
- sfree(value);
- sfree(unit);
- }
-}
-
-void gmx_qhops_write(char *fn,int nqhop,gmx_qhop_t qht[])
-{
- xmlDocPtr doc;
- xmlDtdPtr dtd;
- xmlNodePtr myroot;
- int i,nmt;
- xmlChar *libdtdname,*dtdname,*gmx;
-
- gmx = (xmlChar *) "qhops";
- dtdname = (xmlChar *) "qhops.dtd";
- libdtdname = dtdname;
-
- if ((doc = xmlNewDoc((xmlChar *)"1.0")) == NULL)
- gmx_fatal(FARGS,"Creating XML document","");
-
- if ((dtd = xmlCreateIntSubset(doc,dtdname,libdtdname,dtdname)) == NULL)
- gmx_fatal(FARGS,"Creating XML DTD","");
-
- if ((myroot = xmlNewDocNode(doc,NULL,gmx,NULL)) == NULL)
- gmx_fatal(FARGS,"Creating root element","");
- dtd->next = myroot;
- myroot->prev = (xmlNodePtr) dtd;
-
- /* Add molecule definitions */
- for(i=0; (i<nqhop); i++)
- add_xml_qhop(myroot,qht[i]);
-
- xmlSetDocCompressMode(doc,0);
- xmlIndentTreeOutput = 1;
- if (xmlSaveFormatFileEnc(fn,doc,"ISO-8859-1",2) == 0)
- gmx_fatal(FARGS,"Saving file",fn);
- xmlFreeDoc(doc);
-}
-
-
-
-#else
-
-gmx_qhop_t gmx_qhops_read(char *fn,int *nqhop)
-{
- gmx_fatal(FARGS,"You need to configure the software with --with-xml for function gmx_qhops_read to work");
- return NULL;
-}
-
-void gmx_qhops_write(char *fn,int nqhop,gmx_qhop_t qht)
-{
- gmx_fatal(FARGS,"You need to configure the software with --with-xml for function gmx_qhops_write to work");
-}
-
-#endif
+++ /dev/null
-#ifndef _GMX_QHOP_XML_H
-#define _GMX_QHOP_XML_H
-
-#include "gmx_qhop_parm.h"
-
-extern gmx_qhop_t *gmx_qhops_read(char *fn,int *nqhop);
-
-extern void gmx_qhops_write(char *fn,int nqhop,gmx_qhop_t qht);
-
-#endif
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
#ifdef GMX_MPI
MPI_Comm mpi_comm_mygroup;
#endif
+ int omp_nthreads;
} gmx_wallcycle_t_t;
/* Each name should not exceed 19 characters */
static const char *wcn[ewcNR] =
-{ "Run", "Step", "PP during PME", "Domain decomp.", "DD comm. load", "DD comm. bounds", "Vsite constr.", "Send X to PME", "Comm. coord.", "Neighbor search", "Born radii", "Force", "Wait + Comm. F", "PME mesh", "PME redist. X/F", "PME spread/gather", "PME 3D-FFT", "PME solve", "Wait + Comm. X/F", "Wait + Recv. PME F", "Vsite spread", "Write traj.", "Update", "Constraints", "Comm. energies", "Test" };
+{ "Run", "Step", "PP during PME", "Domain decomp.", "DD comm. load", "DD comm. bounds", "Vsite constr.", "Send X to PME", "Comm. coord.", "Neighbor search", "Born radii", "Force", "Wait + Comm. F", "PME mesh", "PME redist. X/F", "PME spread/gather", "PME 3D-FFT", "PME 3D-FFT Comm.", "PME solve", "Wait + Comm. X/F", "Wait + Recv. PME F", "Vsite spread", "Write traj.", "Update", "Constraints", "Comm. energies", "Enforced rotation", "Add rot. forces", "Test" };
gmx_bool wallcycle_have_counter(void)
{
return gmx_cycles_have_counter();
}
-gmx_wallcycle_t wallcycle_init(FILE *fplog,int resetstep,t_commrec *cr)
+gmx_wallcycle_t wallcycle_init(FILE *fplog,int resetstep,t_commrec *cr, int omp_nthreads)
{
gmx_wallcycle_t wc;
wc->wc_depth = 0;
wc->ewc_prev = -1;
wc->reset_counters = resetstep;
+ wc->omp_nthreads = omp_nthreads;
#ifdef GMX_MPI
if (PAR(cr) && getenv("GMX_CYCLE_BARRIER") != NULL)
snew(wc->wcc,ewcNR);
if (getenv("GMX_CYCLE_ALL") != NULL)
{
-/*#ifndef GMX_THREADS*/
+/*#ifndef GMX_THREAD_MPI*/
if (fplog)
{
fprintf(fplog,"\nWill time all the code during the run\n\n");
return wc;
}
-void wallcycle_destroy(gmx_wallcycle_t wc)
-{
- if (wc == NULL)
- {
- return;
- }
-
- if (wc->wcc != NULL)
- {
- sfree(wc->wcc);
- }
- if (wc->wcc_all != NULL)
- {
- sfree(wc->wcc_all);
- }
- sfree(wc);
-}
-
static void wallcycle_all_start(gmx_wallcycle_t wc,int ewc,gmx_cycles_t cycle)
{
wc->ewc_prev = ewc;
}
}
+static gmx_bool pme_subdivision(int ewc)
+{
+ return (ewc >= ewcPME_REDISTXF && ewc <= ewcPME_SOLVE);
+}
+
void wallcycle_sum(t_commrec *cr, gmx_wallcycle_t wc,double cycles[])
{
wallcc_t *wcc;
wcc = wc->wcc;
+ if (wc->omp_nthreads>1)
+ {
+ for(i=0; i<ewcNR; i++)
+ {
+ if (pme_subdivision(i) || i==ewcPMEMESH || (i==ewcRUN && cr->duty == DUTY_PME))
+ {
+ wcc[i].c *= wc->omp_nthreads;
+ }
+ }
+ }
+
if (wcc[ewcDDCOMMLOAD].n > 0)
{
wcc[ewcDOMDEC].c -= wcc[ewcDDCOMMLOAD].c;
{
wcc[ewcDOMDEC].c -= wcc[ewcDDCOMMBOUND].c;
}
+ if (wcc[ewcPME_FFTCOMM].n > 0)
+ {
+ wcc[ewcPME_FFT].c -= wcc[ewcPME_FFTCOMM].c;
+ }
+
if (cr->npmenodes == 0)
{
/* All nodes do PME (or no PME at all) */
}
}
-static gmx_bool subdivision(int ewc)
-{
- return (ewc >= ewcPME_REDISTXF && ewc <= ewcPME_SOLVE);
-}
void wallcycle_print(FILE *fplog, int nnodes, int npme, double realtime,
gmx_wallcycle_t wc, double cycles[])
npme = nnodes;
}
tot = cycles[ewcRUN];
+ /* PME part has to be multiplied with number of threads */
+ if (npme == 0)
+ {
+ tot += cycles[ewcPMEMESH]*(wc->omp_nthreads-1);
+ }
/* Conversion factor from cycles to seconds */
if (tot > 0)
{
- c2t = nnodes*realtime/tot;
+ c2t = (npp+npme*wc->omp_nthreads)*realtime/tot;
}
else
{
sum = 0;
for(i=ewcPPDURINGPME+1; i<ewcNR; i++)
{
- if (!subdivision(i))
+ if (!pme_subdivision(i))
{
print_cycles(fplog,c2t,wcn[i],
(i==ewcPMEMESH || i==ewcPMEWAITCOMM) ? npme : npp,
fprintf(fplog,"%s\n",myline);
for(i=ewcPPDURINGPME+1; i<ewcNR; i++)
{
- if (subdivision(i))
+ if (pme_subdivision(i))
{
print_cycles(fplog,c2t,wcn[i],
(i>=ewcPMEMESH || i<=ewcPME_SOLVE) ? npme : npp,
#define NOT_FINISHED(l1,l2) \
printf("not finished yet: lines %d .. %d in %s\n",l1,l2,__FILE__)
-static char *int_title(const char *title,int nodeid,char buf[], int size)
-{
- sprintf(buf,"%s (%d)",title,nodeid);
-
- return buf;
-}
-
void set_state_entries(t_state *state,const t_inputrec *ir,int nnodes)
{
int nnhpres;
+++ /dev/null
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: libmd
-Description: Gromacs md lib
-URL: http://www.gromacs.org
-Version: @VERSION@
-Requires: libgmx@LIBSUFFIX@ @PKG_FFT@ @PKG_XML@
-Libs: -L${libdir} -lmd@LIBSUFFIX@ @PKG_FFT_LIBS@ @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ -lm
-Cflags: -I${includedir} @PTHREAD_CFLAGS@ @PKG_CFLAGS@
-
if (ir->bQMMM)
srenew(md->bQM,md->nalloc);
+ if (ir->bAdress)
+ srenew(md->wf,md->nalloc);
+ srenew(md->tf_table_index,md->nalloc);
+
+ md->purecg = FALSE;
+ md->pureex = FALSE;
}
for(i=0; (i<md->nr); i++) {
md->bQM[i] = FALSE;
}
}
+ /* Initialize AdResS weighting functions to adressw */
+ if (ir->bAdress){
+ md->wf[i] = 1.0;
+ /* if no tf table groups specified, use default table */
+ md->tf_table_index[i] = DEFAULT_TF_TABLE;
+ if (ir->adress->n_tf_grps > 0){
+ /* if tf table groups specified, tf is only applied to thoose energy groups*/
+ md->tf_table_index[i] = NO_TF_TABLE;
+ /* check wether atom is in one of the relevant energy groups and assign a table index */
+ for (g=0; g<ir->adress->n_tf_grps; g++){
+ if (md->cENER[i] == ir->adress->tf_table_index[g]){
+ md->tf_table_index[i] = g;
+ }
+ }
+ }
+ }
}
md->start = start;
snew(md,1);
+ md->bVir=TRUE;
+ md->bPress=TRUE;
+ md->bSurft=TRUE;
+ md->bMu=TRUE;
+
if (EI_DYNAMICS(ir->eI))
{
md->delta_t = ir->delta_t;
else if (i == F_CONNBONDS)
md->bEner[i] = FALSE;
else if (i == F_COM_PULL)
- md->bEner[i] = (ir->ePull == epullUMBRELLA || ir->ePull == epullCONST_F);
+ md->bEner[i] = (ir->ePull == epullUMBRELLA || ir->ePull == epullCONST_F || ir->bRot);
else if (i == F_ECONSERVED)
md->bEner[i] = ((ir->etc == etcNOSEHOOVER || ir->etc == etcVRESCALE) &&
(ir->epc == epcNO || ir->epc==epcMTTK));
md->bEner[F_TEMP] = TRUE;
#endif
+ /* for adress simulations, most energy terms are not meaningfull, and thus disabled*/
+ if (ir->bAdress && !debug) {
+ for (i = 0; i < F_NRE; i++) {
+ md->bEner[i] = FALSE;
+ if(i == F_EKIN){ md->bEner[i] = TRUE;}
+ if(i == F_TEMP){ md->bEner[i] = TRUE;}
+ }
+ md->bVir=FALSE;
+ md->bPress=FALSE;
+ md->bSurft=FALSE;
+ md->bMu=FALSE;
+ }
+
md->f_nre=0;
for(i=0; i<F_NRE; i++)
{
md->isvir = get_ebin_space(md->ebin,asize(sv_nm),sv_nm,unit_energy);
md->ifvir = get_ebin_space(md->ebin,asize(fv_nm),fv_nm,unit_energy);
}
- md->ivir = get_ebin_space(md->ebin,asize(vir_nm),vir_nm,unit_energy);
- md->ipres = get_ebin_space(md->ebin,asize(pres_nm),pres_nm,unit_pres_bar);
- md->isurft = get_ebin_space(md->ebin,asize(surft_nm),surft_nm,
+ if (md->bVir)
+ md->ivir = get_ebin_space(md->ebin,asize(vir_nm),vir_nm,unit_energy);
+ if (md->bPress)
+ md->ipres = get_ebin_space(md->ebin,asize(pres_nm),pres_nm,unit_pres_bar);
+ if (md->bSurft)
+ md->isurft = get_ebin_space(md->ebin,asize(surft_nm),surft_nm,
unit_surft_bar);
if (md->epc == epcPARRINELLORAHMAN || md->epc == epcMTTK)
{
md->ipc = get_ebin_space(md->ebin,md->bTricl ? 6 : 3,
boxvel_nm,unit_vel);
}
- md->imu = get_ebin_space(md->ebin,asize(mu_nm),mu_nm,unit_dipole_D);
+ if (md->bMu)
+ md->imu = get_ebin_space(md->ebin,asize(mu_nm),mu_nm,unit_dipole_D);
if (ir->cos_accel != 0)
{
md->ivcos = get_ebin_space(md->ebin,asize(vcos_nm),vcos_nm,unit_vel);
}
n=groups->grps[egcENER].nr;
- md->nEg=n;
- md->nE=(n*(n+1))/2;
+ /* for adress simulations, most energy terms are not meaningfull, and thus disabled*/
+ if (!ir->bAdress){
+ /*standard simulation*/
+ md->nEg=n;
+ md->nE=(n*(n+1))/2;
+ }
+ else if (!debug) {
+ /*AdResS simulation*/
+ md->nU=0;
+ md->nEg=0;
+ md->nE=0;
+ md->nEc=0;
+ md->isvir=FALSE;
+ }
snew(md->igrp,md->nE);
if (md->nE > 1)
{
add_ebin(md->ebin,md->isvir,9,svir[0],bSum);
add_ebin(md->ebin,md->ifvir,9,fvir[0],bSum);
}
- add_ebin(md->ebin,md->ivir,9,vir[0],bSum);
- add_ebin(md->ebin,md->ipres,9,pres[0],bSum);
- tmp = (pres[ZZ][ZZ]-(pres[XX][XX]+pres[YY][YY])*0.5)*box[ZZ][ZZ];
- add_ebin(md->ebin,md->isurft,1,&tmp,bSum);
+ if (md->bVir)
+ add_ebin(md->ebin,md->ivir,9,vir[0],bSum);
+ if (md->bPress)
+ add_ebin(md->ebin,md->ipres,9,pres[0],bSum);
+ if (md->bSurft){
+ tmp = (pres[ZZ][ZZ]-(pres[XX][XX]+pres[YY][YY])*0.5)*box[ZZ][ZZ];
+ add_ebin(md->ebin,md->isurft,1,&tmp,bSum);
+ }
if (md->epc == epcPARRINELLORAHMAN || md->epc == epcMTTK)
{
tmp6[0] = state->boxv[XX][XX];
tmp6[5] = state->boxv[ZZ][YY];
add_ebin(md->ebin,md->ipc,md->bTricl ? 6 : 3,tmp6,bSum);
}
- add_ebin(md->ebin,md->imu,3,mu_tot,bSum);
+ if(md->bMu)
+ add_ebin(md->ebin,md->imu,3,mu_tot,bSum);
if (ekind && ekind->cosacc.cos_accel != 0)
{
vol = box[XX][XX]*box[YY][YY]*box[ZZ][ZZ];
mde_delta_h_reset(dh);
}
-/* free the contents of the delta_h list */
-static void mde_delta_h_free(t_mde_delta_h *dh)
-{
- int i;
- for(i=0;i<dh->nhist;i++)
- {
- sfree(dh->bin[i]);
- }
-}
-
/* Add a value to the delta_h list */
static void mde_delta_h_add_dh(t_mde_delta_h *dh, double delta_h, double time)
{
}
}
-static void do_x_step(t_commrec *cr,int n,rvec *x1,real a,rvec *f,rvec *x2)
-
-{
- int start,end,i,m;
-
- if (DOMAINDECOMP(cr)) {
- start = 0;
- end = cr->dd->nat_home;
- } else if (PARTDECOMP(cr)) {
- pd_at_range(cr,&start,&end);
- } else {
- start = 0;
- end = n;
- }
-
- for(i=start; i<end; i++) {
- for(m=0; m<DIM; m++) {
- x2[i][m] = x1[i][m] + a*f[i][m];
- }
- }
-}
-
-static void do_x_sub(t_commrec *cr,int n,rvec *x1,rvec *x2,real a,rvec *f)
-
-{
- int start,end,i,m;
-
- if (DOMAINDECOMP(cr)) {
- start = 0;
- end = cr->dd->nat_home;
- } else if (PARTDECOMP(cr)) {
- pd_at_range(cr,&start,&end);
- } else {
- start = 0;
- end = n;
- }
-
- for(i=start; i<end; i++) {
- for(m=0; m<DIM; m++) {
- f[i][m] = (x1[i][m] - x2[i][m])*a;
- }
- }
-}
-
static void em_dd_partition_system(FILE *fplog,int step,t_commrec *cr,
gmx_mtop_t *top_global,t_inputrec *ir,
em_state_t *ems,gmx_localtop_t *top,
#include "mtop_util.h"
#include "domdec.h"
+#include "adress.h"
/*
{
continue;
}
+ /* Adress: an explicit cg that has a weigthing function of 0 is excluded
+ * from the neigbour list as it will not interact */
+ if (fr->adress_type != eAdressOff){
+ if (md->wf[cgs->index[icg]]==0 && egp_explicit(fr, igid)){
+ continue;
+ }
+ }
/* Get shift vector */
shift=XYZ2IS(tx,ty,tz);
#ifdef NS5DB
return top;
}
-static void create_vsitelist(int nindex, int *list,
- int *targetn, int **listptr)
-{
- int i,j,k,inr;
- int minidx;
- int *newlist;
-
- /* remove duplicates */
- for(i=0;i<nindex;i++) {
- inr=list[i];
- for(j=i+1;j<nindex;j++) {
- if(list[j]==inr) {
- for(k=j;k<nindex-1;k++)
- list[k]=list[k+1];
- nindex--;
- }
- }
- }
-
- *targetn=nindex;
- snew(newlist,nindex);
-
- /* sort into the new array */
- for(i=0;i<nindex;i++) {
- inr=-1;
- for(j=0;j<nindex;j++)
- if(list[j]>0 && (inr==-1 || list[j]<list[inr]))
- inr=j; /* smallest so far */
- newlist[i]=list[inr];
- list[inr]=-1;
- }
- *listptr=newlist;
-}
-
static void
add_to_vsitelist(int **list, int *nitem, int *nalloc,int newitem)
{
/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
*
- *
+ *
* This source code is part of
- *
+ *
* G R O M A C S
- *
+ *
* GROningen MAchine for Chemical Simulations
- *
+ *
* VERSION 3.2.0
* Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
- *
+ *
* If you want to redistribute modifications, please consider that
* scientific software is very special. Version control is crucial -
* bugs must be traceable. We will be happy to consider code for
* inclusion in the official distribution, but derived work must not
* be called official GROMACS. Details are found in the README & COPYING
* files - if they are missing, get the official version at www.gromacs.org.
- *
+ *
* To help us fund GROMACS development, we humbly ask that you cite
* the papers on the package - you can find them in the top README file.
- *
+ *
* For more info, check our website at http://www.gromacs.org
- *
+ *
* And Hey:
* GROwing Monsters And Cloning Shrimps
*/
*
* It might seem an overkill, but better safe than sorry.
* /Erik 001109
- */
+ */
#ifdef HAVE_CONFIG_H
#include <config.h>
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
+#ifdef GMX_OPENMP
+#include <omp.h>
+#endif
#include <stdio.h>
#include <string.h>
#include "gmx_wallcycle.h"
#include "gmx_parallel_3dfft.h"
#include "pdbio.h"
+#include "gmx_cyclecounter.h"
#if ( !defined(GMX_DOUBLE) && ( defined(GMX_IA32_SSE) || defined(GMX_X86_64_SSE) || defined(GMX_X86_64_SSE2) ) )
#include "gmx_sse2_single.h"
+
+#define PME_SSE
+/* Some old AMD processors could have problems with unaligned loads+stores */
+#ifndef GMX_FAHCORE
+#define PME_SSE_UNALIGNED
+#endif
#endif
#include "mpelogging.h"
/* #define TAKETIME (step > 1 && timesteps < 10) */
#define TAKETIME FALSE
+/* #define PME_TIME_THREADS */
+
#ifdef GMX_DOUBLE
#define mpi_type MPI_DOUBLE
#else
#define mpi_type MPI_FLOAT
#endif
+/* GMX_CACHE_SEP should be a multiple of 16 to preserve alignment */
+#define GMX_CACHE_SEP 64
+
+/* We only define a maximum to be able to use local arrays without allocation.
+ * An order larger than 12 should never be needed, even for test cases.
+ * If needed it can be changed here.
+ */
+#define PME_ORDER_MAX 12
+
/* Internal datastructures */
typedef struct {
int send_index0;
int noverlap_nodes;
int *send_id,*recv_id;
pme_grid_comm_t *comm_data;
+ real *sendbuf;
+ real *recvbuf;
} pme_overlap_t;
+typedef struct {
+ int *n; /* Cumulative counts of the number of particles per thread */
+ int nalloc; /* Allocation size of i */
+ int *i; /* Particle indices ordered on thread index (n) */
+} thread_plist_t;
+
+typedef struct {
+ int n;
+ int *ind;
+ splinevec theta;
+ splinevec dtheta;
+} splinedata_t;
+
typedef struct {
int dimind; /* The index of the dimension, 0=x, 1=y */
int nslab;
int pd_nalloc;
int *pd;
int *count; /* The number of atoms to send to each node */
+ int **count_thread;
int *rcount; /* The number of atoms to receive */
int n;
rvec *x;
real *q;
rvec *f;
- gmx_bool bSpread; /* These coordinates are used for spreading */
+ gmx_bool bSpread; /* These coordinates are used for spreading */
int pme_order;
- splinevec theta,dtheta;
ivec *idx;
rvec *fractx; /* Fractional coordinate relative to the
- * lower cell boundary
+ * lower cell boundary
*/
+ int nthread;
+ int *thread_idx; /* Which thread should spread which charge */
+ thread_plist_t *thread_plist;
+ splinedata_t *spline;
} pme_atomcomm_t;
+#define FLBS 3
+#define FLBSZ 4
+
+typedef struct {
+ ivec ci; /* The spatial location of this grid */
+ ivec n; /* The size of *grid, including order-1 */
+ ivec offset; /* The grid offset from the full node grid */
+ int order; /* PME spreading order */
+ real *grid; /* The grid local thread, size n */
+} pmegrid_t;
+
+typedef struct {
+ pmegrid_t grid; /* The full node grid (non thread-local) */
+ int nthread; /* The number of threads operating on this grid */
+ ivec nc; /* The local spatial decomposition over the threads */
+ pmegrid_t *grid_th; /* Array of grids for each thread */
+ int **g2t; /* The grid to thread index */
+ ivec nthread_comm; /* The number of threads to communicate with */
+} pmegrids_t;
+
+
+typedef struct {
+#ifdef PME_SSE
+ /* Masks for SSE aligned spreading and gathering */
+ __m128 mask_SSE0[6],mask_SSE1[6];
+#else
+ int dummy; /* C89 requires that struct has at least one member */
+#endif
+} pme_spline_work_t;
+
+typedef struct {
+ /* work data for solve_pme */
+ int nalloc;
+ real * mhx;
+ real * mhy;
+ real * mhz;
+ real * m2;
+ real * denom;
+ real * tmp1_alloc;
+ real * tmp1;
+ real * eterm;
+ real * m2inv;
+
+ real energy;
+ matrix vir;
+} pme_work_t;
+
typedef struct gmx_pme {
int ndecompdim; /* The number of decomposition dimensions */
int nodeid; /* Our nodeid in mpi->mpi_comm */
MPI_Datatype rvec_mpi; /* the pme vector's MPI type */
#endif
- gmx_bool bPPnode; /* Node also does particle-particle forces */
- gmx_bool bFEP; /* Compute Free energy contribution */
+ int nthread; /* The number of threads doing PME */
+
+ gmx_bool bPPnode; /* Node also does particle-particle forces */
+ gmx_bool bFEP; /* Compute Free energy contribution */
int nkx,nky,nkz; /* Grid dimensions */
int pme_order;
- real epsilon_r;
-
- real * pmegridA; /* Grids on which we do spreading/interpolation, includes overlap */
- real * pmegridB;
+ real epsilon_r;
+
+ pmegrids_t pmegridA; /* Grids on which we do spreading/interpolation, includes overlap */
+ pmegrids_t pmegridB;
+ /* The PME charge spreading grid sizes/strides, includes pme_order-1 */
int pmegrid_nx,pmegrid_ny,pmegrid_nz;
- int pmegrid_start_ix,pmegrid_start_iy,pmegrid_start_iz;
-
- real * pmegrid_sendbuf;
- real * pmegrid_recvbuf;
-
+ /* pmegrid_nz might be larger than strictly necessary to ensure
+ * memory alignment, pmegrid_nz_base gives the real base size.
+ */
+ int pmegrid_nz_base;
+ /* The local PME grid starting indices */
+ int pmegrid_start_ix,pmegrid_start_iy,pmegrid_start_iz;
+
+ /* Work data for spreading and gathering */
+ pme_spline_work_t spline_work;
+
real *fftgridA; /* Grids for FFT. With 1D FFT decomposition this can be a pointer */
real *fftgridB; /* inside the interpolation grid, but separate for 2D PME decomp. */
int fftgrid_nx,fftgrid_ny,fftgrid_nz;
-
+
t_complex *cfftgridA; /* Grids for complex FFT data */
- t_complex *cfftgridB;
+ t_complex *cfftgridB;
int cfftgrid_nx,cfftgrid_ny,cfftgrid_nz;
-
+
gmx_parallel_3dfft_t pfft_setupA;
gmx_parallel_3dfft_t pfft_setupB;
-
+
int *nnx,*nny,*nnz;
real *fshx,*fshy,*fshz;
-
+
pme_atomcomm_t atc[2]; /* Indexed on decomposition index */
matrix recipbox;
splinevec bsp_mod;
-
- pme_overlap_t overlap[2]; /* Indexed on dimension, 0=x, 1=y */
+ pme_overlap_t overlap[2]; /* Indexed on dimension, 0=x, 1=y */
pme_atomcomm_t atc_energy; /* Only for gmx_pme_calc_energy */
-
+
rvec *bufv; /* Communication buffer */
real *bufr; /* Communication buffer */
int buf_nalloc; /* The communication buffer size */
- /* work data for solve_pme */
- int work_nalloc;
- real * work_mhx;
- real * work_mhy;
- real * work_mhz;
- real * work_m2;
- real * work_denom;
- real * work_tmp1_alloc;
- real * work_tmp1;
- real * work_m2inv;
+ /* thread local work data for solve_pme */
+ pme_work_t *work;
/* Work data for PME_redist */
- gmx_bool redist_init;
- int * scounts;
+ gmx_bool redist_init;
+ int * scounts;
int * rcounts;
int * sdispls;
int * rdispls;
int * sidx;
- int * idxa;
+ int * idxa;
real * redist_buf;
int redist_buf_nalloc;
-
+
/* Work data for sum_qgrid */
real * sum_qgrid_tmp;
real * sum_qgrid_dd_tmp;
} t_gmx_pme;
-static void calc_interpolation_idx(gmx_pme_t pme,pme_atomcomm_t *atc)
+static void calc_interpolation_idx(gmx_pme_t pme,pme_atomcomm_t *atc,
+ int start,int end,int thread)
{
int i;
int *idxptr,tix,tiy,tiz;
real rxx,ryx,ryy,rzx,rzy,rzz;
int nx,ny,nz;
int start_ix,start_iy,start_iz;
-
+ int *g2tx,*g2ty,*g2tz;
+ gmx_bool bThreads;
+ int *thread_idx=NULL;
+ thread_plist_t *tpl=NULL;
+ int *tpl_n=NULL;
+ int thread_i;
+
nx = pme->nkx;
ny = pme->nky;
nz = pme->nkz;
-
+
start_ix = pme->pmegrid_start_ix;
start_iy = pme->pmegrid_start_iy;
start_iz = pme->pmegrid_start_iz;
-
+
rxx = pme->recipbox[XX][XX];
ryx = pme->recipbox[YY][XX];
ryy = pme->recipbox[YY][YY];
rzx = pme->recipbox[ZZ][XX];
rzy = pme->recipbox[ZZ][YY];
rzz = pme->recipbox[ZZ][ZZ];
-
- for(i=0; (i<atc->n); i++) {
+
+ g2tx = pme->pmegridA.g2t[XX];
+ g2ty = pme->pmegridA.g2t[YY];
+ g2tz = pme->pmegridA.g2t[ZZ];
+
+ bThreads = (atc->nthread > 1);
+ if (bThreads)
+ {
+ thread_idx = atc->thread_idx;
+
+ tpl = &atc->thread_plist[thread];
+ tpl_n = tpl->n;
+ for(i=0; i<atc->nthread; i++)
+ {
+ tpl_n[i] = 0;
+ }
+ }
+
+ for(i=start; i<end; i++) {
xptr = atc->x[i];
idxptr = atc->idx[i];
fptr = atc->fractx[i];
-
+
/* Fractional coordinates along box vectors, add 2.0 to make 100% sure we are positive for triclinic boxes */
tx = nx * ( xptr[XX] * rxx + xptr[YY] * ryx + xptr[ZZ] * rzx + 2.0 );
ty = ny * ( xptr[YY] * ryy + xptr[ZZ] * rzy + 2.0 );
tz = nz * ( xptr[ZZ] * rzz + 2.0 );
-
+
tix = (int)(tx);
tiy = (int)(ty);
tiz = (int)(tz);
-
+
/* Because decomposition only occurs in x and y,
* we never have a fraction correction in z.
*/
fptr[XX] = tx - tix + pme->fshx[tix];
fptr[YY] = ty - tiy + pme->fshy[tiy];
- fptr[ZZ] = tz - tiz;
+ fptr[ZZ] = tz - tiz;
idxptr[XX] = pme->nnx[tix];
idxptr[YY] = pme->nny[tiy];
range_check(idxptr[YY],0,pme->pmegrid_ny);
range_check(idxptr[ZZ],0,pme->pmegrid_nz);
#endif
- }
+
+ if (bThreads)
+ {
+ thread_i = g2tx[idxptr[XX]] + g2ty[idxptr[YY]] + g2tz[idxptr[ZZ]];
+ thread_idx[i] = thread_i;
+ tpl_n[thread_i]++;
+ }
+ }
+
+ if (bThreads)
+ {
+ /* Make a list of particle indices sorted on thread */
+
+ /* Get the cumulative count */
+ for(i=1; i<atc->nthread; i++)
+ {
+ tpl_n[i] += tpl_n[i-1];
+ }
+ /* The current implementation distributes particles equally
+ * over the threads, so we could actually allocate for that
+ * in pme_realloc_atomcomm_things.
+ */
+ if (tpl_n[atc->nthread-1] > tpl->nalloc)
+ {
+ tpl->nalloc = over_alloc_large(tpl_n[atc->nthread-1]);
+ srenew(tpl->i,tpl->nalloc);
+ }
+ /* Set tpl_n to the cumulative start */
+ for(i=atc->nthread-1; i>=1; i--)
+ {
+ tpl_n[i] = tpl_n[i-1];
+ }
+ tpl_n[0] = 0;
+
+ /* Fill our thread local array with indices sorted on thread */
+ for(i=start; i<end; i++)
+ {
+ tpl->i[tpl_n[atc->thread_idx[i]]++] = i;
+ }
+ /* Now tpl_n contains the cummulative count again */
+ }
}
-static void pme_calc_pidx(int natoms, matrix recipbox, rvec x[],
- pme_atomcomm_t *atc)
+static void make_thread_local_ind(pme_atomcomm_t *atc,
+ int thread,splinedata_t *spline)
+{
+ int n,t,i,start,end;
+ thread_plist_t *tpl;
+
+ /* Combine the indices made by each thread into one index */
+
+ n = 0;
+ start = 0;
+ for(t=0; t<atc->nthread; t++)
+ {
+ tpl = &atc->thread_plist[t];
+ /* Copy our part (start - end) from the list of thread t */
+ if (thread > 0)
+ {
+ start = tpl->n[thread-1];
+ }
+ end = tpl->n[thread];
+ for(i=start; i<end; i++)
+ {
+ spline->ind[n++] = tpl->i[i];
+ }
+ }
+
+ spline->n = n;
+}
+
+
+static void pme_calc_pidx(int start, int end,
+ matrix recipbox, rvec x[],
+ pme_atomcomm_t *atc, int *count)
{
int nslab,i;
int si;
real *xptr,s;
real rxx,ryx,rzx,ryy,rzy;
- int *pd,*count;
+ int *pd;
/* Calculate PME task index (pidx) for each grid index.
* Here we always assign equally sized slabs to each node
* for load balancing reasons (the PME grid spacing is not used).
*/
-
+
nslab = atc->nslab;
pd = atc->pd;
- count = atc->count;
/* Reset the count */
for(i=0; i<nslab; i++)
{
count[i] = 0;
}
-
+
if (atc->dimind == 0)
{
rxx = recipbox[XX][XX];
ryx = recipbox[YY][XX];
rzx = recipbox[ZZ][XX];
/* Calculate the node index in x-dimension */
- for(i=0; (i<natoms); i++)
+ for(i=start; i<end; i++)
{
xptr = x[i];
/* Fractional coordinates along box vectors */
ryy = recipbox[YY][YY];
rzy = recipbox[ZZ][YY];
/* Calculate the node index in y-dimension */
- for(i=0; (i<natoms); i++)
+ for(i=start; i<end; i++)
{
xptr = x[i];
/* Fractional coordinates along box vectors */
}
}
+static void pme_calc_pidx_wrapper(int natoms, matrix recipbox, rvec x[],
+ pme_atomcomm_t *atc)
+{
+ int nthread,thread,slab;
+
+ nthread = atc->nthread;
+
+#pragma omp parallel for num_threads(nthread) schedule(static)
+ for(thread=0; thread<nthread; thread++)
+ {
+ pme_calc_pidx(natoms* thread /nthread,
+ natoms*(thread+1)/nthread,
+ recipbox,x,atc,atc->count_thread[thread]);
+ }
+ /* Non-parallel reduction, since nslab is small */
+
+ for(thread=1; thread<nthread; thread++)
+ {
+ for(slab=0; slab<atc->nslab; slab++)
+ {
+ atc->count_thread[0][slab] += atc->count_thread[thread][slab];
+ }
+ }
+}
+
+static void pme_realloc_splinedata(splinedata_t *spline, pme_atomcomm_t *atc)
+{
+ int i,d;
+
+ srenew(spline->ind,atc->nalloc);
+ /* Initialize the index to identity so it works without threads */
+ for(i=0; i<atc->nalloc; i++)
+ {
+ spline->ind[i] = i;
+ }
+
+ for(d=0;d<DIM;d++)
+ {
+ srenew(spline->theta[d] ,atc->pme_order*atc->nalloc);
+ srenew(spline->dtheta[d],atc->pme_order*atc->nalloc);
+ }
+}
+
static void pme_realloc_atomcomm_things(pme_atomcomm_t *atc)
{
- int nalloc_old,i;
-
+ int nalloc_old,i,j,nalloc_tpl;
+
/* We have to avoid a NULL pointer for atc->x to avoid
* possible fatal errors in MPI routines.
*/
{
nalloc_old = atc->nalloc;
atc->nalloc = over_alloc_dd(max(atc->n,1));
-
+
if (atc->nslab > 1) {
srenew(atc->x,atc->nalloc);
srenew(atc->q,atc->nalloc);
}
}
if (atc->bSpread) {
- for(i=0;i<DIM;i++) {
- srenew(atc->theta[i] ,atc->pme_order*atc->nalloc);
- srenew(atc->dtheta[i],atc->pme_order*atc->nalloc);
- }
- srenew(atc->fractx,atc->nalloc);
+ srenew(atc->fractx,atc->nalloc);
srenew(atc->idx ,atc->nalloc);
+
+ if (atc->nthread > 1)
+ {
+ srenew(atc->thread_idx,atc->nalloc);
+ }
+
+ for(i=0; i<atc->nthread; i++)
+ {
+ pme_realloc_splinedata(&atc->spline[i],atc);
+ }
}
}
}
{
int *idxa;
int i, ii;
-
+
if(FALSE == pme->redist_init) {
snew(pme->scounts,atc->nslab);
snew(pme->rcounts,atc->nslab);
pme->redist_buf_nalloc = over_alloc_dd(n);
srenew(pme->redist_buf,pme->redist_buf_nalloc*DIM);
}
-
+
pme->idxa = atc->pd;
#ifdef GMX_MPI
if (forw && bXF) {
- /* forward, redistribution from pp to pme */
-
+ /* forward, redistribution from pp to pme */
+
/* Calculate send counts and exchange them with other nodes */
for(i=0; (i<atc->nslab); i++) pme->scounts[i]=0;
for(i=0; (i<n); i++) pme->scounts[pme->idxa[i]]++;
MPI_Alltoall( pme->scounts, 1, MPI_INT, pme->rcounts, 1, MPI_INT, atc->mpi_comm);
-
- /* Calculate send and receive displacements and index into send
+
+ /* Calculate send and receive displacements and index into send
buffer */
pme->sdispls[0]=0;
pme->rdispls[0]=0;
}
/* Total # of particles to be received */
atc->n = pme->rdispls[atc->nslab-1] + pme->rcounts[atc->nslab-1];
-
+
pme_realloc_atomcomm_things(atc);
-
+
/* Copy particle coordinates into send buffer and exchange*/
for(i=0; (i<n); i++) {
ii=DIM*pme->sidx[pme->idxa[i]];
pme->redist_buf[ii+YY]=x_f[i][YY];
pme->redist_buf[ii+ZZ]=x_f[i][ZZ];
}
- MPI_Alltoallv(pme->redist_buf, pme->scounts, pme->sdispls,
- pme->rvec_mpi, atc->x, pme->rcounts, pme->rdispls,
+ MPI_Alltoallv(pme->redist_buf, pme->scounts, pme->sdispls,
+ pme->rvec_mpi, atc->x, pme->rcounts, pme->rdispls,
pme->rvec_mpi, atc->mpi_comm);
}
if (forw) {
atc->q, pme->rcounts, pme->rdispls, mpi_type,
atc->mpi_comm);
}
- else { /* backward, redistribution from pme to pp */
+ else { /* backward, redistribution from pme to pp */
MPI_Alltoallv(atc->f, pme->rcounts, pme->rdispls, pme->rvec_mpi,
- pme->redist_buf, pme->scounts, pme->sdispls,
+ pme->redist_buf, pme->scounts, pme->sdispls,
pme->rvec_mpi, atc->mpi_comm);
-
+
/* Copy data from receive buffer */
for(i=0; i<atc->nslab; i++)
pme->sidx[i] = pme->sdispls[i];
pme->sidx[pme->idxa[i]]++;
}
}
-#endif
+#endif
}
static void pme_dd_sendrecv(pme_atomcomm_t *atc,
#ifdef GMX_MPI
int dest,src;
MPI_Status stat;
-
+
if (bBackward == FALSE) {
dest = atc->node_dest[shift];
src = atc->node_src[shift];
dest = atc->node_src[shift];
src = atc->node_dest[shift];
}
-
+
if (nbyte_s > 0 && nbyte_r > 0) {
MPI_Sendrecv(buf_s,nbyte_s,MPI_BYTE,
dest,shift,
#endif
}
-static void dd_pmeredist_x_q(gmx_pme_t pme,
+static void dd_pmeredist_x_q(gmx_pme_t pme,
int n, gmx_bool bX, rvec *x, real *charge,
pme_atomcomm_t *atc)
{
int *commnode,*buf_index;
int nnodes_comm,i,nsend,local_pos,buf_pos,node,scount,rcount;
-
+
commnode = atc->node_dest;
buf_index = atc->buf_index;
-
+
nnodes_comm = min(2*atc->maxshift,atc->nslab-1);
-
+
nsend = 0;
for(i=0; i<nnodes_comm; i++) {
buf_index[commnode[i]] = nsend;
"This usually means that your system is not well equilibrated.",
n - (atc->count[atc->nodeid] + nsend),
pme->nodeid,'x'+atc->dimind);
-
+
if (nsend > pme->buf_nalloc) {
pme->buf_nalloc = over_alloc_dd(nsend);
srenew(pme->bufv,pme->buf_nalloc);
srenew(pme->bufr,pme->buf_nalloc);
}
-
+
atc->n = atc->count[atc->nodeid];
for(i=0; i<nnodes_comm; i++) {
scount = atc->count[commnode[i]];
&atc->rcount[i],sizeof(int));
atc->n += atc->rcount[i];
}
-
+
pme_realloc_atomcomm_things(atc);
}
-
+
local_pos = 0;
for(i=0; i<n; i++) {
node = atc->pd[i];
buf_index[node]++;
}
}
-
+
buf_pos = 0;
for(i=0; i<nnodes_comm; i++) {
scount = atc->count[commnode[i]];
}
#ifdef GMX_MPI
-static void
+static void
gmx_sum_qgrid_dd(gmx_pme_t pme, real *grid, int direction)
{
pme_overlap_t *overlap;
int ipulse,send_id,recv_id,datasize;
real *p;
real *sendptr,*recvptr;
-
+
/* Start with minor-rank communication. This is a bit of a pain since it is not contiguous */
overlap = &pme->overlap[1];
-
+
for(ipulse=0;ipulse<overlap->noverlap_nodes;ipulse++)
{
/* Since we have already (un)wrapped the overlap in the z-dimension,
send_id = overlap->recv_id[ipulse];
recv_id = overlap->send_id[ipulse];
send_index0 = overlap->comm_data[ipulse].recv_index0;
- send_nindex = overlap->comm_data[ipulse].recv_nindex;
+ send_nindex = overlap->comm_data[ipulse].recv_nindex;
recv_index0 = overlap->comm_data[ipulse].send_index0;
recv_nindex = overlap->comm_data[ipulse].send_nindex;
}
for(k=0;k<pme->nkz;k++)
{
iz = k;
- pme->pmegrid_sendbuf[icnt++] = grid[ix*(pme->pmegrid_ny*pme->pmegrid_nz)+iy*(pme->pmegrid_nz)+iz];
+ overlap->sendbuf[icnt++] = grid[ix*(pme->pmegrid_ny*pme->pmegrid_nz)+iy*(pme->pmegrid_nz)+iz];
}
}
}
-
+
datasize = pme->pmegrid_nx * pme->nkz;
-
- MPI_Sendrecv(pme->pmegrid_sendbuf,send_nindex*datasize,GMX_MPI_REAL,
+
+ MPI_Sendrecv(overlap->sendbuf,send_nindex*datasize,GMX_MPI_REAL,
send_id,ipulse,
- pme->pmegrid_recvbuf,recv_nindex*datasize,GMX_MPI_REAL,
+ overlap->recvbuf,recv_nindex*datasize,GMX_MPI_REAL,
recv_id,ipulse,
overlap->mpi_comm,&stat);
-
+
/* Get data from contiguous recv buffer */
if (debug)
{
iz = k;
if(direction==GMX_SUM_QGRID_FORWARD)
{
- grid[ix*(pme->pmegrid_ny*pme->pmegrid_nz)+iy*(pme->pmegrid_nz)+iz] += pme->pmegrid_recvbuf[icnt++];
+ grid[ix*(pme->pmegrid_ny*pme->pmegrid_nz)+iy*(pme->pmegrid_nz)+iz] += overlap->recvbuf[icnt++];
}
else
{
- grid[ix*(pme->pmegrid_ny*pme->pmegrid_nz)+iy*(pme->pmegrid_nz)+iz] = pme->pmegrid_recvbuf[icnt++];
+ grid[ix*(pme->pmegrid_ny*pme->pmegrid_nz)+iy*(pme->pmegrid_nz)+iz] = overlap->recvbuf[icnt++];
}
}
}
}
}
-
+
/* Major dimension is easier, no copying required,
* but we might have to sum to separate array.
* Since we don't copy, we have to communicate up to pmegrid_nz,
* not nkz as for the minor direction.
*/
overlap = &pme->overlap[0];
-
+
for(ipulse=0;ipulse<overlap->noverlap_nodes;ipulse++)
{
if(direction==GMX_SUM_QGRID_FORWARD)
send_nindex = overlap->comm_data[ipulse].send_nindex;
recv_index0 = overlap->comm_data[ipulse].recv_index0;
recv_nindex = overlap->comm_data[ipulse].recv_nindex;
- recvptr = pme->pmegrid_recvbuf;
+ recvptr = overlap->recvbuf;
}
else
{
send_id = overlap->recv_id[ipulse];
recv_id = overlap->send_id[ipulse];
send_index0 = overlap->comm_data[ipulse].recv_index0;
- send_nindex = overlap->comm_data[ipulse].recv_nindex;
+ send_nindex = overlap->comm_data[ipulse].recv_nindex;
recv_index0 = overlap->comm_data[ipulse].send_index0;
recv_nindex = overlap->comm_data[ipulse].send_nindex;
recvptr = grid + (recv_index0-pme->pmegrid_start_ix)*(pme->pmegrid_ny*pme->pmegrid_nz);
}
-
+
sendptr = grid + (send_index0-pme->pmegrid_start_ix)*(pme->pmegrid_ny*pme->pmegrid_nz);
datasize = pme->pmegrid_ny * pme->pmegrid_nz;
recvptr,recv_nindex*datasize,GMX_MPI_REAL,
recv_id,ipulse,
overlap->mpi_comm,&stat);
-
+
/* ADD data from contiguous recv buffer */
if(direction==GMX_SUM_QGRID_FORWARD)
- {
+ {
p = grid + (recv_index0-pme->pmegrid_start_ix)*(pme->pmegrid_ny*pme->pmegrid_nz);
for(i=0;i<recv_nindex*datasize;i++)
{
- p[i] += pme->pmegrid_recvbuf[i];
+ p[i] += overlap->recvbuf[i];
}
}
}
local_fft_ndata,
local_fft_offset,
local_fft_size);
-
+
local_pme_size[0] = pme->pmegrid_nx;
local_pme_size[1] = pme->pmegrid_ny;
local_pme_size[2] = pme->pmegrid_nz;
-
- /* The fftgrid is always 'justified' to the lower-left corner of the PME grid,
+
+ /* The fftgrid is always 'justified' to the lower-left corner of the PME grid,
the offset is identical, and the PME grid always has more data (due to overlap)
*/
{
fp2 = ffopen(fn,"w");
sprintf(format,"%s%s\n",pdbformat,"%6.2f%6.2f");
#endif
+
for(ix=0;ix<local_fft_ndata[XX];ix++)
{
for(iy=0;iy<local_fft_ndata[YY];iy++)
}
}
#ifdef DEBUG_PME
- fclose(fp);
- fclose(fp2);
+ ffclose(fp);
+ ffclose(fp2);
#endif
}
return 0;
}
+static gmx_cycles_t omp_cyc_start()
+{
+ return gmx_cycles_read();
+}
+
+static gmx_cycles_t omp_cyc_end(gmx_cycles_t c)
+{
+ return gmx_cycles_read() - c;
+}
+
+
static int
-copy_fftgrid_to_pmegrid(gmx_pme_t pme, real *fftgrid, real *pmegrid)
+copy_fftgrid_to_pmegrid(gmx_pme_t pme, const real *fftgrid, real *pmegrid,
+ int nthread,int thread)
{
ivec local_fft_ndata,local_fft_offset,local_fft_size;
ivec local_pme_size;
- int i,ix,iy,iz;
+ int ixy0,ixy1,ixy,ix,iy,iz;
int pmeidx,fftidx;
-
+#ifdef PME_TIME_THREADS
+ gmx_cycles_t c1;
+ static double cs1=0;
+ static int cnt=0;
+#endif
+
+#ifdef PME_TIME_THREADS
+ c1 = omp_cyc_start();
+#endif
/* Dimensions should be identical for A/B grid, so we just use A here */
gmx_parallel_3dfft_real_limits(pme->pfft_setupA,
local_fft_ndata,
local_pme_size[0] = pme->pmegrid_nx;
local_pme_size[1] = pme->pmegrid_ny;
local_pme_size[2] = pme->pmegrid_nz;
-
- /* The fftgrid is always 'justified' to the lower-left corner of the PME grid,
+
+ /* The fftgrid is always 'justified' to the lower-left corner of the PME grid,
the offset is identical, and the PME grid always has more data (due to overlap)
*/
- for(ix=0;ix<local_fft_ndata[XX];ix++)
+ ixy0 = ((thread )*local_fft_ndata[XX]*local_fft_ndata[YY])/nthread;
+ ixy1 = ((thread+1)*local_fft_ndata[XX]*local_fft_ndata[YY])/nthread;
+
+ for(ixy=ixy0;ixy<ixy1;ixy++)
{
- for(iy=0;iy<local_fft_ndata[YY];iy++)
+ ix = ixy/local_fft_ndata[YY];
+ iy = ixy - ix*local_fft_ndata[YY];
+
+ pmeidx = (ix*local_pme_size[YY] + iy)*local_pme_size[ZZ];
+ fftidx = (ix*local_fft_size[YY] + iy)*local_fft_size[ZZ];
+ for(iz=0;iz<local_fft_ndata[ZZ];iz++)
{
- for(iz=0;iz<local_fft_ndata[ZZ];iz++)
- {
- pmeidx = ix*(local_pme_size[YY]*local_pme_size[ZZ])+iy*(local_pme_size[ZZ])+iz;
- fftidx = ix*(local_fft_size[YY]*local_fft_size[ZZ])+iy*(local_fft_size[ZZ])+iz;
- pmegrid[pmeidx] = fftgrid[fftidx];
- }
+ pmegrid[pmeidx+iz] = fftgrid[fftidx+iz];
}
- }
+ }
+
+#ifdef PME_TIME_THREADS
+ c1 = omp_cyc_end(c1);
+ cs1 += (double)c1;
+ cnt++;
+ if (cnt % 20 == 0)
+ {
+ printf("copy %.2f\n",cs1*1e-9);
+ }
+#endif
+
return 0;
}
overlap = pme->pme_order - 1;
/* Add periodic overlap in z */
- for(ix=0; ix<pnx; ix++)
+ for(ix=0; ix<pme->pmegrid_nx; ix++)
{
- for(iy=0; iy<pny; iy++)
+ for(iy=0; iy<pme->pmegrid_ny; iy++)
{
for(iz=0; iz<overlap; iz++)
{
if (pme->nnodes_minor == 1)
{
- for(ix=0; ix<pnx; ix++)
+ for(ix=0; ix<pme->pmegrid_nx; ix++)
{
for(iy=0; iy<overlap; iy++)
{
}
}
}
-
+
if (pme->nnodes_major == 1)
{
- ny_x = (pme->nnodes_minor == 1 ? ny : pny);
+ ny_x = (pme->nnodes_minor == 1 ? ny : pme->pmegrid_ny);
for(ix=0; ix<overlap; ix++)
{
static void
unwrap_periodic_pmegrid(gmx_pme_t pme, real *pmegrid)
{
- int nx,ny,nz,pnx,pny,pnz,ny_x,overlap,ix,iy,iz;
+ int nx,ny,nz,pnx,pny,pnz,ny_x,overlap,ix;
nx = pme->nkx;
ny = pme->nky;
if (pme->nnodes_major == 1)
{
- ny_x = (pme->nnodes_minor == 1 ? ny : pny);
+ ny_x = (pme->nnodes_minor == 1 ? ny : pme->pmegrid_ny);
for(ix=0; ix<overlap; ix++)
{
+ int iy,iz;
+
for(iy=0; iy<ny_x; iy++)
{
for(iz=0; iz<nz; iz++)
if (pme->nnodes_minor == 1)
{
- for(ix=0; ix<pnx; ix++)
+#pragma omp parallel for num_threads(pme->nthread) schedule(static)
+ for(ix=0; ix<pme->pmegrid_nx; ix++)
{
+ int iy,iz;
+
for(iy=0; iy<overlap; iy++)
{
for(iz=0; iz<nz; iz++)
}
/* Copy periodic overlap in z */
- for(ix=0; ix<pnx; ix++)
+#pragma omp parallel for num_threads(pme->nthread) schedule(static)
+ for(ix=0; ix<pme->pmegrid_nx; ix++)
{
- for(iy=0; iy<pny; iy++)
+ int iy,iz;
+
+ for(iy=0; iy<pme->pmegrid_ny; iy++)
{
for(iz=0; iz<overlap; iz++)
{
}
}
+static void clear_grid(int nx,int ny,int nz,real *grid,
+ ivec fs,int *flag,
+ int fx,int fy,int fz,
+ int order)
+{
+ int nc,ncz;
+ int fsx,fsy,fsz,gx,gy,gz,g0x,g0y,x,y,z;
+ int flind;
+
+ nc = 2 + (order - 2)/FLBS;
+ ncz = 2 + (order - 2)/FLBSZ;
+
+ for(fsx=fx; fsx<fx+nc; fsx++)
+ {
+ for(fsy=fy; fsy<fy+nc; fsy++)
+ {
+ for(fsz=fz; fsz<fz+ncz; fsz++)
+ {
+ flind = (fsx*fs[YY] + fsy)*fs[ZZ] + fsz;
+ if (flag[flind] == 0)
+ {
+ gx = fsx*FLBS;
+ gy = fsy*FLBS;
+ gz = fsz*FLBSZ;
+ g0x = (gx*ny + gy)*nz + gz;
+ for(x=0; x<FLBS; x++)
+ {
+ g0y = g0x;
+ for(y=0; y<FLBS; y++)
+ {
+ for(z=0; z<FLBSZ; z++)
+ {
+ grid[g0y+z] = 0;
+ }
+ g0y += nz;
+ }
+ g0x += ny*nz;
+ }
+
+ flag[flind] = 1;
+ }
+ }
+ }
+ }
+}
/* This has to be a macro to enable full compiler optimization with xlC (and probably others too) */
#define DO_BSPLINE(order) \
}
-static void spread_q_bsplines(gmx_pme_t pme, pme_atomcomm_t *atc,
- real *grid)
+static void spread_q_bsplines_thread(pmegrid_t *pmegrid,
+ pme_atomcomm_t *atc, splinedata_t *spline,
+ pme_spline_work_t *work)
{
/* spread charges from home atoms to local grid */
+ real *grid;
pme_overlap_t *ol;
int b,i,nn,n,ithx,ithy,ithz,i0,j0,k0;
int * idxptr;
real valx,valxy,qn;
real *thx,*thy,*thz;
int localsize, bndsize;
-
int pnx,pny,pnz,ndatatot;
-
- pnx = pme->pmegrid_nx;
- pny = pme->pmegrid_ny;
- pnz = pme->pmegrid_nz;
+ int offx,offy,offz;
+
+ pnx = pmegrid->n[XX];
+ pny = pmegrid->n[YY];
+ pnz = pmegrid->n[ZZ];
+
+ offx = pmegrid->offset[XX];
+ offy = pmegrid->offset[YY];
+ offz = pmegrid->offset[ZZ];
+
ndatatot = pnx*pny*pnz;
-
+ grid = pmegrid->grid;
for(i=0;i<ndatatot;i++)
{
grid[i] = 0;
}
- order = pme->pme_order;
+ order = pmegrid->order;
- for(nn=0; (nn<atc->n);nn++)
+ for(nn=0; nn<spline->n; nn++)
{
- n = nn;
- qn = atc->q[n];
+ n = spline->ind[nn];
+ qn = atc->q[n];
- if (qn != 0)
+ if (qn != 0)
{
idxptr = atc->idx[n];
- norder = n*order;
-
- i0 = idxptr[XX];
- j0 = idxptr[YY];
- k0 = idxptr[ZZ];
- thx = atc->theta[XX] + norder;
- thy = atc->theta[YY] + norder;
- thz = atc->theta[ZZ] + norder;
-
+ norder = nn*order;
+
+ i0 = idxptr[XX] - offx;
+ j0 = idxptr[YY] - offy;
+ k0 = idxptr[ZZ] - offz;
+
+ thx = spline->theta[XX] + norder;
+ thy = spline->theta[YY] + norder;
+ thz = spline->theta[ZZ] + norder;
+
switch (order) {
- case 4: DO_BSPLINE(4); break;
- case 5: DO_BSPLINE(5); break;
- default: DO_BSPLINE(order); break;
+ case 4:
+#ifdef PME_SSE
+#ifdef PME_SSE_UNALIGNED
+#define PME_SPREAD_SSE_ORDER4
+#else
+#define PME_SPREAD_SSE_ALIGNED
+#define PME_ORDER 4
+#endif
+#include "pme_sse_single.h"
+#else
+ DO_BSPLINE(4);
+#endif
+ break;
+ case 5:
+#ifdef PME_SSE
+#define PME_SPREAD_SSE_ALIGNED
+#define PME_ORDER 5
+#include "pme_sse_single.h"
+#else
+ DO_BSPLINE(5);
+#endif
+ break;
+ default:
+ DO_BSPLINE(order);
+ break;
}
}
- }
+ }
}
-
-#if ( !defined(GMX_DOUBLE) && ( defined(GMX_IA32_SSE) || defined(GMX_X86_64_SSE) || defined(GMX_X86_64_SSE2) ) )
- /* Calculate exponentials through SSE in float precision */
-#define CALC_EXPONENTIALS(start,end,r_aligned) \
- { \
- __m128 tmp_sse; \
- for(kx=0; kx<end; kx+=4) \
- { \
- tmp_sse = _mm_load_ps(r_aligned+kx); \
- tmp_sse = gmx_mm_exp_ps(tmp_sse); \
- _mm_store_ps(r_aligned+kx,tmp_sse); \
- } \
+static void set_grid_alignment(int *pmegrid_nz,int pme_order)
+{
+#ifdef PME_SSE
+ if (pme_order == 5
+#ifndef PME_SSE_UNALIGNED
+ || pme_order == 4
+#endif
+ )
+ {
+ /* Round nz up to a multiple of 4 to ensure alignment */
+ *pmegrid_nz = ((*pmegrid_nz + 3) & ~3);
}
-#else
-#define CALC_EXPONENTIALS(start,end,r) \
- for(kx=start; kx<end; kx++) \
- { \
- r[kx] = exp(r[kx]); \
+#endif
+}
+
+static void set_gridsize_alignment(int *gridsize,int pme_order)
+{
+#ifdef PME_SSE
+#ifndef PME_SSE_UNALIGNED
+ if (pme_order == 4)
+ {
+ /* Add extra elements to ensured aligned operations do not go
+ * beyond the allocated grid size.
+ * Note that for pme_order=5, the pme grid z-size alignment
+ * ensures that we will not go beyond the grid size.
+ */
+ *gridsize += 4;
}
#endif
+#endif
+}
+
+static void pmegrid_init(pmegrid_t *grid,
+ int cx, int cy, int cz,
+ int x0, int y0, int z0,
+ int x1, int y1, int z1,
+ gmx_bool set_alignment,
+ int pme_order,
+ real *ptr)
+{
+ int nz,gridsize;
+
+ grid->ci[XX] = cx;
+ grid->ci[YY] = cy;
+ grid->ci[ZZ] = cz;
+ grid->offset[XX] = x0;
+ grid->offset[YY] = y0;
+ grid->offset[ZZ] = z0;
+ grid->n[XX] = x1 - x0 + pme_order - 1;
+ grid->n[YY] = y1 - y0 + pme_order - 1;
+ grid->n[ZZ] = z1 - z0 + pme_order - 1;
+
+ nz = grid->n[ZZ];
+ set_grid_alignment(&nz,pme_order);
+ if (set_alignment)
+ {
+ grid->n[ZZ] = nz;
+ }
+ else if (nz != grid->n[ZZ])
+ {
+ gmx_incons("pmegrid_init call with an unaligned z size");
+ }
+ grid->order = pme_order;
+ if (ptr == NULL)
+ {
+ gridsize = grid->n[XX]*grid->n[YY]*grid->n[ZZ];
+ set_gridsize_alignment(&gridsize,pme_order);
+ snew_aligned(grid->grid,gridsize,16);
+ }
+ else
+ {
+ grid->grid = ptr;
+ }
+}
-static int solve_pme_yzx(gmx_pme_t pme,t_complex *grid,
- real ewaldcoeff,real vol,
- gmx_bool bEnerVir,real *mesh_energy,matrix vir)
+static int div_round_up(int enumerator,int denominator)
{
- /* do recip sum over local cells in grid */
- /* y major, z middle, x minor or continuous */
- t_complex *p0;
+ return (enumerator + denominator - 1)/denominator;
+}
+
+static void make_subgrid_division(const ivec n,int ovl,int nthread,
+ ivec nsub)
+{
+ int gsize_opt,gsize;
+ int nsx,nsy,nsz;
+ char *env;
+
+ gsize_opt = -1;
+ for(nsx=1; nsx<=nthread; nsx++)
+ {
+ if (nthread % nsx == 0)
+ {
+ for(nsy=1; nsy<=nthread; nsy++)
+ {
+ if (nsx*nsy <= nthread && nthread % (nsx*nsy) == 0)
+ {
+ nsz = nthread/(nsx*nsy);
+
+ /* Determine the number of grid points per thread */
+ gsize =
+ (div_round_up(n[XX],nsx) + ovl)*
+ (div_round_up(n[YY],nsy) + ovl)*
+ (div_round_up(n[ZZ],nsz) + ovl);
+
+ /* Minimize the number of grids points per thread
+ * and, secondarily, the number of cuts in minor dimensions.
+ */
+ if (gsize_opt == -1 ||
+ gsize < gsize_opt ||
+ (gsize == gsize_opt &&
+ (nsz < nsub[ZZ] || (nsz == nsub[ZZ] && nsy < nsub[YY]))))
+ {
+ nsub[XX] = nsx;
+ nsub[YY] = nsy;
+ nsub[ZZ] = nsz;
+ gsize_opt = gsize;
+ }
+ }
+ }
+ }
+ }
+
+ env = getenv("GMX_PME_THREAD_DIVISION");
+ if (env != NULL)
+ {
+ sscanf(env,"%d %d %d",&nsub[XX],&nsub[YY],&nsub[ZZ]);
+ }
+
+ if (nsub[XX]*nsub[YY]*nsub[ZZ] != nthread)
+ {
+ gmx_fatal(FARGS,"PME grid thread division (%d x %d x %d) does not match the total number of threads (%d)",nsub[XX],nsub[YY],nsub[ZZ],nthread);
+ }
+}
+
+static void pmegrids_init(pmegrids_t *grids,
+ int nx,int ny,int nz,int nz_base,
+ int pme_order,
+ int nthread,
+ int overlap_x,
+ int overlap_y)
+{
+ ivec n,n_base,g0,g1;
+ int t,x,y,z,d,i,tfac;
+ int max_comm_lines;
+
+ n[XX] = nx - (pme_order - 1);
+ n[YY] = ny - (pme_order - 1);
+ n[ZZ] = nz - (pme_order - 1);
+
+ copy_ivec(n,n_base);
+ n_base[ZZ] = nz_base;
+
+ pmegrid_init(&grids->grid,0,0,0,0,0,0,n[XX],n[YY],n[ZZ],FALSE,pme_order,
+ NULL);
+
+ grids->nthread = nthread;
+
+ make_subgrid_division(n_base,pme_order-1,grids->nthread,grids->nc);
+
+ if (grids->nthread > 1)
+ {
+ ivec nst;
+ int gridsize;
+ real *grid_all;
+
+ for(d=0; d<DIM; d++)
+ {
+ nst[d] = div_round_up(n[d],grids->nc[d]) + pme_order - 1;
+ }
+ set_grid_alignment(&nst[ZZ],pme_order);
+
+ if (debug)
+ {
+ fprintf(debug,"pmegrid thread local division: %d x %d x %d\n",
+ grids->nc[XX],grids->nc[YY],grids->nc[ZZ]);
+ fprintf(debug,"pmegrid %d %d %d max thread pmegrid %d %d %d\n",
+ nx,ny,nz,
+ nst[XX],nst[YY],nst[ZZ]);
+ }
+
+ snew(grids->grid_th,grids->nthread);
+ t = 0;
+ gridsize = nst[XX]*nst[YY]*nst[ZZ];
+ set_gridsize_alignment(&gridsize,pme_order);
+ snew_aligned(grid_all,
+ grids->nthread*gridsize+(grids->nthread+1)*GMX_CACHE_SEP,
+ 16);
+
+ for(x=0; x<grids->nc[XX]; x++)
+ {
+ for(y=0; y<grids->nc[YY]; y++)
+ {
+ for(z=0; z<grids->nc[ZZ]; z++)
+ {
+ pmegrid_init(&grids->grid_th[t],
+ x,y,z,
+ (n[XX]*(x ))/grids->nc[XX],
+ (n[YY]*(y ))/grids->nc[YY],
+ (n[ZZ]*(z ))/grids->nc[ZZ],
+ (n[XX]*(x+1))/grids->nc[XX],
+ (n[YY]*(y+1))/grids->nc[YY],
+ (n[ZZ]*(z+1))/grids->nc[ZZ],
+ TRUE,
+ pme_order,
+ grid_all+GMX_CACHE_SEP+t*(gridsize+GMX_CACHE_SEP));
+ t++;
+ }
+ }
+ }
+ }
+
+ snew(grids->g2t,DIM);
+ tfac = 1;
+ for(d=DIM-1; d>=0; d--)
+ {
+ snew(grids->g2t[d],n[d]);
+ t = 0;
+ for(i=0; i<n[d]; i++)
+ {
+ /* The second check should match the parameters
+ * of the pmegrid_init call above.
+ */
+ while (t + 1 < grids->nc[d] && i >= (n[d]*(t+1))/grids->nc[d])
+ {
+ t++;
+ }
+ grids->g2t[d][i] = t*tfac;
+ }
+
+ tfac *= grids->nc[d];
+
+ switch (d)
+ {
+ case XX: max_comm_lines = overlap_x; break;
+ case YY: max_comm_lines = overlap_y; break;
+ case ZZ: max_comm_lines = pme_order - 1; break;
+ }
+ grids->nthread_comm[d] = 0;
+ while ((n[d]*grids->nthread_comm[d])/grids->nc[d] < max_comm_lines)
+ {
+ grids->nthread_comm[d]++;
+ }
+ if (debug != NULL)
+ {
+ fprintf(debug,"pmegrid thread grid communication range in %c: %d\n",
+ 'x'+d,grids->nthread_comm[d]);
+ }
+ /* It should be possible to make grids->nthread_comm[d]==grids->nc[d]
+ * work, but this is not a problematic restriction.
+ */
+ if (grids->nc[d] > 1 && grids->nthread_comm[d] > grids->nc[d])
+ {
+ gmx_fatal(FARGS,"Too many threads for PME (%d) compared to the number of grid lines, reduce the number of threads doing PME",grids->nthread);
+ }
+ }
+}
+
+
+static void pmegrids_destroy(pmegrids_t *grids)
+{
+ int t;
+
+ if (grids->grid.grid != NULL)
+ {
+ sfree(grids->grid.grid);
+
+ if (grids->nthread > 0)
+ {
+ for(t=0; t<grids->nthread; t++)
+ {
+ sfree(grids->grid_th[t].grid);
+ }
+ sfree(grids->grid_th);
+ }
+ }
+}
+
+
+static void realloc_work(pme_work_t *work,int nkx)
+{
+ if (nkx > work->nalloc)
+ {
+ work->nalloc = nkx;
+ srenew(work->mhx ,work->nalloc);
+ srenew(work->mhy ,work->nalloc);
+ srenew(work->mhz ,work->nalloc);
+ srenew(work->m2 ,work->nalloc);
+ srenew(work->denom,work->nalloc);
+ /* Allocate an aligned pointer for SSE operations, including 3 extra
+ * elements at the end since SSE operates on 4 elements at a time.
+ */
+ sfree_aligned(work->denom);
+ sfree_aligned(work->tmp1);
+ sfree_aligned(work->eterm);
+ snew_aligned(work->denom,work->nalloc+3,16);
+ snew_aligned(work->tmp1 ,work->nalloc+3,16);
+ snew_aligned(work->eterm,work->nalloc+3,16);
+ srenew(work->m2inv,work->nalloc);
+ }
+}
+
+
+static void free_work(pme_work_t *work)
+{
+ sfree(work->mhx);
+ sfree(work->mhy);
+ sfree(work->mhz);
+ sfree(work->m2);
+ sfree_aligned(work->denom);
+ sfree_aligned(work->tmp1);
+ sfree_aligned(work->eterm);
+ sfree(work->m2inv);
+}
+
+
+#ifdef PME_SSE
+ /* Calculate exponentials through SSE in float precision */
+inline static void calc_exponentials(int start, int end, real f, real *d_aligned, real *r_aligned, real *e_aligned)
+{
+ {
+ const __m128 two = _mm_set_ps(2.0f,2.0f,2.0f,2.0f);
+ __m128 f_sse;
+ __m128 lu;
+ __m128 tmp_d1,d_inv,tmp_r,tmp_e;
+ int kx;
+ f_sse = _mm_load1_ps(&f);
+ for(kx=0; kx<end; kx+=4)
+ {
+ tmp_d1 = _mm_load_ps(d_aligned+kx);
+ lu = _mm_rcp_ps(tmp_d1);
+ d_inv = _mm_mul_ps(lu,_mm_sub_ps(two,_mm_mul_ps(lu,tmp_d1)));
+ tmp_r = _mm_load_ps(r_aligned+kx);
+ tmp_r = gmx_mm_exp_ps(tmp_r);
+ tmp_e = _mm_mul_ps(f_sse,d_inv);
+ tmp_e = _mm_mul_ps(tmp_e,tmp_r);
+ _mm_store_ps(e_aligned+kx,tmp_e);
+ }
+ }
+}
+#else
+inline static void calc_exponentials(int start, int end, real f, real *d, real *r, real *e)
+{
+ int kx;
+ for(kx=start; kx<end; kx++)
+ {
+ d[kx] = 1.0/d[kx];
+ }
+ for(kx=start; kx<end; kx++)
+ {
+ r[kx] = exp(r[kx]);
+ }
+ for(kx=start; kx<end; kx++)
+ {
+ e[kx] = f*r[kx]*d[kx];
+ }
+}
+#endif
+
+
+static int solve_pme_yzx(gmx_pme_t pme,t_complex *grid,
+ real ewaldcoeff,real vol,
+ gmx_bool bEnerVir,
+ int nthread,int thread)
+{
+ /* do recip sum over local cells in grid */
+ /* y major, z middle, x minor or continuous */
+ t_complex *p0;
int kx,ky,kz,maxkx,maxky,maxkz;
- int nx,ny,nz,iy,iz,kxstart,kxend;
+ int nx,ny,nz,iyz0,iyz1,iyz,iy,iz,kxstart,kxend;
real mx,my,mz;
real factor=M_PI*M_PI/(ewaldcoeff*ewaldcoeff);
real ets2,struct2,vfactor,ets2vf;
- real eterm,d1,d2,energy=0;
+ real d1,d2,energy=0;
real by,bz;
real virxx=0,virxy=0,virxz=0,viryy=0,viryz=0,virzz=0;
real rxx,ryx,ryy,rzx,rzy,rzz;
- real *mhx,*mhy,*mhz,*m2,*denom,*tmp1,*m2inv;
+ pme_work_t *work;
+ real *mhx,*mhy,*mhz,*m2,*denom,*tmp1,*eterm,*m2inv;
real mhxk,mhyk,mhzk,m2k;
real corner_fac;
ivec complex_order;
ivec local_ndata,local_offset,local_size;
-
+ real elfac;
+
+ elfac = ONE_4PI_EPS0/pme->epsilon_r;
+
nx = pme->nkx;
ny = pme->nky;
nz = pme->nkz;
-
+
/* Dimensions should be identical for A/B grid, so we just use A here */
gmx_parallel_3dfft_complex_limits(pme->pfft_setupA,
complex_order,
local_ndata,
local_offset,
local_size);
-
+
rxx = pme->recipbox[XX][XX];
ryx = pme->recipbox[YY][XX];
ryy = pme->recipbox[YY][YY];
rzx = pme->recipbox[ZZ][XX];
rzy = pme->recipbox[ZZ][YY];
rzz = pme->recipbox[ZZ][ZZ];
-
+
maxkx = (nx+1)/2;
maxky = (ny+1)/2;
maxkz = nz/2+1;
-
- mhx = pme->work_mhx;
- mhy = pme->work_mhy;
- mhz = pme->work_mhz;
- m2 = pme->work_m2;
- denom = pme->work_denom;
- tmp1 = pme->work_tmp1;
- m2inv = pme->work_m2inv;
- for(iy=0;iy<local_ndata[YY];iy++)
+ work = &pme->work[thread];
+ mhx = work->mhx;
+ mhy = work->mhy;
+ mhz = work->mhz;
+ m2 = work->m2;
+ denom = work->denom;
+ tmp1 = work->tmp1;
+ eterm = work->eterm;
+ m2inv = work->m2inv;
+
+ iyz0 = local_ndata[YY]*local_ndata[ZZ]* thread /nthread;
+ iyz1 = local_ndata[YY]*local_ndata[ZZ]*(thread+1)/nthread;
+
+ for(iyz=iyz0; iyz<iyz1; iyz++)
{
+ iy = iyz/local_ndata[ZZ];
+ iz = iyz - iy*local_ndata[ZZ];
+
ky = iy + local_offset[YY];
-
- if (ky < maxky)
+
+ if (ky < maxky)
{
my = ky;
}
- else
+ else
{
my = (ky - ny);
}
-
+
by = M_PI*vol*pme->bsp_mod[YY][ky];
- for(iz=0;iz<local_ndata[ZZ];iz++)
- {
- kz = iz + local_offset[ZZ];
-
- mz = kz;
-
- bz = pme->bsp_mod[ZZ][kz];
-
- /* 0.5 correction for corner points */
- corner_fac = 1;
- if (kz == 0)
- corner_fac = 0.5;
- if (kz == (nz+1)/2)
- corner_fac = 0.5;
-
- p0 = grid + iy*local_size[ZZ]*local_size[XX] + iz*local_size[XX];
-
- /* We should skip the k-space point (0,0,0) */
- if (local_offset[XX] > 0 ||
- local_offset[YY] > 0 || ky > 0 ||
- kz > 0)
+ kz = iz + local_offset[ZZ];
+
+ mz = kz;
+
+ bz = pme->bsp_mod[ZZ][kz];
+
+ /* 0.5 correction for corner points */
+ corner_fac = 1;
+ if (kz == 0 || kz == (nz+1)/2)
+ {
+ corner_fac = 0.5;
+ }
+
+ p0 = grid + iy*local_size[ZZ]*local_size[XX] + iz*local_size[XX];
+
+ /* We should skip the k-space point (0,0,0) */
+ if (local_offset[XX] > 0 || ky > 0 || kz > 0)
+ {
+ kxstart = local_offset[XX];
+ }
+ else
+ {
+ kxstart = local_offset[XX] + 1;
+ p0++;
+ }
+ kxend = local_offset[XX] + local_ndata[XX];
+
+ if (bEnerVir)
+ {
+ /* More expensive inner loop, especially because of the storage
+ * of the mh elements in array's.
+ * Because x is the minor grid index, all mh elements
+ * depend on kx for triclinic unit cells.
+ */
+
+ /* Two explicit loops to avoid a conditional inside the loop */
+ for(kx=kxstart; kx<maxkx; kx++)
{
- kxstart = local_offset[XX];
+ mx = kx;
+
+ mhxk = mx * rxx;
+ mhyk = mx * ryx + my * ryy;
+ mhzk = mx * rzx + my * rzy + mz * rzz;
+ m2k = mhxk*mhxk + mhyk*mhyk + mhzk*mhzk;
+ mhx[kx] = mhxk;
+ mhy[kx] = mhyk;
+ mhz[kx] = mhzk;
+ m2[kx] = m2k;
+ denom[kx] = m2k*bz*by*pme->bsp_mod[XX][kx];
+ tmp1[kx] = -factor*m2k;
}
- else
+
+ for(kx=maxkx; kx<kxend; kx++)
{
- kxstart = local_offset[XX] + 1;
- p0++;
+ mx = (kx - nx);
+
+ mhxk = mx * rxx;
+ mhyk = mx * ryx + my * ryy;
+ mhzk = mx * rzx + my * rzy + mz * rzz;
+ m2k = mhxk*mhxk + mhyk*mhyk + mhzk*mhzk;
+ mhx[kx] = mhxk;
+ mhy[kx] = mhyk;
+ mhz[kx] = mhzk;
+ m2[kx] = m2k;
+ denom[kx] = m2k*bz*by*pme->bsp_mod[XX][kx];
+ tmp1[kx] = -factor*m2k;
}
- kxend = local_offset[XX] + local_ndata[XX];
-
- if (bEnerVir)
+
+ for(kx=kxstart; kx<kxend; kx++)
{
- /* More expensive inner loop, especially because of the storage
- * of the mh elements in array's.
- * Because x is the minor grid index, all mh elements
- * depend on kx for triclinic unit cells.
- */
+ m2inv[kx] = 1.0/m2[kx];
+ }
- /* Two explicit loops to avoid a conditional inside the loop */
- for(kx=kxstart; kx<maxkx; kx++)
- {
- mx = kx;
-
- mhxk = mx * rxx;
- mhyk = mx * ryx + my * ryy;
- mhzk = mx * rzx + my * rzy + mz * rzz;
- m2k = mhxk*mhxk + mhyk*mhyk + mhzk*mhzk;
- mhx[kx] = mhxk;
- mhy[kx] = mhyk;
- mhz[kx] = mhzk;
- m2[kx] = m2k;
- denom[kx] = m2k*bz*by*pme->bsp_mod[XX][kx];
- tmp1[kx] = -factor*m2k;
- }
-
- for(kx=maxkx; kx<kxend; kx++)
- {
- mx = (kx - nx);
-
- mhxk = mx * rxx;
- mhyk = mx * ryx + my * ryy;
- mhzk = mx * rzx + my * rzy + mz * rzz;
- m2k = mhxk*mhxk + mhyk*mhyk + mhzk*mhzk;
- mhx[kx] = mhxk;
- mhy[kx] = mhyk;
- mhz[kx] = mhzk;
- m2[kx] = m2k;
- denom[kx] = m2k*bz*by*pme->bsp_mod[XX][kx];
- tmp1[kx] = -factor*m2k;
- }
-
- for(kx=kxstart; kx<kxend; kx++)
- {
- m2inv[kx] = 1.0/m2[kx];
- }
- for(kx=kxstart; kx<kxend; kx++)
- {
- denom[kx] = 1.0/denom[kx];
- }
+ calc_exponentials(kxstart,kxend,elfac,denom,tmp1,eterm);
- CALC_EXPONENTIALS(kxstart,kxend,tmp1);
+ for(kx=kxstart; kx<kxend; kx++,p0++)
+ {
+ d1 = p0->re;
+ d2 = p0->im;
- for(kx=kxstart; kx<kxend; kx++,p0++)
- {
- d1 = p0->re;
- d2 = p0->im;
-
- eterm = ONE_4PI_EPS0/pme->epsilon_r*tmp1[kx]*denom[kx];
-
- p0->re = d1*eterm;
- p0->im = d2*eterm;
-
- struct2 = 2.0*(d1*d1+d2*d2);
-
- tmp1[kx] = eterm*struct2;
- }
-
- for(kx=kxstart; kx<kxend; kx++)
- {
- ets2 = corner_fac*tmp1[kx];
- vfactor = (factor*m2[kx] + 1.0)*2.0*m2inv[kx];
- energy += ets2;
-
- ets2vf = ets2*vfactor;
- virxx += ets2vf*mhx[kx]*mhx[kx] - ets2;
- virxy += ets2vf*mhx[kx]*mhy[kx];
- virxz += ets2vf*mhx[kx]*mhz[kx];
- viryy += ets2vf*mhy[kx]*mhy[kx] - ets2;
- viryz += ets2vf*mhy[kx]*mhz[kx];
- virzz += ets2vf*mhz[kx]*mhz[kx] - ets2;
- }
+ p0->re = d1*eterm[kx];
+ p0->im = d2*eterm[kx];
+
+ struct2 = 2.0*(d1*d1+d2*d2);
+
+ tmp1[kx] = eterm[kx]*struct2;
}
- else
+
+ for(kx=kxstart; kx<kxend; kx++)
{
- /* We don't need to calculate the energy and the virial.
- * In this case the triclinic overhead is small.
- */
+ ets2 = corner_fac*tmp1[kx];
+ vfactor = (factor*m2[kx] + 1.0)*2.0*m2inv[kx];
+ energy += ets2;
+
+ ets2vf = ets2*vfactor;
+ virxx += ets2vf*mhx[kx]*mhx[kx] - ets2;
+ virxy += ets2vf*mhx[kx]*mhy[kx];
+ virxz += ets2vf*mhx[kx]*mhz[kx];
+ viryy += ets2vf*mhy[kx]*mhy[kx] - ets2;
+ viryz += ets2vf*mhy[kx]*mhz[kx];
+ virzz += ets2vf*mhz[kx]*mhz[kx] - ets2;
+ }
+ }
+ else
+ {
+ /* We don't need to calculate the energy and the virial.
+ * In this case the triclinic overhead is small.
+ */
- /* Two explicit loops to avoid a conditional inside the loop */
+ /* Two explicit loops to avoid a conditional inside the loop */
- for(kx=kxstart; kx<maxkx; kx++)
- {
- mx = kx;
-
- mhxk = mx * rxx;
- mhyk = mx * ryx + my * ryy;
- mhzk = mx * rzx + my * rzy + mz * rzz;
- m2k = mhxk*mhxk + mhyk*mhyk + mhzk*mhzk;
- denom[kx] = m2k*bz*by*pme->bsp_mod[XX][kx];
- tmp1[kx] = -factor*m2k;
- }
-
- for(kx=maxkx; kx<kxend; kx++)
- {
- mx = (kx - nx);
-
- mhxk = mx * rxx;
- mhyk = mx * ryx + my * ryy;
- mhzk = mx * rzx + my * rzy + mz * rzz;
- m2k = mhxk*mhxk + mhyk*mhyk + mhzk*mhzk;
- denom[kx] = m2k*bz*by*pme->bsp_mod[XX][kx];
- tmp1[kx] = -factor*m2k;
- }
-
- for(kx=kxstart; kx<kxend; kx++)
- {
- denom[kx] = 1.0/denom[kx];
- }
+ for(kx=kxstart; kx<maxkx; kx++)
+ {
+ mx = kx;
+
+ mhxk = mx * rxx;
+ mhyk = mx * ryx + my * ryy;
+ mhzk = mx * rzx + my * rzy + mz * rzz;
+ m2k = mhxk*mhxk + mhyk*mhyk + mhzk*mhzk;
+ denom[kx] = m2k*bz*by*pme->bsp_mod[XX][kx];
+ tmp1[kx] = -factor*m2k;
+ }
- CALC_EXPONENTIALS(kxstart,kxend,tmp1);
-
- for(kx=kxstart; kx<kxend; kx++,p0++)
- {
- d1 = p0->re;
- d2 = p0->im;
-
- eterm = ONE_4PI_EPS0/pme->epsilon_r*tmp1[kx]*denom[kx];
-
- p0->re = d1*eterm;
- p0->im = d2*eterm;
- }
+ for(kx=maxkx; kx<kxend; kx++)
+ {
+ mx = (kx - nx);
+
+ mhxk = mx * rxx;
+ mhyk = mx * ryx + my * ryy;
+ mhzk = mx * rzx + my * rzy + mz * rzz;
+ m2k = mhxk*mhxk + mhyk*mhyk + mhzk*mhzk;
+ denom[kx] = m2k*bz*by*pme->bsp_mod[XX][kx];
+ tmp1[kx] = -factor*m2k;
+ }
+
+ calc_exponentials(kxstart,kxend,elfac,denom,tmp1,eterm);
+
+ for(kx=kxstart; kx<kxend; kx++,p0++)
+ {
+ d1 = p0->re;
+ d2 = p0->im;
+
+ p0->re = d1*eterm[kx];
+ p0->im = d2*eterm[kx];
}
}
}
-
+
if (bEnerVir)
{
/* Update virial with local values.
* experiencing problems on semiisotropic membranes.
* IS THAT COMMENT STILL VALID??? (DvdS, 2001/02/07).
*/
- vir[XX][XX] = 0.25*virxx;
- vir[YY][YY] = 0.25*viryy;
- vir[ZZ][ZZ] = 0.25*virzz;
- vir[XX][YY] = vir[YY][XX] = 0.25*virxy;
- vir[XX][ZZ] = vir[ZZ][XX] = 0.25*virxz;
- vir[YY][ZZ] = vir[ZZ][YY] = 0.25*viryz;
-
+ work->vir[XX][XX] = 0.25*virxx;
+ work->vir[YY][YY] = 0.25*viryy;
+ work->vir[ZZ][ZZ] = 0.25*virzz;
+ work->vir[XX][YY] = work->vir[YY][XX] = 0.25*virxy;
+ work->vir[XX][ZZ] = work->vir[ZZ][XX] = 0.25*virxz;
+ work->vir[YY][ZZ] = work->vir[ZZ][YY] = 0.25*viryz;
+
/* This energy should be corrected for a charged system */
- *mesh_energy = 0.5*energy;
+ work->energy = 0.5*energy;
}
/* Return the loop count */
- return local_ndata[YY]*local_ndata[ZZ]*local_ndata[XX];
+ return local_ndata[YY]*local_ndata[XX];
}
+static void get_pme_ener_vir(const gmx_pme_t pme,int nthread,
+ real *mesh_energy,matrix vir)
+{
+ /* This function sums output over threads
+ * and should therefore only be called after thread synchronization.
+ */
+ int thread;
+
+ *mesh_energy = pme->work[0].energy;
+ copy_mat(pme->work[0].vir,vir);
+
+ for(thread=1; thread<nthread; thread++)
+ {
+ *mesh_energy += pme->work[thread].energy;
+ m_add(vir,pme->work[thread].vir,vir);
+ }
+}
#define DO_FSPLINE(order) \
for(ithx=0; (ithx<order); ithx++) \
-{ \
+{ \
index_x = (i0+ithx)*pny*pnz; \
tx = thx[ithx]; \
dx = dthx[ithx]; \
\
for(ithy=0; (ithy<order); ithy++) \
- { \
+ { \
index_xy = index_x+(j0+ithy)*pnz; \
ty = thy[ithy]; \
dy = dthy[ithy]; \
fxy1 = fz1 = 0; \
\
for(ithz=0; (ithz<order); ithz++) \
- { \
+ { \
gval = grid[index_xy+(k0+ithz)]; \
fxy1 += thz[ithz]*gval; \
fz1 += dthz[ithz]*gval; \
void gather_f_bsplines(gmx_pme_t pme,real *grid,
- gmx_bool bClearF,pme_atomcomm_t *atc,real scale)
+ gmx_bool bClearF,pme_atomcomm_t *atc,
+ splinedata_t *spline,
+ real scale)
{
- /* sum forces for local particles */
+ /* sum forces for local particles */
int nn,n,ithx,ithy,ithz,i0,j0,k0;
int index_x,index_xy;
int nx,ny,nz,pnx,pny,pnz;
int norder;
real rxx,ryx,ryy,rzx,rzy,rzz;
int order;
-
+
+ pme_spline_work_t *work;
+
+ work = &pme->spline_work;
+
order = pme->pme_order;
- thx = atc->theta[XX];
- thy = atc->theta[YY];
- thz = atc->theta[ZZ];
- dthx = atc->dtheta[XX];
- dthy = atc->dtheta[YY];
- dthz = atc->dtheta[ZZ];
+ thx = spline->theta[XX];
+ thy = spline->theta[YY];
+ thz = spline->theta[ZZ];
+ dthx = spline->dtheta[XX];
+ dthy = spline->dtheta[YY];
+ dthz = spline->dtheta[ZZ];
nx = pme->nkx;
ny = pme->nky;
nz = pme->nkz;
pnx = pme->pmegrid_nx;
pny = pme->pmegrid_ny;
pnz = pme->pmegrid_nz;
-
+
rxx = pme->recipbox[XX][XX];
ryx = pme->recipbox[YY][XX];
ryy = pme->recipbox[YY][YY];
rzy = pme->recipbox[ZZ][YY];
rzz = pme->recipbox[ZZ][ZZ];
- for(nn=0; (nn<atc->n); nn++)
+ for(nn=0; nn<spline->n; nn++)
{
- n = nn;
- qn = scale*atc->q[n];
-
- if (bClearF)
+ n = spline->ind[nn];
+ qn = atc->q[n];
+
+ if (bClearF)
{
atc->f[n][XX] = 0;
atc->f[n][YY] = 0;
atc->f[n][ZZ] = 0;
}
- if (qn != 0)
+ if (qn != 0)
{
fx = 0;
fy = 0;
fz = 0;
idxptr = atc->idx[n];
- norder = n*order;
-
- i0 = idxptr[XX];
+ norder = nn*order;
+
+ i0 = idxptr[XX];
j0 = idxptr[YY];
k0 = idxptr[ZZ];
-
+
/* Pointer arithmetic alert, next six statements */
- thx = atc->theta[XX] + norder;
- thy = atc->theta[YY] + norder;
- thz = atc->theta[ZZ] + norder;
- dthx = atc->dtheta[XX] + norder;
- dthy = atc->dtheta[YY] + norder;
- dthz = atc->dtheta[ZZ] + norder;
-
+ thx = spline->theta[XX] + norder;
+ thy = spline->theta[YY] + norder;
+ thz = spline->theta[ZZ] + norder;
+ dthx = spline->dtheta[XX] + norder;
+ dthy = spline->dtheta[YY] + norder;
+ dthz = spline->dtheta[ZZ] + norder;
+
switch (order) {
- case 4: DO_FSPLINE(4); break;
- case 5: DO_FSPLINE(5); break;
- default: DO_FSPLINE(order); break;
+ case 4:
+#ifdef PME_SSE
+#ifdef PME_SSE_UNALIGNED
+#define PME_GATHER_F_SSE_ORDER4
+#else
+#define PME_GATHER_F_SSE_ALIGNED
+#define PME_ORDER 4
+#endif
+#include "pme_sse_single.h"
+#else
+ DO_FSPLINE(4);
+#endif
+ break;
+ case 5:
+#ifdef PME_SSE
+#define PME_GATHER_F_SSE_ALIGNED
+#define PME_ORDER 5
+#include "pme_sse_single.h"
+#else
+ DO_FSPLINE(5);
+#endif
+ break;
+ default:
+ DO_FSPLINE(order);
+ break;
}
atc->f[n][XX] += -qn*( fx*nx*rxx );
*/
}
+
static real gather_energy_bsplines(gmx_pme_t pme,real *grid,
pme_atomcomm_t *atc)
{
+ splinedata_t *spline;
int n,ithx,ithy,ithz,i0,j0,k0;
int index_x,index_xy;
int * idxptr;
real *thx,*thy,*thz;
int norder;
int order;
-
-
+
+ spline = &atc->spline[0];
+
order = pme->pme_order;
-
+
energy = 0;
for(n=0; (n<atc->n); n++) {
qn = atc->q[n];
-
+
if (qn != 0) {
idxptr = atc->idx[n];
norder = n*order;
-
- i0 = idxptr[XX];
+
+ i0 = idxptr[XX];
j0 = idxptr[YY];
k0 = idxptr[ZZ];
-
+
/* Pointer arithmetic alert, next three statements */
- thx = atc->theta[XX] + norder;
- thy = atc->theta[YY] + norder;
- thz = atc->theta[ZZ] + norder;
+ thx = spline->theta[XX] + norder;
+ thy = spline->theta[YY] + norder;
+ thz = spline->theta[ZZ] + norder;
pot = 0;
for(ithx=0; (ithx<order); ithx++)
return energy;
}
+/* Macro to force loop unrolling by fixing order.
+ * This gives a significant performance gain.
+ */
+#define CALC_SPLINE(order) \
+{ \
+ int j,k,l; \
+ real dr,div; \
+ real data[PME_ORDER_MAX]; \
+ real ddata[PME_ORDER_MAX]; \
+ \
+ for(j=0; (j<DIM); j++) \
+ { \
+ dr = xptr[j]; \
+ \
+ /* dr is relative offset from lower cell limit */ \
+ data[order-1] = 0; \
+ data[1] = dr; \
+ data[0] = 1 - dr; \
+ \
+ for(k=3; (k<order); k++) \
+ { \
+ div = 1.0/(k - 1.0); \
+ data[k-1] = div*dr*data[k-2]; \
+ for(l=1; (l<(k-1)); l++) \
+ { \
+ data[k-l-1] = div*((dr+l)*data[k-l-2]+(k-l-dr)* \
+ data[k-l-1]); \
+ } \
+ data[0] = div*(1-dr)*data[0]; \
+ } \
+ /* differentiate */ \
+ ddata[0] = -data[0]; \
+ for(k=1; (k<order); k++) \
+ { \
+ ddata[k] = data[k-1] - data[k]; \
+ } \
+ \
+ div = 1.0/(order - 1); \
+ data[order-1] = div*dr*data[order-2]; \
+ for(l=1; (l<(order-1)); l++) \
+ { \
+ data[order-l-1] = div*((dr+l)*data[order-l-2]+ \
+ (order-l-dr)*data[order-l-1]); \
+ } \
+ data[0] = div*(1 - dr)*data[0]; \
+ \
+ for(k=0; k<order; k++) \
+ { \
+ theta[j][i*order+k] = data[k]; \
+ dtheta[j][i*order+k] = ddata[k]; \
+ } \
+ } \
+}
+
void make_bsplines(splinevec theta,splinevec dtheta,int order,
- rvec fractx[],int nr,real charge[],
+ rvec fractx[],int nr,int ind[],real charge[],
gmx_bool bFreeEnergy)
{
/* construct splines for local atoms */
- int i,j,k,l;
- real dr,div;
- real *data,*ddata,*xptr;
-
- for(i=0; (i<nr); i++) {
+ int i,ii;
+ real *xptr;
+
+ for(i=0; i<nr; i++)
+ {
/* With free energy we do not use the charge check.
* In most cases this will be more efficient than calling make_bsplines
* twice, since usually more than half the particles have charges.
*/
- if (bFreeEnergy || charge[i] != 0.0) {
- xptr = fractx[i];
- for(j=0; (j<DIM); j++) {
- dr = xptr[j];
-
- /* dr is relative offset from lower cell limit */
- data=&(theta[j][i*order]);
- data[order-1]=0;
- data[1]=dr;
- data[0]=1-dr;
-
- for(k=3; (k<order); k++) {
- div=1.0/(k-1.0);
- data[k-1]=div*dr*data[k-2];
- for(l=1; (l<(k-1)); l++) {
- data[k-l-1]=div*((dr+l)*data[k-l-2]+(k-l-dr)*
- data[k-l-1]);
- }
- data[0]=div*(1-dr)*data[0];
- }
- /* differentiate */
- ddata = &(dtheta[j][i*order]);
- ddata[0] = -data[0];
- for(k=1; (k<order); k++) {
- ddata[k]=data[k-1]-data[k];
- }
-
- div=1.0/(order-1);
- data[order-1]=div*dr*data[order-2];
- for(l=1; (l<(order-1)); l++) {
- data[order-l-1]=div*((dr+l)*data[order-l-2]+
- (order-l-dr)*data[order-l-1]);
- }
- data[0]=div*(1-dr)*data[0];
+ ii = ind[i];
+ if (bFreeEnergy || charge[ii] != 0.0) {
+ xptr = fractx[ii];
+ switch(order) {
+ case 4: CALC_SPLINE(4); break;
+ case 5: CALC_SPLINE(5); break;
+ default: CALC_SPLINE(order); break;
}
}
}
{
int i,j;
real sc,ss,arg;
-
+
for(i=0;i<ndata;i++) {
sc=ss=0;
for(j=0;j<ndata;j++) {
real *data,*ddata,*bsp_data;
int i,k,l;
real div;
-
+
snew(data,order);
snew(ddata,order);
snew(bsp_data,nmax);
data[order-1]=0;
data[1]=0;
data[0]=1;
-
+
for(k=3;k<order;k++) {
div=1.0/(k-1.0);
data[k-1]=0;
data[order-1]=0;
for(l=1;l<(order-1);l++)
data[order-l-1]=div*(l*data[order-l-2]+(order-l)*data[order-l-1]);
- data[0]=div*data[0];
+ data[0]=div*data[0];
for(i=0;i<nmax;i++)
bsp_data[i]=0;
for(i=1;i<=order;i++)
bsp_data[i]=data[i-1];
-
+
make_dft_mod(bsp_mod[XX],bsp_data,nx);
make_dft_mod(bsp_mod[YY],bsp_data,ny);
make_dft_mod(bsp_mod[ZZ],bsp_data,nz);
atc->node_dest[n] = fw;
atc->node_src[n] = bw;
n++;
- }
+ }
if (n < nslab - 1) {
atc->node_dest[n] = bw;
atc->node_src[n] = fw;
int gmx_pme_destroy(FILE *log,gmx_pme_t *pmedata)
{
+ int thread;
+
if(NULL != log)
{
fprintf(log,"Destroying PME data structures.\n");
sfree((*pmedata)->nnx);
sfree((*pmedata)->nny);
sfree((*pmedata)->nnz);
-
- sfree((*pmedata)->pmegridA);
+
+ pmegrids_destroy(&(*pmedata)->pmegridA);
+
sfree((*pmedata)->fftgridA);
sfree((*pmedata)->cfftgridA);
gmx_parallel_3dfft_destroy((*pmedata)->pfft_setupA);
-
- if((*pmedata)->pmegridB)
+
+ if ((*pmedata)->pmegridB.grid.grid != NULL)
{
- sfree((*pmedata)->pmegridB);
+ pmegrids_destroy(&(*pmedata)->pmegridB);
sfree((*pmedata)->fftgridB);
sfree((*pmedata)->cfftgridB);
gmx_parallel_3dfft_destroy((*pmedata)->pfft_setupB);
}
- sfree((*pmedata)->work_mhz);
- sfree((*pmedata)->work_m2);
- sfree((*pmedata)->work_denom);
- sfree((*pmedata)->work_tmp1_alloc);
- sfree((*pmedata)->work_m2inv);
-
+ for(thread=0; thread<(*pmedata)->nthread; thread++)
+ {
+ free_work(&(*pmedata)->work[thread]);
+ }
+ sfree((*pmedata)->work);
+
sfree(*pmedata);
*pmedata = NULL;
-
+
return 0;
}
static void init_atomcomm(gmx_pme_t pme,pme_atomcomm_t *atc, t_commrec *cr,
int dimind,gmx_bool bSpread)
{
- int nk,k,s;
+ int nk,k,s,thread;
atc->dimind = dimind;
atc->nslab = 1;
snew(atc->node_dest,atc->nslab);
snew(atc->node_src,atc->nslab);
setup_coordinate_communication(atc);
-
- snew(atc->count,atc->nslab);
+
+ snew(atc->count_thread,pme->nthread);
+ for(thread=0; thread<pme->nthread; thread++)
+ {
+ snew(atc->count_thread[thread],atc->nslab);
+ }
+ atc->count = atc->count_thread[0];
snew(atc->rcount,atc->nslab);
snew(atc->buf_index,atc->nslab);
}
-}
-static void
-init_overlap_comm(pme_overlap_t * ol,
+ atc->nthread = pme->nthread;
+ if (atc->nthread > 1)
+ {
+ snew(atc->thread_plist,atc->nthread);
+ }
+ snew(atc->spline,atc->nthread);
+ for(thread=0; thread<atc->nthread; thread++)
+ {
+ if (atc->nthread > 1)
+ {
+ snew(atc->thread_plist[thread].n,atc->nthread+2*GMX_CACHE_SEP);
+ atc->thread_plist[thread].n += GMX_CACHE_SEP;
+ }
+ }
+}
+
+static void
+init_overlap_comm(pme_overlap_t * ol,
int norder,
#ifdef GMX_MPI
- MPI_Comm comm,
+ MPI_Comm comm,
#endif
- int nnodes,
+ int nnodes,
int nodeid,
- int ndata)
+ int ndata,
+ int commplainsize)
{
int lbnd,rbnd,maxlr,b,i;
int exten;
pme_grid_comm_t *pgc;
gmx_bool bCont;
int fft_start,fft_end,send_index1,recv_index1;
-
+
#ifdef GMX_MPI
ol->mpi_comm = comm;
#endif
-
+
ol->nnodes = nnodes;
ol->nodeid = nodeid;
snew(ol->s2g0,ol->nnodes+1);
snew(ol->s2g1,ol->nnodes);
if (debug) { fprintf(debug,"PME slab boundaries:"); }
- for(i=0; i<nnodes; i++)
+ for(i=0; i<nnodes; i++)
{
/* s2g0 the local interpolation grid start.
* s2g1 the local interpolation grid end.
pgc->recv_index0 = fft_start;
pgc->recv_nindex = max(0,recv_index1 - pgc->recv_index0);
}
+
+ /* For non-divisible grid we need pme_order iso pme_order-1 */
+ snew(ol->sendbuf,norder*commplainsize);
+ snew(ol->recvbuf,norder*commplainsize);
}
static void
if (gtl[i] == n-1)
{
gtl[i] = 0;
- fsh[i] = -1;
+ fsh[i] = -1;
}
else if (gtl[i] == local_range)
{
*fraction_shift = fsh;
}
+static void sse_mask_init(pme_spline_work_t *work,int order)
+{
+#ifdef PME_SSE
+ float tmp[8];
+ __m128 zero_SSE;
+ int of,i;
+
+ zero_SSE = _mm_setzero_ps();
+
+ for(of=0; of<8-(order-1); of++)
+ {
+ for(i=0; i<8; i++)
+ {
+ tmp[i] = (i >= of && i < of+order ? 1 : 0);
+ }
+ work->mask_SSE0[of] = _mm_loadu_ps(tmp);
+ work->mask_SSE1[of] = _mm_loadu_ps(tmp+4);
+ work->mask_SSE0[of] = _mm_cmpgt_ps(work->mask_SSE0[of],zero_SSE);
+ work->mask_SSE1[of] = _mm_cmpgt_ps(work->mask_SSE1[of],zero_SSE);
+ }
+#endif
+}
+
static void
gmx_pme_check_grid_restrictions(FILE *fplog,char dim,int nnodes,int *nk)
{
gmx_fatal(FARGS,"The PME grid size in dim %c (%d) is not divisble by the number of nodes doing PME in dim %c (%d). The grid size would have to be increased by more than 50%% to make the grid divisible. Change the total number of nodes or the number of domain decomposition cells in x or the PME grid %c dimension (and the cut-off).",
dim,*nk,dim,nnodes,dim);
}
-
+
if (fplog != NULL)
{
fprintf(fplog,"\nNOTE: The PME grid size in dim %c (%d) is not divisble by the number of nodes doing PME in dim %c (%d). Increasing the PME grid size in dim %c to %d. This will increase the accuracy and will not decrease the performance significantly on this number of nodes. For optimal performance change the total number of nodes or the number of domain decomposition cells in x or the PME grid %c dimension (and the cut-off).\n\n",
dim,*nk,dim,nnodes,dim,nk_new,dim);
}
-
+
*nk = nk_new;
}
}
int nnodes_minor,
t_inputrec * ir,
int homenr,
- gmx_bool bFreeEnergy,
- gmx_bool bReproducible)
+ gmx_bool bFreeEnergy,
+ gmx_bool bReproducible,
+ int nthread)
{
gmx_pme_t pme=NULL;
-
+
pme_atomcomm_t *atc;
- int bufsizex,bufsizey,bufsize;
ivec ndata;
-
+
if (debug)
fprintf(debug,"Creating PME data structures.\n");
snew(pme,1);
-
+
pme->redist_init = FALSE;
pme->sum_qgrid_tmp = NULL;
pme->sum_qgrid_dd_tmp = NULL;
pme->buf_nalloc = 0;
pme->redist_buf_nalloc = 0;
-
+
pme->nnodes = 1;
pme->bPPnode = TRUE;
-
+
pme->nnodes_major = nnodes_major;
pme->nnodes_minor = nnodes_minor;
#ifdef GMX_MPI
- if (nnodes_major*nnodes_minor > 1 && PAR(cr))
+ if (PAR(cr))
{
pme->mpi_comm = cr->mpi_comm_mygroup;
-
+
MPI_Comm_rank(pme->mpi_comm,&pme->nodeid);
MPI_Comm_size(pme->mpi_comm,&pme->nnodes);
- if (pme->nnodes != nnodes_major*nnodes_minor)
- {
- gmx_incons("PME node count mismatch");
- }
}
#endif
pme->ndecompdim = 0;
pme->nodeid_major = 0;
pme->nodeid_minor = 0;
+#ifdef GMX_MPI
+ pme->mpi_comm_d[0] = pme->mpi_comm_d[1] = MPI_COMM_NULL;
+#endif
}
else
{
{
#ifdef GMX_MPI
pme->mpi_comm_d[0] = pme->mpi_comm;
- pme->mpi_comm_d[1] = NULL;
+ pme->mpi_comm_d[1] = MPI_COMM_NULL;
#endif
pme->ndecompdim = 1;
pme->nodeid_major = pme->nodeid;
pme->nodeid_minor = 0;
-
+
}
else if (nnodes_major == 1)
{
#ifdef GMX_MPI
- pme->mpi_comm_d[0] = NULL;
+ pme->mpi_comm_d[0] = MPI_COMM_NULL;
pme->mpi_comm_d[1] = pme->mpi_comm;
#endif
pme->ndecompdim = 1;
pme->nodeid_major = 0;
pme->nodeid_minor = pme->nodeid;
}
- else
+ else
{
if (pme->nnodes % nnodes_major != 0)
{
gmx_incons("For 2D PME decomposition, #PME nodes must be divisible by the number of nodes in the major dimension");
}
pme->ndecompdim = 2;
-
+
#ifdef GMX_MPI
MPI_Comm_split(pme->mpi_comm,pme->nodeid % nnodes_minor,
pme->nodeid,&pme->mpi_comm_d[0]); /* My communicator along major dimension */
MPI_Comm_split(pme->mpi_comm,pme->nodeid/nnodes_minor,
pme->nodeid,&pme->mpi_comm_d[1]); /* My communicator along minor dimension */
-
+
MPI_Comm_rank(pme->mpi_comm_d[0],&pme->nodeid_major);
MPI_Comm_size(pme->mpi_comm_d[0],&pme->nnodes_major);
MPI_Comm_rank(pme->mpi_comm_d[1],&pme->nodeid_minor);
}
pme->bPPnode = (cr->duty & DUTY_PP);
}
-
+
+ pme->nthread = nthread;
+
if (ir->ePBC == epbcSCREW)
{
gmx_fatal(FARGS,"pme does not (yet) work with pbc = screw");
}
-
+
pme->bFEP = ((ir->efep != efepNO) && bFreeEnergy);
pme->nkx = ir->nkx;
pme->nky = ir->nky;
pme->nkz = ir->nkz;
pme->pme_order = ir->pme_order;
pme->epsilon_r = ir->epsilon_r;
-
+
+ if (pme->pme_order > PME_ORDER_MAX)
+ {
+ gmx_fatal(FARGS,"pme_order (%d) is larger than the maximum allowed value (%d). Modify and recompile the code if you really need such a high order.",
+ pme->pme_order,PME_ORDER_MAX);
+ }
+
/* Currently pme.c supports only the fft5d FFT code.
* Therefore the grid always needs to be divisible by nnodes.
* When the old 1D code is also supported again, change this check.
pme->nky <= pme->pme_order*(pme->nnodes_minor > 1 ? 2 : 1) ||
pme->nkz <= pme->pme_order)
{
- gmx_fatal(FARGS,"The pme grid dimensions need to be larger than pme_order (%d) and in parallel larger than 2*pme_order for x and/or y",pme->pme_order);
+ gmx_fatal(FARGS,"The pme grid dimensions need to be larger than pme_order (%d) and in parallel larger than 2*pme_ordern for x and/or y",pme->pme_order);
}
if (pme->nnodes > 1) {
MPI_Type_contiguous(DIM, mpi_type, &(pme->rvec_mpi));
MPI_Type_commit(&(pme->rvec_mpi));
#endif
-
+
/* Note that the charge spreading and force gathering, which usually
* takes about the same amount of time as FFT+solve_pme,
* is always fully load balanced
* (unless the charge distribution is inhomogeneous).
*/
-
+
imbal = pme_load_imbalance(pme);
if (imbal >= 1.2 && pme->nodeid_major == 0 && pme->nodeid_minor == 0)
{
}
}
+ /* For non-divisible grid we need pme_order iso pme_order-1 */
+ /* In sum_qgrid_dd x overlap is copied in place: take padding into account.
+ * y is always copied through a buffer: we don't need padding in z,
+ * but we do need the overlap in x because of the communication order.
+ */
init_overlap_comm(&pme->overlap[0],pme->pme_order,
#ifdef GMX_MPI
pme->mpi_comm_d[0],
#endif
- pme->nnodes_major,pme->nodeid_major,pme->nkx);
-
+ pme->nnodes_major,pme->nodeid_major,
+ pme->nkx,
+ (div_round_up(pme->nky,pme->nnodes_minor)+pme->pme_order)*(pme->nkz+pme->pme_order-1));
+
init_overlap_comm(&pme->overlap[1],pme->pme_order,
#ifdef GMX_MPI
pme->mpi_comm_d[1],
#endif
- pme->nnodes_minor,pme->nodeid_minor,pme->nky);
-
+ pme->nnodes_minor,pme->nodeid_minor,
+ pme->nky,
+ (div_round_up(pme->nkx,pme->nnodes_major)+pme->pme_order)*pme->nkz);
+
+ /* Check for a limitation of the (current) sum_fftgrid_dd code */
+ if (pme->nthread > 1 &&
+ (pme->overlap[0].noverlap_nodes > 1 ||
+ pme->overlap[1].noverlap_nodes > 1))
+ {
+ gmx_fatal(FARGS,"With threads the number of grid lines per node along x and or y should be pme_order (%d) or more or exactly pme_order-1",pme->pme_order);
+ }
+
snew(pme->bsp_mod[XX],pme->nkx);
snew(pme->bsp_mod[YY],pme->nky);
snew(pme->bsp_mod[ZZ],pme->nkz);
-
- /* Allocate data for the interpolation grid, including overlap */
+
+ /* The required size of the interpolation grid, including overlap.
+ * The allocated size (pmegrid_n?) might be slightly larger.
+ */
pme->pmegrid_nx = pme->overlap[0].s2g1[pme->nodeid_major] -
pme->overlap[0].s2g0[pme->nodeid_major];
- pme->pmegrid_ny = pme->overlap[1].s2g1[pme->nodeid_minor] -
+ pme->pmegrid_ny = pme->overlap[1].s2g1[pme->nodeid_minor] -
pme->overlap[1].s2g0[pme->nodeid_minor];
- pme->pmegrid_nz = pme->nkz + pme->pme_order - 1;
-
+ pme->pmegrid_nz_base = pme->nkz;
+ pme->pmegrid_nz = pme->pmegrid_nz_base + pme->pme_order - 1;
+ set_grid_alignment(&pme->pmegrid_nz,pme->pme_order);
+
pme->pmegrid_start_ix = pme->overlap[0].s2g0[pme->nodeid_major];
pme->pmegrid_start_iy = pme->overlap[1].s2g0[pme->nodeid_minor];
pme->pmegrid_start_iz = 0;
-
+
make_gridindex5_to_localindex(pme->nkx,
pme->pmegrid_start_ix,
pme->pmegrid_nx - (pme->pme_order-1),
&pme->nny,&pme->fshy);
make_gridindex5_to_localindex(pme->nkz,
pme->pmegrid_start_iz,
- pme->pmegrid_nz - (pme->pme_order-1),
+ pme->pmegrid_nz_base,
&pme->nnz,&pme->fshz);
-
- snew(pme->pmegridA,pme->pmegrid_nx*pme->pmegrid_ny*pme->pmegrid_nz);
-
- /* For non-divisible grid we need pme_order iso pme_order-1 */
- /* x overlap is copied in place: take padding into account.
- * y is always copied through a buffer: we don't need padding in z,
- * but we do need the overlap in x because of the communication order.
- */
- bufsizex = pme->pme_order*pme->pmegrid_ny*pme->pmegrid_nz;
- bufsizey = pme->pme_order*pme->pmegrid_nx*pme->nkz;
- bufsize = (bufsizex>bufsizey) ? bufsizex : bufsizey;
-
- snew(pme->pmegrid_sendbuf,bufsize);
- snew(pme->pmegrid_recvbuf,bufsize);
-
+
+ pmegrids_init(&pme->pmegridA,
+ pme->pmegrid_nx,pme->pmegrid_ny,pme->pmegrid_nz,
+ pme->pmegrid_nz_base,
+ pme->pme_order,
+ pme->nthread,
+ pme->overlap[0].s2g1[pme->nodeid_major]-pme->overlap[0].s2g0[pme->nodeid_major+1],
+ pme->overlap[1].s2g1[pme->nodeid_minor]-pme->overlap[1].s2g0[pme->nodeid_minor+1]);
+
+ sse_mask_init(&pme->spline_work,pme->pme_order);
+
ndata[0] = pme->nkx;
ndata[1] = pme->nky;
ndata[2] = pme->nkz;
-
+
/* This routine will allocate the grid data to fit the FFTs */
gmx_parallel_3dfft_init(&pme->pfft_setupA,ndata,
&pme->fftgridA,&pme->cfftgridA,
pme->mpi_comm_d,
pme->overlap[0].s2g0,pme->overlap[1].s2g0,
- bReproducible);
-
+ bReproducible,pme->nthread);
+
if (bFreeEnergy)
{
- snew(pme->pmegridB,pme->pmegrid_nx*pme->pmegrid_ny*pme->pmegrid_nz);
+ pmegrids_init(&pme->pmegridB,
+ pme->pmegrid_nx,pme->pmegrid_ny,pme->pmegrid_nz,
+ pme->pmegrid_nz_base,
+ pme->pme_order,
+ pme->nthread,
+ pme->nkx % pme->nnodes_major != 0,
+ pme->nky % pme->nnodes_minor != 0);
+
gmx_parallel_3dfft_init(&pme->pfft_setupB,ndata,
&pme->fftgridB,&pme->cfftgridB,
pme->mpi_comm_d,
pme->overlap[0].s2g0,pme->overlap[1].s2g0,
- bReproducible);
- } else
+ bReproducible,pme->nthread);
+ }
+ else
{
- pme->pmegridB = NULL;
- pme->fftgridB = NULL;
- pme->cfftgridB = NULL;
+ pme->pmegridB.grid.grid = NULL;
+ pme->fftgridB = NULL;
+ pme->cfftgridB = NULL;
}
-
+
make_bspline_moduli(pme->bsp_mod,pme->nkx,pme->nky,pme->nkz,pme->pme_order);
-
+
/* Use atc[0] for spreading */
init_atomcomm(pme,&pme->atc[0],cr,nnodes_major > 1 ? 0 : 1,TRUE);
if (pme->ndecompdim >= 2)
{
init_atomcomm(pme,&pme->atc[1],cr,1,FALSE);
}
-
+
if (pme->nnodes == 1) {
pme->atc[0].n = homenr;
pme_realloc_atomcomm_things(&pme->atc[0]);
}
-
- /* Use fft5d, order after FFT is y major, z, x minor */
- pme->work_nalloc = pme->nkx;
- snew(pme->work_mhx,pme->work_nalloc);
- snew(pme->work_mhy,pme->work_nalloc);
- snew(pme->work_mhz,pme->work_nalloc);
- snew(pme->work_m2,pme->work_nalloc);
- snew(pme->work_denom,pme->work_nalloc);
- /* Allocate an aligned pointer for SSE operations, including 3 extra
- * elements at the end since SSE operates on 4 elements at a time.
- */
- snew(pme->work_tmp1_alloc,pme->work_nalloc+8);
- pme->work_tmp1 = (real *) (((size_t) pme->work_tmp1_alloc + 16) & (~((size_t) 15)));
- snew(pme->work_m2inv,pme->work_nalloc);
+
+ {
+ int thread;
+
+ /* Use fft5d, order after FFT is y major, z, x minor */
+
+ snew(pme->work,pme->nthread);
+ for(thread=0; thread<pme->nthread; thread++)
+ {
+ realloc_work(&pme->work[thread],pme->nkx);
+ }
+ }
*pmedata = pme;
-
+
return 0;
}
+
+static void copy_local_grid(gmx_pme_t pme,
+ pmegrids_t *pmegrids,int thread,real *fftgrid)
+{
+ ivec local_fft_ndata,local_fft_offset,local_fft_size;
+ int fft_my,fft_mz;
+ int nsx,nsy,nsz;
+ ivec nf;
+ int offx,offy,offz,x,y,z,i0,i0t;
+ int d;
+ pmegrid_t *pmegrid;
+ real *grid_th;
+
+ gmx_parallel_3dfft_real_limits(pme->pfft_setupA,
+ local_fft_ndata,
+ local_fft_offset,
+ local_fft_size);
+ fft_my = local_fft_size[YY];
+ fft_mz = local_fft_size[ZZ];
+
+ pmegrid = &pmegrids->grid_th[thread];
+
+ nsx = pmegrid->n[XX];
+ nsy = pmegrid->n[YY];
+ nsz = pmegrid->n[ZZ];
+
+ for(d=0; d<DIM; d++)
+ {
+ nf[d] = min(pmegrid->n[d] - (pmegrid->order - 1),
+ local_fft_ndata[d] - pmegrid->offset[d]);
+ }
+
+ offx = pmegrid->offset[XX];
+ offy = pmegrid->offset[YY];
+ offz = pmegrid->offset[ZZ];
+
+ /* Directly copy the non-overlapping parts of the local grids.
+ * This also initializes the full grid.
+ */
+ grid_th = pmegrid->grid;
+ for(x=0; x<nf[XX]; x++)
+ {
+ for(y=0; y<nf[YY]; y++)
+ {
+ i0 = ((offx + x)*fft_my + (offy + y))*fft_mz + offz;
+ i0t = (x*nsy + y)*nsz;
+ for(z=0; z<nf[ZZ]; z++)
+ {
+ fftgrid[i0+z] = grid_th[i0t+z];
+ }
+ }
+ }
+}
+
+static void print_sendbuf(gmx_pme_t pme,real *sendbuf)
+{
+ ivec local_fft_ndata,local_fft_offset,local_fft_size;
+ pme_overlap_t *overlap;
+ int datasize,nind;
+ int i,x,y,z,n;
+
+ gmx_parallel_3dfft_real_limits(pme->pfft_setupA,
+ local_fft_ndata,
+ local_fft_offset,
+ local_fft_size);
+ /* Major dimension */
+ overlap = &pme->overlap[0];
+
+ nind = overlap->comm_data[0].send_nindex;
+
+ for(y=0; y<local_fft_ndata[YY]; y++) {
+ printf(" %2d",y);
+ }
+ printf("\n");
+
+ i = 0;
+ for(x=0; x<nind; x++) {
+ for(y=0; y<local_fft_ndata[YY]; y++) {
+ n = 0;
+ for(z=0; z<local_fft_ndata[ZZ]; z++) {
+ if (sendbuf[i] != 0) n++;
+ i++;
+ }
+ printf(" %2d",n);
+ }
+ printf("\n");
+ }
+}
+
+static void
+reduce_threadgrid_overlap(gmx_pme_t pme,
+ const pmegrids_t *pmegrids,int thread,
+ real *fftgrid,real *commbuf_x,real *commbuf_y)
+{
+ ivec local_fft_ndata,local_fft_offset,local_fft_size;
+ int fft_nx,fft_ny,fft_nz;
+ int fft_my,fft_mz;
+ int buf_my=-1;
+ int nsx,nsy,nsz;
+ ivec ne;
+ int offx,offy,offz,x,y,z,i0,i0t;
+ int sx,sy,sz,fx,fy,fz,tx1,ty1,tz1,ox,oy,oz;
+ gmx_bool bClearBufX,bClearBufY,bClearBufXY,bClearBuf;
+ gmx_bool bCommX,bCommY;
+ int d;
+ int thread_f;
+ const pmegrid_t *pmegrid,*pmegrid_g,*pmegrid_f;
+ const real *grid_th;
+ real *commbuf=NULL;
+
+ gmx_parallel_3dfft_real_limits(pme->pfft_setupA,
+ local_fft_ndata,
+ local_fft_offset,
+ local_fft_size);
+ fft_nx = local_fft_ndata[XX];
+ fft_ny = local_fft_ndata[YY];
+ fft_nz = local_fft_ndata[ZZ];
+
+ fft_my = local_fft_size[YY];
+ fft_mz = local_fft_size[ZZ];
+
+ /* This routine is called when all thread have finished spreading.
+ * Here each thread sums grid contributions calculated by other threads
+ * to the thread local grid volume.
+ * To minimize the number of grid copying operations,
+ * this routines sums immediately from the pmegrid to the fftgrid.
+ */
+
+ /* Determine which part of the full node grid we should operate on,
+ * this is our thread local part of the full grid.
+ */
+ pmegrid = &pmegrids->grid_th[thread];
+
+ for(d=0; d<DIM; d++)
+ {
+ ne[d] = min(pmegrid->offset[d]+pmegrid->n[d]-(pmegrid->order-1),
+ local_fft_ndata[d]);
+ }
+
+ offx = pmegrid->offset[XX];
+ offy = pmegrid->offset[YY];
+ offz = pmegrid->offset[ZZ];
+
+
+ bClearBufX = TRUE;
+ bClearBufY = TRUE;
+ bClearBufXY = TRUE;
+
+ /* Now loop over all the thread data blocks that contribute
+ * to the grid region we (our thread) are operating on.
+ */
+ /* Note that ffy_nx/y is equal to the number of grid points
+ * between the first point of our node grid and the one of the next node.
+ */
+ for(sx=0; sx>=-pmegrids->nthread_comm[XX]; sx--)
+ {
+ fx = pmegrid->ci[XX] + sx;
+ ox = 0;
+ bCommX = FALSE;
+ if (fx < 0) {
+ fx += pmegrids->nc[XX];
+ ox -= fft_nx;
+ bCommX = (pme->nnodes_major > 1);
+ }
+ pmegrid_g = &pmegrids->grid_th[fx*pmegrids->nc[YY]*pmegrids->nc[ZZ]];
+ ox += pmegrid_g->offset[XX];
+ if (!bCommX)
+ {
+ tx1 = min(ox + pmegrid_g->n[XX],ne[XX]);
+ }
+ else
+ {
+ tx1 = min(ox + pmegrid_g->n[XX],pme->pme_order);
+ }
+
+ for(sy=0; sy>=-pmegrids->nthread_comm[YY]; sy--)
+ {
+ fy = pmegrid->ci[YY] + sy;
+ oy = 0;
+ bCommY = FALSE;
+ if (fy < 0) {
+ fy += pmegrids->nc[YY];
+ oy -= fft_ny;
+ bCommY = (pme->nnodes_minor > 1);
+ }
+ pmegrid_g = &pmegrids->grid_th[fy*pmegrids->nc[ZZ]];
+ oy += pmegrid_g->offset[YY];
+ if (!bCommY)
+ {
+ ty1 = min(oy + pmegrid_g->n[YY],ne[YY]);
+ }
+ else
+ {
+ ty1 = min(oy + pmegrid_g->n[YY],pme->pme_order);
+ }
+
+ for(sz=0; sz>=-pmegrids->nthread_comm[ZZ]; sz--)
+ {
+ fz = pmegrid->ci[ZZ] + sz;
+ oz = 0;
+ if (fz < 0)
+ {
+ fz += pmegrids->nc[ZZ];
+ oz -= fft_nz;
+ }
+ pmegrid_g = &pmegrids->grid_th[fz];
+ oz += pmegrid_g->offset[ZZ];
+ tz1 = min(oz + pmegrid_g->n[ZZ],ne[ZZ]);
+
+ if (sx == 0 && sy == 0 && sz == 0)
+ {
+ /* We have already added our local contribution
+ * before calling this routine, so skip it here.
+ */
+ continue;
+ }
+
+ thread_f = (fx*pmegrids->nc[YY] + fy)*pmegrids->nc[ZZ] + fz;
+
+ pmegrid_f = &pmegrids->grid_th[thread_f];
+
+ grid_th = pmegrid_f->grid;
+
+ nsx = pmegrid_f->n[XX];
+ nsy = pmegrid_f->n[YY];
+ nsz = pmegrid_f->n[ZZ];
+
+#ifdef DEBUG_PME_REDUCE
+ printf("n%d t%d add %d %2d %2d %2d %2d %2d %2d %2d-%2d %2d-%2d, %2d-%2d %2d-%2d, %2d-%2d %2d-%2d\n",
+ pme->nodeid,thread,thread_f,
+ pme->pmegrid_start_ix,
+ pme->pmegrid_start_iy,
+ pme->pmegrid_start_iz,
+ sx,sy,sz,
+ offx-ox,tx1-ox,offx,tx1,
+ offy-oy,ty1-oy,offy,ty1,
+ offz-oz,tz1-oz,offz,tz1);
+#endif
+
+ if (!(bCommX || bCommY))
+ {
+ /* Copy from the thread local grid to the node grid */
+ for(x=offx; x<tx1; x++)
+ {
+ for(y=offy; y<ty1; y++)
+ {
+ i0 = (x*fft_my + y)*fft_mz;
+ i0t = ((x - ox)*nsy + (y - oy))*nsz - oz;
+ for(z=offz; z<tz1; z++)
+ {
+ fftgrid[i0+z] += grid_th[i0t+z];
+ }
+ }
+ }
+ }
+ else
+ {
+ /* The order of this conditional decides
+ * where the corner volume gets stored with x+y decomp.
+ */
+ if (bCommY)
+ {
+ commbuf = commbuf_y;
+ buf_my = ty1 - offy;
+ if (bCommX)
+ {
+ /* We index commbuf modulo the local grid size */
+ commbuf += buf_my*fft_nx*fft_nz;
+
+ bClearBuf = bClearBufXY;
+ bClearBufXY = FALSE;
+ }
+ else
+ {
+ bClearBuf = bClearBufY;
+ bClearBufY = FALSE;
+ }
+ }
+ else
+ {
+ commbuf = commbuf_x;
+ buf_my = fft_ny;
+ bClearBuf = bClearBufX;
+ bClearBufX = FALSE;
+ }
+
+ /* Copy to the communication buffer */
+ for(x=offx; x<tx1; x++)
+ {
+ for(y=offy; y<ty1; y++)
+ {
+ i0 = (x*buf_my + y)*fft_nz;
+ i0t = ((x - ox)*nsy + (y - oy))*nsz - oz;
+
+ if (bClearBuf)
+ {
+ /* First access of commbuf, initialize it */
+ for(z=offz; z<tz1; z++)
+ {
+ commbuf[i0+z] = grid_th[i0t+z];
+ }
+ }
+ else
+ {
+ for(z=offz; z<tz1; z++)
+ {
+ commbuf[i0+z] += grid_th[i0t+z];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+
+static void sum_fftgrid_dd(gmx_pme_t pme,real *fftgrid)
+{
+ ivec local_fft_ndata,local_fft_offset,local_fft_size;
+ pme_overlap_t *overlap;
+ int send_nindex;
+ int recv_index0,recv_nindex;
+#ifdef GMX_MPI
+ MPI_Status stat;
+#endif
+ int ipulse,send_id,recv_id,datasize,gridsize,size_yx;
+ real *sendptr,*recvptr;
+ int x,y,z,indg,indb;
+
+ /* Note that this routine is only used for forward communication.
+ * Since the force gathering, unlike the charge spreading,
+ * can be trivially parallelized over the particles,
+ * the backwards process is much simpler and can use the "old"
+ * communication setup.
+ */
+
+ gmx_parallel_3dfft_real_limits(pme->pfft_setupA,
+ local_fft_ndata,
+ local_fft_offset,
+ local_fft_size);
+
+ /* Currently supports only a single communication pulse */
+
+/* for(ipulse=0;ipulse<overlap->noverlap_nodes;ipulse++) */
+ if (pme->nnodes_minor > 1)
+ {
+ /* Major dimension */
+ overlap = &pme->overlap[1];
+
+ if (pme->nnodes_major > 1)
+ {
+ size_yx = pme->overlap[0].comm_data[0].send_nindex;
+ }
+ else
+ {
+ size_yx = 0;
+ }
+ datasize = (local_fft_ndata[XX]+size_yx)*local_fft_ndata[ZZ];
+
+ ipulse = 0;
+
+ send_id = overlap->send_id[ipulse];
+ recv_id = overlap->recv_id[ipulse];
+ send_nindex = overlap->comm_data[ipulse].send_nindex;
+ /* recv_index0 = overlap->comm_data[ipulse].recv_index0; */
+ recv_index0 = 0;
+ recv_nindex = overlap->comm_data[ipulse].recv_nindex;
+
+ sendptr = overlap->sendbuf;
+ recvptr = overlap->recvbuf;
+
+ /*
+ printf("node %d comm %2d x %2d x %2d\n",pme->nodeid,
+ local_fft_ndata[XX]+size_yx,send_nindex,local_fft_ndata[ZZ]);
+ printf("node %d send %f, %f\n",pme->nodeid,
+ sendptr[0],sendptr[send_nindex*datasize-1]);
+ */
+
+#ifdef GMX_MPI
+ MPI_Sendrecv(sendptr,send_nindex*datasize,GMX_MPI_REAL,
+ send_id,ipulse,
+ recvptr,recv_nindex*datasize,GMX_MPI_REAL,
+ recv_id,ipulse,
+ overlap->mpi_comm,&stat);
+#endif
+
+ for(x=0; x<local_fft_ndata[XX]; x++)
+ {
+ for(y=0; y<recv_nindex; y++)
+ {
+ indg = (x*local_fft_size[YY] + y)*local_fft_size[ZZ];
+ indb = (x*recv_nindex + y)*local_fft_ndata[ZZ];
+ for(z=0; z<local_fft_ndata[ZZ]; z++)
+ {
+ fftgrid[indg+z] += recvptr[indb+z];
+ }
+ }
+ }
+ if (pme->nnodes_major > 1)
+ {
+ sendptr = pme->overlap[0].sendbuf;
+ for(x=0; x<size_yx; x++)
+ {
+ for(y=0; y<recv_nindex; y++)
+ {
+ indg = (x*local_fft_ndata[YY] + y)*local_fft_ndata[ZZ];
+ indb = ((local_fft_ndata[XX] + x)*recv_nindex +y)*local_fft_ndata[ZZ];
+ for(z=0; z<local_fft_ndata[ZZ]; z++)
+ {
+ sendptr[indg+z] += recvptr[indb+z];
+ }
+ }
+ }
+ }
+ }
+
+ /* for(ipulse=0;ipulse<overlap->noverlap_nodes;ipulse++) */
+ if (pme->nnodes_major > 1)
+ {
+ /* Major dimension */
+ overlap = &pme->overlap[0];
+
+ datasize = local_fft_ndata[YY]*local_fft_ndata[ZZ];
+ gridsize = local_fft_size[YY] *local_fft_size[ZZ];
+
+ ipulse = 0;
+
+ send_id = overlap->send_id[ipulse];
+ recv_id = overlap->recv_id[ipulse];
+ send_nindex = overlap->comm_data[ipulse].send_nindex;
+ /* recv_index0 = overlap->comm_data[ipulse].recv_index0; */
+ recv_index0 = 0;
+ recv_nindex = overlap->comm_data[ipulse].recv_nindex;
+
+ sendptr = overlap->sendbuf;
+ recvptr = overlap->recvbuf;
+
+ if (debug != NULL)
+ {
+ fprintf(debug,"PME fftgrid comm %2d x %2d x %2d\n",
+ send_nindex,local_fft_ndata[YY],local_fft_ndata[ZZ]);
+ }
+
+#ifdef GMX_MPI
+ MPI_Sendrecv(sendptr,send_nindex*datasize,GMX_MPI_REAL,
+ send_id,ipulse,
+ recvptr,recv_nindex*datasize,GMX_MPI_REAL,
+ recv_id,ipulse,
+ overlap->mpi_comm,&stat);
+#endif
+
+ for(x=0; x<recv_nindex; x++)
+ {
+ for(y=0; y<local_fft_ndata[YY]; y++)
+ {
+ indg = (x*local_fft_size[YY] + y)*local_fft_size[ZZ];
+ indb = (x*local_fft_ndata[YY] + y)*local_fft_ndata[ZZ];
+ for(z=0; z<local_fft_ndata[ZZ]; z++)
+ {
+ fftgrid[indg+z] += recvptr[indb+z];
+ }
+ }
+ }
+ }
+}
+
+
static void spread_on_grid(gmx_pme_t pme,
- pme_atomcomm_t *atc,real *grid,
- gmx_bool bCalcSplines,gmx_bool bSpread)
-{
+ pme_atomcomm_t *atc,pmegrids_t *grids,
+ gmx_bool bCalcSplines,gmx_bool bSpread,
+ real *fftgrid)
+{
+ int nthread,thread;
+#ifdef PME_TIME_THREADS
+ gmx_cycles_t c1,c2,c3,ct1a,ct1b,ct1c;
+ static double cs1=0,cs2=0,cs3=0;
+ static double cs1a[6]={0,0,0,0,0,0};
+ static int cnt=0;
+#endif
+
+ nthread = pme->nthread;
+
+#ifdef PME_TIME_THREADS
+ c1 = omp_cyc_start();
+#endif
if (bCalcSplines)
{
-
- /* Compute fftgrid index for all atoms,
- * with help of some extra variables.
- */
- calc_interpolation_idx(pme,atc);
-
+#pragma omp parallel for num_threads(nthread) schedule(static)
+ for(thread=0; thread<nthread; thread++)
+ {
+ int start,end;
+
+ start = atc->n* thread /nthread;
+ end = atc->n*(thread+1)/nthread;
+
+ /* Compute fftgrid index for all atoms,
+ * with help of some extra variables.
+ */
+ calc_interpolation_idx(pme,atc,start,end,thread);
+ }
+ }
+#ifdef PME_TIME_THREADS
+ c1 = omp_cyc_end(c1);
+ cs1 += (double)c1;
+#endif
+
+#ifdef PME_TIME_THREADS
+ c2 = omp_cyc_start();
+#endif
+#pragma omp parallel for num_threads(nthread) schedule(static)
+ for(thread=0; thread<nthread; thread++)
+ {
+ splinedata_t *spline;
+ pmegrid_t *grid;
+
/* make local bsplines */
- make_bsplines(atc->theta,atc->dtheta,pme->pme_order,
- atc->fractx,atc->n,atc->q,pme->bFEP);
- }
-
- if (bSpread)
+ if (grids->nthread == 1)
+ {
+ spline = &atc->spline[0];
+
+ spline->n = atc->n;
+
+ grid = &grids->grid;
+ }
+ else
+ {
+ spline = &atc->spline[thread];
+
+ make_thread_local_ind(atc,thread,spline);
+
+ grid = &grids->grid_th[thread];
+ }
+
+ if (bCalcSplines)
+ {
+ make_bsplines(spline->theta,spline->dtheta,pme->pme_order,
+ atc->fractx,spline->n,spline->ind,atc->q,pme->bFEP);
+ }
+
+ if (bSpread)
+ {
+ /* put local atoms on grid. */
+#ifdef PME_TIME_SPREAD
+ ct1a = omp_cyc_start();
+#endif
+ spread_q_bsplines_thread(grid,atc,spline,&pme->spline_work);
+
+ if (grids->nthread > 1)
+ {
+ copy_local_grid(pme,grids,thread,fftgrid);
+ }
+#ifdef PME_TIME_SPREAD
+ ct1a = omp_cyc_end(ct1a);
+ cs1a[thread] += (double)ct1a;
+#endif
+ }
+ }
+#ifdef PME_TIME_THREADS
+ c2 = omp_cyc_end(c2);
+ cs2 += (double)c2;
+#endif
+
+ if (grids->nthread > 1)
+ {
+#ifdef PME_TIME_THREADS
+ c3 = omp_cyc_start();
+#endif
+#pragma omp parallel for num_threads(grids->nthread) schedule(static)
+ for(thread=0; thread<grids->nthread; thread++)
+ {
+ reduce_threadgrid_overlap(pme,grids,thread,
+ fftgrid,
+ pme->overlap[0].sendbuf,
+ pme->overlap[1].sendbuf);
+#ifdef PRINT_PME_SENDBUF
+ print_sendbuf(pme,pme->overlap[0].sendbuf);
+#endif
+ }
+#ifdef PME_TIME_THREADS
+ c3 = omp_cyc_end(c3);
+ cs3 += (double)c3;
+#endif
+
+ if (pme->nnodes > 1)
+ {
+ /* Communicate the overlapping part of the fftgrid */
+ sum_fftgrid_dd(pme,fftgrid);
+ }
+ }
+
+#ifdef PME_TIME_THREADS
+ cnt++;
+ if (cnt % 20 == 0)
+ {
+ printf("idx %.2f spread %.2f red %.2f",
+ cs1*1e-9,cs2*1e-9,cs3*1e-9);
+#ifdef PME_TIME_SPREAD
+ for(thread=0; thread<nthread; thread++)
+ printf(" %.2f",cs1a[thread]*1e-9);
+#endif
+ printf("\n");
+ }
+#endif
+}
+
+
+static void dump_grid(FILE *fp,
+ int sx,int sy,int sz,int nx,int ny,int nz,
+ int my,int mz,const real *g)
+{
+ int x,y,z;
+
+ for(x=0; x<nx; x++)
{
- /* put local atoms on grid. */
- spread_q_bsplines(pme,atc,grid);
+ for(y=0; y<ny; y++)
+ {
+ for(z=0; z<nz; z++)
+ {
+ fprintf(fp,"%2d %2d %2d %6.3f\n",
+ sx+x,sy+y,sz+z,g[(x*my + y)*mz + z]);
+ }
+ }
}
}
+static void dump_local_fftgrid(gmx_pme_t pme,const real *fftgrid)
+{
+ ivec local_fft_ndata,local_fft_offset,local_fft_size;
+
+ gmx_parallel_3dfft_real_limits(pme->pfft_setupA,
+ local_fft_ndata,
+ local_fft_offset,
+ local_fft_size);
+
+ dump_grid(stderr,
+ pme->pmegrid_start_ix,
+ pme->pmegrid_start_iy,
+ pme->pmegrid_start_iz,
+ pme->pmegrid_nx-pme->pme_order+1,
+ pme->pmegrid_ny-pme->pme_order+1,
+ pme->pmegrid_nz-pme->pme_order+1,
+ local_fft_size[YY],
+ local_fft_size[ZZ],
+ fftgrid);
+}
+
+
void gmx_pme_calc_energy(gmx_pme_t pme,int n,rvec *x,real *q,real *V)
{
pme_atomcomm_t *atc;
- real *grid;
+ pmegrids_t *grid;
if (pme->nnodes > 1)
{
pme_realloc_atomcomm_things(atc);
atc->x = x;
atc->q = q;
-
+
/* We only use the A-charges grid */
- grid = pme->pmegridA;
+ grid = &pme->pmegridA;
- spread_on_grid(pme,atc,NULL,TRUE,FALSE);
+ spread_on_grid(pme,atc,NULL,TRUE,FALSE,pme->fftgridA);
- *V = gather_energy_bsplines(pme,grid,atc);
+ *V = gather_energy_bsplines(pme,grid->grid.grid,atc);
}
int count;
gmx_bool bEnerVir;
gmx_large_int_t step,step_rel;
-
-
+
+
pme_pp = gmx_pme_pp_init(cr);
-
+
init_nrnb(nrnb);
-
+
count = 0;
do /****** this is a quasi-loop over time steps! */
{
&pme->bFEP,&lambda,
&bEnerVir,
&step);
-
+
if (natoms == -1) {
/* We should stop: break out of the loop */
break;
}
-
+
step_rel = step - ir->init_step;
-
+
if (count == 0)
wallcycle_start(wcycle,ewcRUN);
-
+
wallcycle_start(wcycle,ewcPMEMESH);
-
+
dvdlambda = 0;
clear_mat(vir);
gmx_pme_do(pme,0,natoms,x_pp,f_pp,chargeA,chargeB,box,
cr,maxshift_x,maxshift_y,nrnb,wcycle,vir,ewaldcoeff,
&energy,lambda,&dvdlambda,
GMX_PME_DO_ALL_F | (bEnerVir ? GMX_PME_CALC_ENER_VIR : 0));
-
+
cycles = wallcycle_stop(wcycle,ewcPMEMESH);
-
+
gmx_pme_send_force_vir_ener(pme_pp,
f_pp,vir,energy,dvdlambda,
cycles);
-
+
count++;
if (step_rel == wcycle_get_reset_counters(wcycle))
reset_pmeonly_counters(cr,wcycle,nrnb,ir,step_rel);
wcycle_set_reset_counters(wcycle, 0);
}
-
+
} /***** end of quasi-loop, we stop with the break above */
while (TRUE);
-
+
return 0;
}
int start, int homenr,
rvec x[], rvec f[],
real *chargeA, real *chargeB,
- matrix box, t_commrec *cr,
+ matrix box, t_commrec *cr,
int maxshift_x, int maxshift_y,
t_nrnb *nrnb, gmx_wallcycle_t wcycle,
matrix vir, real ewaldcoeff,
- real *energy, real lambda,
+ real *energy, real lambda,
real *dvdlambda, int flags)
{
int q,d,i,j,ntot,npme;
int nx,ny,nz;
int n_d,local_ny;
- int loop_count;
pme_atomcomm_t *atc=NULL;
- real * grid=NULL;
+ pmegrids_t *pmegrid=NULL;
+ real *grid=NULL;
real *ptr;
rvec *x_d,*f_d;
- real *charge=NULL,*q_d,vol;
+ real *charge=NULL,*q_d;
real energy_AB[2];
matrix vir_AB[2];
- gmx_bool bClearF;
+ gmx_bool bClearF;
gmx_parallel_3dfft_t pfft_setup;
real * fftgrid;
t_complex * cfftgrid;
+ int thread;
if (pme->nnodes > 1) {
atc = &pme->atc[0];
/* This could be necessary for TPI */
pme->atc[0].n = homenr;
}
-
+
for(q=0; q<(pme->bFEP ? 2 : 1); q++) {
if (q == 0) {
- grid = pme->pmegridA;
+ pmegrid = &pme->pmegridA;
fftgrid = pme->fftgridA;
cfftgrid = pme->cfftgridA;
pfft_setup = pme->pfft_setupA;
charge = chargeA+start;
} else {
- grid = pme->pmegridB;
+ pmegrid = &pme->pmegridB;
fftgrid = pme->fftgridB;
cfftgrid = pme->cfftgridB;
pfft_setup = pme->pfft_setupB;
charge = chargeB+start;
}
+ grid = pmegrid->grid.grid;
/* Unpack structure */
if (debug) {
fprintf(debug,"PME: nnodes = %d, nodeid = %d\n",
gmx_fatal(FARGS,"No grid!");
}
where();
-
- m_inv_ur0(box,pme->recipbox);
+
+ m_inv_ur0(box,pme->recipbox);
if (pme->nnodes == 1) {
atc = &pme->atc[0];
srenew(atc->pd,atc->pd_nalloc);
}
atc->maxshift = (atc->dimind==0 ? maxshift_x : maxshift_y);
- pme_calc_pidx(n_d,pme->recipbox,x_d,atc);
+ pme_calc_pidx_wrapper(n_d,pme->recipbox,x_d,atc);
where();
-
+
GMX_BARRIER(cr->mpi_comm_mygroup);
/* Redistribute x (only once) and qA or qB */
if (DOMAINDECOMP(cr)) {
wallcycle_stop(wcycle,ewcPME_REDISTXF);
}
-
+
if (debug)
fprintf(debug,"Node= %6d, pme local particles=%6d\n",
cr->nodeid,atc->n);
/* Spread the charges on a grid */
GMX_MPE_LOG(ev_spread_on_grid_start);
-
+
/* Spread the charges on a grid */
- spread_on_grid(pme,&pme->atc[0],grid,q==0,TRUE);
+ spread_on_grid(pme,&pme->atc[0],pmegrid,q==0,TRUE,fftgrid);
GMX_MPE_LOG(ev_spread_on_grid_finish);
if (q == 0)
inc_nrnb(nrnb,eNR_SPREADQBSP,
pme->pme_order*pme->pme_order*pme->pme_order*atc->n);
- wrap_periodic_pmegrid(pme,grid);
+ if (pme->nthread == 1)
+ {
+ wrap_periodic_pmegrid(pme,grid);
- /* sum contributions to local grid from other nodes */
+ /* sum contributions to local grid from other nodes */
#ifdef GMX_MPI
- if (pme->nnodes > 1) {
- GMX_BARRIER(cr->mpi_comm_mygroup);
- gmx_sum_qgrid_dd(pme,grid,GMX_SUM_QGRID_FORWARD);
- where();
- }
+ if (pme->nnodes > 1)
+ {
+ GMX_BARRIER(cr->mpi_comm_mygroup);
+ gmx_sum_qgrid_dd(pme,grid,GMX_SUM_QGRID_FORWARD);
+ where();
+ }
#endif
- where();
- copy_pmegrid_to_fftgrid(pme,grid,fftgrid);
+ copy_pmegrid_to_fftgrid(pme,grid,fftgrid);
+ }
wallcycle_stop(wcycle,ewcPME_SPREADGATHER);
- }
-
- if (flags & GMX_PME_SOLVE)
- {
- /* do 3d-fft */
- GMX_BARRIER(cr->mpi_comm_mygroup);
- GMX_MPE_LOG(ev_gmxfft3d_start);
- wallcycle_start(wcycle,ewcPME_FFT);
- gmx_parallel_3dfft_execute(pfft_setup,GMX_FFT_REAL_TO_COMPLEX,fftgrid,cfftgrid);
- wallcycle_stop(wcycle,ewcPME_FFT);
- GMX_MPE_LOG(ev_gmxfft3d_finish);
- where();
-
- /* solve in k-space for our local cells */
- vol = det(box);
- GMX_BARRIER(cr->mpi_comm_mygroup);
- GMX_MPE_LOG(ev_solve_pme_start);
- wallcycle_start(wcycle,ewcPME_SOLVE);
- loop_count =
- solve_pme_yzx(pme,cfftgrid,ewaldcoeff,vol,
- flags & GMX_PME_CALC_ENER_VIR,
- &energy_AB[q],vir_AB[q]);
- wallcycle_stop(wcycle,ewcPME_SOLVE);
- where();
- GMX_MPE_LOG(ev_solve_pme_finish);
- inc_nrnb(nrnb,eNR_SOLVEPME,loop_count);
+
+ /*
+ dump_local_fftgrid(pme,fftgrid);
+ exit(0);
+ */
}
- if ((flags & GMX_PME_CALC_F) ||
- (flags & GMX_PME_CALC_POT))
+ /* Here we start a large thread parallel region */
+#pragma omp parallel for num_threads(pme->nthread) schedule(static)
+ for(thread=0; thread<pme->nthread; thread++)
{
-
- /* do 3d-invfft */
- GMX_BARRIER(cr->mpi_comm_mygroup);
- GMX_MPE_LOG(ev_gmxfft3d_start);
- where();
- wallcycle_start(wcycle,ewcPME_FFT);
- gmx_parallel_3dfft_execute(pfft_setup,GMX_FFT_COMPLEX_TO_REAL,cfftgrid,fftgrid);
- wallcycle_stop(wcycle,ewcPME_FFT);
+ if (flags & GMX_PME_SOLVE)
+ {
+ int loop_count;
- where();
- GMX_MPE_LOG(ev_gmxfft3d_finish);
+ /* do 3d-fft */
+ if (thread == 0)
+ {
+ GMX_BARRIER(cr->mpi_comm_mygroup);
+ GMX_MPE_LOG(ev_gmxfft3d_start);
+ wallcycle_start(wcycle,ewcPME_FFT);
+ }
+ gmx_parallel_3dfft_execute(pfft_setup,GMX_FFT_REAL_TO_COMPLEX,
+ fftgrid,cfftgrid,thread,wcycle);
+ if (thread == 0)
+ {
+ wallcycle_stop(wcycle,ewcPME_FFT);
+ GMX_MPE_LOG(ev_gmxfft3d_finish);
+ }
+ where();
- if (pme->nodeid == 0)
- {
- ntot = pme->nkx*pme->nky*pme->nkz;
- npme = ntot*log((real)ntot)/log(2.0);
- inc_nrnb(nrnb,eNR_FFT,2*npme);
+ /* solve in k-space for our local cells */
+ if (thread == 0)
+ {
+ GMX_BARRIER(cr->mpi_comm_mygroup);
+ GMX_MPE_LOG(ev_solve_pme_start);
+ wallcycle_start(wcycle,ewcPME_SOLVE);
+ }
+ loop_count =
+ solve_pme_yzx(pme,cfftgrid,ewaldcoeff,
+ box[XX][XX]*box[YY][YY]*box[ZZ][ZZ],
+ flags & GMX_PME_CALC_ENER_VIR,
+ pme->nthread,thread);
+ if (thread == 0)
+ {
+ wallcycle_stop(wcycle,ewcPME_SOLVE);
+ where();
+ GMX_MPE_LOG(ev_solve_pme_finish);
+ inc_nrnb(nrnb,eNR_SOLVEPME,loop_count);
+ }
}
- wallcycle_start(wcycle,ewcPME_SPREADGATHER);
+ if (flags & GMX_PME_CALC_F)
+ {
+ /* do 3d-invfft */
+ if (thread == 0)
+ {
+ GMX_BARRIER(cr->mpi_comm_mygroup);
+ GMX_MPE_LOG(ev_gmxfft3d_start);
+ where();
+ wallcycle_start(wcycle,ewcPME_FFT);
+ }
+ gmx_parallel_3dfft_execute(pfft_setup,GMX_FFT_COMPLEX_TO_REAL,
+ cfftgrid,fftgrid,thread,wcycle);
+ if (thread == 0)
+ {
+ wallcycle_stop(wcycle,ewcPME_FFT);
+
+ where();
+ GMX_MPE_LOG(ev_gmxfft3d_finish);
+
+ if (pme->nodeid == 0)
+ {
+ ntot = pme->nkx*pme->nky*pme->nkz;
+ npme = ntot*log((real)ntot)/log(2.0);
+ inc_nrnb(nrnb,eNR_FFT,2*npme);
+ }
- copy_fftgrid_to_pmegrid(pme,fftgrid,grid);
+ wallcycle_start(wcycle,ewcPME_SPREADGATHER);
+ }
+ copy_fftgrid_to_pmegrid(pme,fftgrid,grid,pme->nthread,thread);
+ }
+ }
+ /* End of thread parallel section.
+ * With MPI we have to synchronize here before gmx_sum_qgrid_dd.
+ */
+
+ if (flags & GMX_PME_CALC_F)
+ {
/* distribute local grid to all nodes */
#ifdef GMX_MPI
if (pme->nnodes > 1) {
where();
unwrap_periodic_pmegrid(pme,grid);
- }
- if (flags & GMX_PME_CALC_F)
- {
/* interpolate forces for our local atoms */
GMX_BARRIER(cr->mpi_comm_mygroup);
GMX_MPE_LOG(ev_gather_f_bsplines_start);
where();
-
+
/* If we are running without parallelization,
* atc->f is the actual force array, not a buffer,
* therefore we should not clear it.
*/
bClearF = (q == 0 && PAR(cr));
- gather_f_bsplines(pme,grid,bClearF,&pme->atc[0],
- pme->bFEP ? (q==0 ? 1.0-lambda : lambda) : 1.0);
+#pragma omp parallel for num_threads(pme->nthread) schedule(static)
+ for(thread=0; thread<pme->nthread; thread++)
+ {
+ gather_f_bsplines(pme,grid,bClearF,atc,
+ &atc->spline[thread],
+ pme->bFEP ? (q==0 ? 1.0-lambda : lambda) : 1.0);
+ }
+
where();
-
+
GMX_MPE_LOG(ev_gather_f_bsplines_finish);
-
+
inc_nrnb(nrnb,eNR_GATHERFBSP,
pme->pme_order*pme->pme_order*pme->pme_order*pme->atc[0].n);
wallcycle_stop(wcycle,ewcPME_SPREADGATHER);
- }
+ }
+
+ if (flags & GMX_PME_CALC_ENER_VIR)
+ {
+ /* This should only be called on the master thread
+ * and after the threads have synchronized.
+ */
+ get_pme_ener_vir(pme,pme->nthread,&energy_AB[q],vir_AB[q]);
+ }
} /* of q-loop */
-
+
if ((flags & GMX_PME_CALC_F) && pme->nnodes > 1) {
wallcycle_start(wcycle,ewcPME_REDISTXF);
for(d=0; d<pme->ndecompdim; d++)
wallcycle_stop(wcycle,ewcPME_REDISTXF);
}
where();
-
+
if (!pme->bFEP) {
*energy = energy_AB[0];
m_add(vir,vir_AB[0],vir);
}
if (debug)
+ {
fprintf(debug,"PME mesh energy: %g\n",*energy);
-
+ }
+
return 0;
}
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
--- /dev/null
+/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
+ *
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * VERSION 4.5
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2004, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ *
+ * And Hey:
+ * GROwing Monsters And Cloning Shrimps
+ */
+
+/* This include file has code between ifdef's to make sure
+ * that this performance sensitive code is inlined
+ * and to remove conditionals and variable loop bounds at compile time.
+ */
+
+#ifdef PME_SPREAD_SSE_ORDER4
+/* This code does not assume any memory alignment.
+ * This code only works for pme_order = 4.
+ */
+{
+ __m128 ty_SSE0,ty_SSE1,ty_SSE2,ty_SSE3;
+ __m128 tz_SSE;
+ __m128 vx_SSE;
+ __m128 vx_tz_SSE;
+ __m128 sum_SSE0,sum_SSE1,sum_SSE2,sum_SSE3;
+ __m128 gri_SSE0,gri_SSE1,gri_SSE2,gri_SSE3;
+
+ ty_SSE0 = _mm_load1_ps(&thy[0]);
+ ty_SSE1 = _mm_load1_ps(&thy[1]);
+ ty_SSE2 = _mm_load1_ps(&thy[2]);
+ ty_SSE3 = _mm_load1_ps(&thy[3]);
+
+ tz_SSE = _mm_loadu_ps(thz);
+
+ for(ithx=0; (ithx<4); ithx++)
+ {
+ index_x = (i0+ithx)*pny*pnz;
+ valx = qn*thx[ithx];
+
+ vx_SSE = _mm_load1_ps(&valx);
+
+ vx_tz_SSE = _mm_mul_ps(vx_SSE,tz_SSE);
+
+ gri_SSE0 = _mm_loadu_ps(grid+index_x+(j0+0)*pnz+k0);
+ gri_SSE1 = _mm_loadu_ps(grid+index_x+(j0+1)*pnz+k0);
+ gri_SSE2 = _mm_loadu_ps(grid+index_x+(j0+2)*pnz+k0);
+ gri_SSE3 = _mm_loadu_ps(grid+index_x+(j0+3)*pnz+k0);
+
+ sum_SSE0 = _mm_add_ps(gri_SSE0,_mm_mul_ps(vx_tz_SSE,ty_SSE0));
+ sum_SSE1 = _mm_add_ps(gri_SSE1,_mm_mul_ps(vx_tz_SSE,ty_SSE1));
+ sum_SSE2 = _mm_add_ps(gri_SSE2,_mm_mul_ps(vx_tz_SSE,ty_SSE2));
+ sum_SSE3 = _mm_add_ps(gri_SSE3,_mm_mul_ps(vx_tz_SSE,ty_SSE3));
+
+ _mm_storeu_ps(grid+index_x+(j0+0)*pnz+k0,sum_SSE0);
+ _mm_storeu_ps(grid+index_x+(j0+1)*pnz+k0,sum_SSE1);
+ _mm_storeu_ps(grid+index_x+(j0+2)*pnz+k0,sum_SSE2);
+ _mm_storeu_ps(grid+index_x+(j0+3)*pnz+k0,sum_SSE3);
+ }
+}
+#undef PME_SPREAD_SSE_ORDER4
+#endif
+
+
+#ifdef PME_GATHER_F_SSE_ORDER4
+/* This code does not assume any memory alignment.
+ * This code only works for pme_order = 4.
+ */
+{
+ float fx_tmp[4],fy_tmp[4],fz_tmp[4];
+
+ __m128 fx_SSE,fy_SSE,fz_SSE;
+
+ __m128 tx_SSE,ty_SSE,tz_SSE;
+ __m128 dx_SSE,dy_SSE,dz_SSE;
+
+ __m128 gval_SSE;
+
+ __m128 fxy1_SSE;
+ __m128 fz1_SSE;
+
+ fx_SSE = _mm_setzero_ps();
+ fy_SSE = _mm_setzero_ps();
+ fz_SSE = _mm_setzero_ps();
+
+ tz_SSE = _mm_loadu_ps(thz);
+ dz_SSE = _mm_loadu_ps(dthz);
+
+ for(ithx=0; (ithx<4); ithx++)
+ {
+ index_x = (i0+ithx)*pny*pnz;
+ tx_SSE = _mm_load1_ps(thx+ithx);
+ dx_SSE = _mm_load1_ps(dthx+ithx);
+
+ for(ithy=0; (ithy<4); ithy++)
+ {
+ index_xy = index_x+(j0+ithy)*pnz;
+ ty_SSE = _mm_load1_ps(thy+ithy);
+ dy_SSE = _mm_load1_ps(dthy+ithy);
+
+ gval_SSE = _mm_loadu_ps(grid+index_xy+k0);
+
+ fxy1_SSE = _mm_mul_ps(tz_SSE,gval_SSE);
+ fz1_SSE = _mm_mul_ps(dz_SSE,gval_SSE);
+
+ fx_SSE = _mm_add_ps(fx_SSE,_mm_mul_ps(_mm_mul_ps(dx_SSE,ty_SSE),fxy1_SSE));
+ fy_SSE = _mm_add_ps(fy_SSE,_mm_mul_ps(_mm_mul_ps(tx_SSE,dy_SSE),fxy1_SSE));
+ fz_SSE = _mm_add_ps(fz_SSE,_mm_mul_ps(_mm_mul_ps(tx_SSE,ty_SSE),fz1_SSE));
+ }
+ }
+
+ _mm_storeu_ps(fx_tmp,fx_SSE);
+ _mm_storeu_ps(fy_tmp,fy_SSE);
+ _mm_storeu_ps(fz_tmp,fz_SSE);
+
+ fx += fx_tmp[0]+fx_tmp[1]+fx_tmp[2]+fx_tmp[3];
+ fy += fy_tmp[0]+fy_tmp[1]+fy_tmp[2]+fy_tmp[3];
+ fz += fz_tmp[0]+fz_tmp[1]+fz_tmp[2]+fz_tmp[3];
+}
+#undef PME_GATHER_F_SSE_ORDER4
+#endif
+
+
+#ifdef PME_SPREAD_SSE_ALIGNED
+/* This code assumes that the grid is allocated 16 bit aligned
+ * and that pnz is a multiple of 4.
+ * This code supports pme_order <= 5.
+ */
+{
+ int offset;
+ int index;
+ __m128 ty_SSE0,ty_SSE1,ty_SSE2,ty_SSE3,ty_SSE4;
+ __m128 tz_SSE0;
+ __m128 tz_SSE1;
+ __m128 vx_SSE;
+ __m128 vx_tz_SSE0;
+ __m128 vx_tz_SSE1;
+ __m128 sum_SSE00,sum_SSE01,sum_SSE02,sum_SSE03,sum_SSE04;
+ __m128 sum_SSE10,sum_SSE11,sum_SSE12,sum_SSE13,sum_SSE14;
+ __m128 gri_SSE00,gri_SSE01,gri_SSE02,gri_SSE03,gri_SSE04;
+ __m128 gri_SSE10,gri_SSE11,gri_SSE12,gri_SSE13,gri_SSE14;
+
+ offset = k0 & 3;
+
+ ty_SSE0 = _mm_load1_ps(&thy[0]);
+ ty_SSE1 = _mm_load1_ps(&thy[1]);
+ ty_SSE2 = _mm_load1_ps(&thy[2]);
+ ty_SSE3 = _mm_load1_ps(&thy[3]);
+#if PME_ORDER == 5
+ ty_SSE4 = _mm_load1_ps(&thy[4]);
+#endif
+
+ tz_SSE0 = _mm_loadu_ps(thz-offset);
+ tz_SSE1 = _mm_loadu_ps(thz-offset+4);
+ tz_SSE0 = _mm_and_ps(tz_SSE0,work->mask_SSE0[offset]);
+ tz_SSE1 = _mm_and_ps(tz_SSE1,work->mask_SSE1[offset]);
+
+ for(ithx=0; (ithx<PME_ORDER); ithx++)
+ {
+ index = (i0+ithx)*pny*pnz + j0*pnz + k0 - offset;
+ valx = qn*thx[ithx];
+
+ vx_SSE = _mm_load1_ps(&valx);
+
+ vx_tz_SSE0 = _mm_mul_ps(vx_SSE,tz_SSE0);
+ vx_tz_SSE1 = _mm_mul_ps(vx_SSE,tz_SSE1);
+
+ gri_SSE00 = _mm_load_ps(grid+index+0*pnz);
+ gri_SSE01 = _mm_load_ps(grid+index+1*pnz);
+ gri_SSE02 = _mm_load_ps(grid+index+2*pnz);
+ gri_SSE03 = _mm_load_ps(grid+index+3*pnz);
+#if PME_ORDER == 5
+ gri_SSE04 = _mm_load_ps(grid+index+4*pnz);
+#endif
+ gri_SSE10 = _mm_load_ps(grid+index+0*pnz+4);
+ gri_SSE11 = _mm_load_ps(grid+index+1*pnz+4);
+ gri_SSE12 = _mm_load_ps(grid+index+2*pnz+4);
+ gri_SSE13 = _mm_load_ps(grid+index+3*pnz+4);
+#if PME_ORDER == 5
+ gri_SSE14 = _mm_load_ps(grid+index+4*pnz+4);
+#endif
+
+ sum_SSE00 = _mm_add_ps(gri_SSE00,_mm_mul_ps(vx_tz_SSE0,ty_SSE0));
+ sum_SSE01 = _mm_add_ps(gri_SSE01,_mm_mul_ps(vx_tz_SSE0,ty_SSE1));
+ sum_SSE02 = _mm_add_ps(gri_SSE02,_mm_mul_ps(vx_tz_SSE0,ty_SSE2));
+ sum_SSE03 = _mm_add_ps(gri_SSE03,_mm_mul_ps(vx_tz_SSE0,ty_SSE3));
+#if PME_ORDER == 5
+ sum_SSE04 = _mm_add_ps(gri_SSE04,_mm_mul_ps(vx_tz_SSE0,ty_SSE4));
+#endif
+ sum_SSE10 = _mm_add_ps(gri_SSE10,_mm_mul_ps(vx_tz_SSE1,ty_SSE0));
+ sum_SSE11 = _mm_add_ps(gri_SSE11,_mm_mul_ps(vx_tz_SSE1,ty_SSE1));
+ sum_SSE12 = _mm_add_ps(gri_SSE12,_mm_mul_ps(vx_tz_SSE1,ty_SSE2));
+ sum_SSE13 = _mm_add_ps(gri_SSE13,_mm_mul_ps(vx_tz_SSE1,ty_SSE3));
+#if PME_ORDER == 5
+ sum_SSE14 = _mm_add_ps(gri_SSE14,_mm_mul_ps(vx_tz_SSE1,ty_SSE4));
+#endif
+
+ _mm_store_ps(grid+index+0*pnz,sum_SSE00);
+ _mm_store_ps(grid+index+1*pnz,sum_SSE01);
+ _mm_store_ps(grid+index+2*pnz,sum_SSE02);
+ _mm_store_ps(grid+index+3*pnz,sum_SSE03);
+#if PME_ORDER == 5
+ _mm_store_ps(grid+index+4*pnz,sum_SSE04);
+#endif
+ _mm_store_ps(grid+index+0*pnz+4,sum_SSE10);
+ _mm_store_ps(grid+index+1*pnz+4,sum_SSE11);
+ _mm_store_ps(grid+index+2*pnz+4,sum_SSE12);
+ _mm_store_ps(grid+index+3*pnz+4,sum_SSE13);
+#if PME_ORDER == 5
+ _mm_store_ps(grid+index+4*pnz+4,sum_SSE14);
+#endif
+ }
+}
+#undef PME_ORDER
+#undef PME_SPREAD_SSE_ALIGNED
+#endif
+
+
+#ifdef PME_GATHER_F_SSE_ALIGNED
+/* This code assumes that the grid is allocated 16 bit aligned
+ * and that pnz is a multiple of 4.
+ * This code supports pme_order <= 5.
+ */
+{
+ int offset;
+
+ float fx_tmp[4],fy_tmp[4],fz_tmp[4];
+
+ __m128 fx_SSE,fy_SSE,fz_SSE;
+
+ __m128 tx_SSE,ty_SSE,tz_SSE0,tz_SSE1;
+ __m128 dx_SSE,dy_SSE,dz_SSE0,dz_SSE1;
+
+ __m128 gval_SSE0;
+ __m128 gval_SSE1;
+
+ __m128 fxy1_SSE0;
+ __m128 fz1_SSE0;
+ __m128 fxy1_SSE1;
+ __m128 fz1_SSE1;
+ __m128 fxy1_SSE;
+ __m128 fz1_SSE;
+
+ offset = k0 & 3;
+
+ fx_SSE = _mm_setzero_ps();
+ fy_SSE = _mm_setzero_ps();
+ fz_SSE = _mm_setzero_ps();
+
+ tz_SSE0 = _mm_loadu_ps(thz-offset);
+ dz_SSE0 = _mm_loadu_ps(dthz-offset);
+ tz_SSE1 = _mm_loadu_ps(thz-offset+4);
+ dz_SSE1 = _mm_loadu_ps(dthz-offset+4);
+ tz_SSE0 = _mm_and_ps(tz_SSE0,work->mask_SSE0[offset]);
+ dz_SSE0 = _mm_and_ps(dz_SSE0,work->mask_SSE0[offset]);
+ tz_SSE1 = _mm_and_ps(tz_SSE1,work->mask_SSE1[offset]);
+ dz_SSE1 = _mm_and_ps(dz_SSE1,work->mask_SSE1[offset]);
+
+ for(ithx=0; (ithx<PME_ORDER); ithx++)
+ {
+ index_x = (i0+ithx)*pny*pnz;
+ tx_SSE = _mm_load1_ps(thx+ithx);
+ dx_SSE = _mm_load1_ps(dthx+ithx);
+
+ for(ithy=0; (ithy<PME_ORDER); ithy++)
+ {
+ index_xy = index_x+(j0+ithy)*pnz;
+ ty_SSE = _mm_load1_ps(thy+ithy);
+ dy_SSE = _mm_load1_ps(dthy+ithy);
+
+ gval_SSE0 = _mm_load_ps(grid+index_xy+k0-offset);
+ gval_SSE1 = _mm_load_ps(grid+index_xy+k0-offset+4);
+
+ fxy1_SSE0 = _mm_mul_ps(tz_SSE0,gval_SSE0);
+ fz1_SSE0 = _mm_mul_ps(dz_SSE0,gval_SSE0);
+ fxy1_SSE1 = _mm_mul_ps(tz_SSE1,gval_SSE1);
+ fz1_SSE1 = _mm_mul_ps(dz_SSE1,gval_SSE1);
+
+ fxy1_SSE = _mm_add_ps(fxy1_SSE0,fxy1_SSE1);
+ fz1_SSE = _mm_add_ps(fz1_SSE0,fz1_SSE1);
+
+ fx_SSE = _mm_add_ps(fx_SSE,_mm_mul_ps(_mm_mul_ps(dx_SSE,ty_SSE),fxy1_SSE));
+ fy_SSE = _mm_add_ps(fy_SSE,_mm_mul_ps(_mm_mul_ps(tx_SSE,dy_SSE),fxy1_SSE));
+ fz_SSE = _mm_add_ps(fz_SSE,_mm_mul_ps(_mm_mul_ps(tx_SSE,ty_SSE),fz1_SSE));
+ }
+ }
+
+ _mm_store_ps(fx_tmp,fx_SSE);
+ _mm_store_ps(fy_tmp,fy_SSE);
+ _mm_store_ps(fz_tmp,fz_SSE);
+
+ fx += fx_tmp[0]+fx_tmp[1]+fx_tmp[2]+fx_tmp[3];
+ fy += fy_tmp[0]+fy_tmp[1]+fy_tmp[2]+fy_tmp[3];
+ fz += fz_tmp[0]+fz_tmp[1]+fz_tmp[2]+fz_tmp[3];
+}
+#undef PME_ORDER
+#undef PME_GATHER_F_SSE_ALIGNED
+#endif
#include "typedefs.h"
#include "network.h"
#include "filenm.h"
-#include "string.h"
+#include <string.h>
#include "smalloc.h"
#include "pull.h"
#include "xvgr.h"
--- /dev/null
+/*
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2008, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ *
+ * And Hey:
+ * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "domdec.h"
+#include "gmx_wallcycle.h"
+#include "trnio.h"
+#include "smalloc.h"
+#include "network.h"
+#include "pbc.h"
+#include "futil.h"
+#include "mdrun.h"
+#include "txtdump.h"
+#include "names.h"
+#include "mtop_util.h"
+#include "names.h"
+#include "nrjac.h"
+#include "vec.h"
+#include "gmx_ga2la.h"
+#include "xvgr.h"
+#include "gmxfio.h"
+#include "groupcoord.h"
+#include "pull_rotation.h"
+#include "gmx_sort.h"
+#include "copyrite.h"
+#include "gmx_cyclecounter.h"
+
+
+static char *RotStr = {"Enforced rotation:"};
+
+
+/* Set the minimum weight for the determination of the slab centers */
+#define WEIGHT_MIN (10*GMX_FLOAT_MIN)
+
+/* Helper structure for sorting positions along rotation vector */
+typedef struct {
+ real xcproj; /* Projection of xc on the rotation vector */
+ int ind; /* Index of xc */
+ real m; /* Mass */
+ rvec x; /* Position */
+ rvec x_ref; /* Reference position */
+} sort_along_vec_t;
+
+
+/* Enforced rotation / flexible: determine the angle of each slab */
+typedef struct gmx_slabdata
+{
+ int nat; /* Number of atoms belonging to this slab */
+ rvec *x; /* The positions belonging to this slab. In
+ general, this should be all positions of the
+ whole rotation group, but we leave those away
+ that have a small enough weight */
+ rvec *ref; /* Same for reference */
+ real *weight; /* The weight for each atom */
+} t_gmx_slabdata;
+
+
+/* Helper structure for potential fitting */
+typedef struct gmx_potfit
+{
+ real *degangle; /* Set of angles for which the potential is
+ calculated. The optimum fit is determined as
+ the angle for with the potential is minimal */
+ real *V; /* Potential for the different angles */
+ matrix *rotmat; /* Rotation matrix corresponding to the angles */
+} t_gmx_potfit;
+
+
+/* Enforced rotation data for all groups */
+typedef struct gmx_enfrot
+{
+ FILE *out_rot; /* Output file for rotation data */
+ FILE *out_torque; /* Output file for torque data */
+ FILE *out_angles; /* Output file for slab angles for flexible type */
+ FILE *out_slabs; /* Output file for slab centers */
+ int bufsize; /* Allocation size of buf */
+ rvec *xbuf; /* Coordinate buffer variable for sorting */
+ real *mbuf; /* Masses buffer variable for sorting */
+ sort_along_vec_t *data; /* Buffer variable needed for position sorting */
+ real *mpi_inbuf; /* MPI buffer */
+ real *mpi_outbuf; /* MPI buffer */
+ int mpi_bufsize; /* Allocation size of in & outbuf */
+ unsigned long Flags; /* mdrun flags */
+ gmx_bool bOut; /* Used to skip first output when appending to
+ * avoid duplicate entries in rotation outfiles */
+} t_gmx_enfrot;
+
+
+/* Global enforced rotation data for a single rotation group */
+typedef struct gmx_enfrotgrp
+{
+ real degangle; /* Rotation angle in degrees */
+ matrix rotmat; /* Rotation matrix */
+ atom_id *ind_loc; /* Local rotation indices */
+ int nat_loc; /* Number of local group atoms */
+ int nalloc_loc; /* Allocation size for ind_loc and weight_loc */
+
+ real V; /* Rotation potential for this rotation group */
+ rvec *f_rot_loc; /* Array to store the forces on the local atoms
+ resulting from enforced rotation potential */
+
+ /* Collective coordinates for the whole rotation group */
+ real *xc_ref_length; /* Length of each x_rotref vector after x_rotref
+ has been put into origin */
+ int *xc_ref_ind; /* Position of each local atom in the collective
+ array */
+ rvec xc_center; /* Center of the rotation group positions, may
+ be mass weighted */
+ rvec xc_ref_center; /* dito, for the reference positions */
+ rvec *xc; /* Current (collective) positions */
+ ivec *xc_shifts; /* Current (collective) shifts */
+ ivec *xc_eshifts; /* Extra shifts since last DD step */
+ rvec *xc_old; /* Old (collective) positions */
+ rvec *xc_norm; /* Normalized form of the current positions */
+ rvec *xc_ref_sorted; /* Reference positions (sorted in the same order
+ as xc when sorted) */
+ int *xc_sortind; /* Where is a position found after sorting? */
+ real *mc; /* Collective masses */
+ real *mc_sorted;
+ real invmass; /* one over the total mass of the rotation group */
+
+ real torque_v; /* Torque in the direction of rotation vector */
+ real angle_v; /* Actual angle of the whole rotation group */
+ /* Fixed rotation only */
+ real weight_v; /* Weights for angle determination */
+ rvec *xr_loc; /* Local reference coords, correctly rotated */
+ rvec *x_loc_pbc; /* Local current coords, correct PBC image */
+ real *m_loc; /* Masses of the current local atoms */
+
+ /* Flexible rotation only */
+ int nslabs_alloc; /* For this many slabs memory is allocated */
+ int slab_first; /* Lowermost slab for that the calculation needs
+ to be performed at a given time step */
+ int slab_last; /* Uppermost slab ... */
+ int slab_first_ref; /* First slab for which ref. center is stored */
+ int slab_last_ref; /* Last ... */
+ int slab_buffer; /* Slab buffer region around reference slabs */
+ int *firstatom; /* First relevant atom for a slab */
+ int *lastatom; /* Last relevant atom for a slab */
+ rvec *slab_center; /* Gaussian-weighted slab center */
+ rvec *slab_center_ref; /* Gaussian-weighted slab center for the
+ reference positions */
+ real *slab_weights; /* Sum of gaussian weights in a slab */
+ real *slab_torque_v; /* Torque T = r x f for each slab. */
+ /* torque_v = m.v = angular momentum in the
+ direction of v */
+ real max_beta; /* min_gaussian from inputrec->rotgrp is the
+ minimum value the gaussian must have so that
+ the force is actually evaluated max_beta is
+ just another way to put it */
+ real *gn_atom; /* Precalculated gaussians for a single atom */
+ int *gn_slabind; /* Tells to which slab each precalculated gaussian
+ belongs */
+ rvec *slab_innersumvec;/* Inner sum of the flexible2 potential per slab;
+ this is precalculated for optimization reasons */
+ t_gmx_slabdata *slab_data; /* Holds atom positions and gaussian weights
+ of atoms belonging to a slab */
+
+ /* For potential fits with varying angle: */
+ t_gmx_potfit *PotAngleFit; /* Used for fit type 'potential' */
+} t_gmx_enfrotgrp;
+
+
+/* Activate output of forces for correctness checks */
+/* #define PRINT_FORCES */
+#ifdef PRINT_FORCES
+#define PRINT_FORCE_J fprintf(stderr,"f%d = %15.8f %15.8f %15.8f\n",erg->xc_ref_ind[j],erg->f_rot_loc[j][XX], erg->f_rot_loc[j][YY], erg->f_rot_loc[j][ZZ]);
+#define PRINT_POT_TAU if (MASTER(cr)) { \
+ fprintf(stderr,"potential = %15.8f\n" "torque = %15.8f\n", erg->V, erg->torque_v); \
+ }
+#else
+#define PRINT_FORCE_J
+#define PRINT_POT_TAU
+#endif
+
+/* Shortcuts for often used queries */
+#define ISFLEX(rg) ( (rg->eType==erotgFLEX) || (rg->eType==erotgFLEXT) || (rg->eType==erotgFLEX2) || (rg->eType==erotgFLEX2T) )
+#define ISCOLL(rg) ( (rg->eType==erotgFLEX) || (rg->eType==erotgFLEXT) || (rg->eType==erotgFLEX2) || (rg->eType==erotgFLEX2T) || (rg->eType==erotgRMPF) || (rg->eType==erotgRM2PF) )
+
+
+/* Does any of the rotation groups use slab decomposition? */
+static gmx_bool HaveFlexibleGroups(t_rot *rot)
+{
+ int g;
+ t_rotgrp *rotg;
+
+
+ for (g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ if (ISFLEX(rotg))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+/* Is for any group the fit angle determined by finding the minimum of the
+ * rotation potential? */
+static gmx_bool HavePotFitGroups(t_rot *rot)
+{
+ int g;
+ t_rotgrp *rotg;
+
+
+ for (g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ if (erotgFitPOT == rotg->eFittype)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+
+static double** allocate_square_matrix(int dim)
+{
+ int i;
+ double** mat = NULL;
+
+
+ snew(mat, dim);
+ for(i=0; i<dim; i++)
+ snew(mat[i], dim);
+
+ return mat;
+}
+
+
+static void free_square_matrix(double** mat, int dim)
+{
+ int i;
+
+
+ for (i=0; i<dim; i++)
+ sfree(mat[i]);
+ sfree(mat);
+}
+
+
+/* Return the angle for which the potential is minimal */
+static real get_fitangle(t_rotgrp *rotg, gmx_enfrotgrp_t erg)
+{
+ int i;
+ real fitangle = -999.9;
+ real pot_min = GMX_FLOAT_MAX;
+ t_gmx_potfit *fit;
+
+
+ fit = erg->PotAngleFit;
+
+ for (i = 0; i < rotg->PotAngle_nstep; i++)
+ {
+ if (fit->V[i] < pot_min)
+ {
+ pot_min = fit->V[i];
+ fitangle = fit->degangle[i];
+ }
+ }
+
+ return fitangle;
+}
+
+
+/* Reduce potential angle fit data for this group at this time step? */
+static gmx_inline gmx_bool bPotAngle(t_rot *rot, t_rotgrp *rotg, gmx_large_int_t step)
+{
+ return ( (erotgFitPOT==rotg->eFittype) && (do_per_step(step, rot->nstsout) || do_per_step(step, rot->nstrout)) );
+}
+
+/* Reduce slab torqe data for this group at this time step? */
+static gmx_inline gmx_bool bSlabTau(t_rot *rot, t_rotgrp *rotg, gmx_large_int_t step)
+{
+ return ( (ISFLEX(rotg)) && do_per_step(step, rot->nstsout) );
+}
+
+/* Output rotation energy, torques, etc. for each rotation group */
+static void reduce_output(t_commrec *cr, t_rot *rot, real t, gmx_large_int_t step)
+{
+ int g,i,islab,nslabs=0;
+ int count; /* MPI element counter */
+ t_rotgrp *rotg;
+ gmx_enfrot_t er; /* Pointer to the enforced rotation buffer variables */
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ real fitangle;
+ gmx_bool bFlex;
+
+
+ er=rot->enfrot;
+
+ /* Fill the MPI buffer with stuff to reduce. If items are added for reduction
+ * here, the MPI buffer size has to be enlarged also in calc_mpi_bufsize() */
+ if (PAR(cr))
+ {
+ count=0;
+ for (g=0; g < rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ erg = rotg->enfrotgrp;
+ nslabs = erg->slab_last - erg->slab_first + 1;
+ er->mpi_inbuf[count++] = erg->V;
+ er->mpi_inbuf[count++] = erg->torque_v;
+ er->mpi_inbuf[count++] = erg->angle_v;
+ er->mpi_inbuf[count++] = erg->weight_v; /* weights are not needed for flex types, but this is just a single value */
+
+ if (bPotAngle(rot, rotg, step))
+ {
+ for (i = 0; i < rotg->PotAngle_nstep; i++)
+ er->mpi_inbuf[count++] = erg->PotAngleFit->V[i];
+ }
+ if (bSlabTau(rot, rotg, step))
+ {
+ for (i=0; i<nslabs; i++)
+ er->mpi_inbuf[count++] = erg->slab_torque_v[i];
+ }
+ }
+ if (count > er->mpi_bufsize)
+ gmx_fatal(FARGS, "%s MPI buffer overflow, please report this error.", RotStr);
+
+#ifdef GMX_MPI
+ MPI_Reduce(er->mpi_inbuf, er->mpi_outbuf, count, GMX_MPI_REAL, MPI_SUM, MASTERRANK(cr), cr->mpi_comm_mygroup);
+#endif
+
+ /* Copy back the reduced data from the buffer on the master */
+ if (MASTER(cr))
+ {
+ count=0;
+ for (g=0; g < rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ erg = rotg->enfrotgrp;
+ nslabs = erg->slab_last - erg->slab_first + 1;
+ erg->V = er->mpi_outbuf[count++];
+ erg->torque_v = er->mpi_outbuf[count++];
+ erg->angle_v = er->mpi_outbuf[count++];
+ erg->weight_v = er->mpi_outbuf[count++];
+
+ if (bPotAngle(rot, rotg, step))
+ {
+ for (i = 0; i < rotg->PotAngle_nstep; i++)
+ erg->PotAngleFit->V[i] = er->mpi_outbuf[count++];
+ }
+ if (bSlabTau(rot, rotg, step))
+ {
+ for (i=0; i<nslabs; i++)
+ erg->slab_torque_v[i] = er->mpi_outbuf[count++];
+ }
+ }
+ }
+ }
+
+ /* Output */
+ if (MASTER(cr))
+ {
+ /* Angle and torque for each rotation group */
+ for (g=0; g < rot->ngrp; g++)
+ {
+ rotg=&rot->grp[g];
+ bFlex = ISFLEX(rotg);
+
+ erg=rotg->enfrotgrp;
+
+ /* Output to main rotation output file: */
+ if ( do_per_step(step, rot->nstrout) )
+ {
+ if (erotgFitPOT == rotg->eFittype)
+ {
+ fitangle = get_fitangle(rotg, erg);
+ }
+ else
+ {
+ if (bFlex)
+ fitangle = erg->angle_v; /* RMSD fit angle */
+ else
+ fitangle = (erg->angle_v/erg->weight_v)*180.0*M_1_PI;
+ }
+ fprintf(er->out_rot, "%12.4f", fitangle);
+ fprintf(er->out_rot, "%12.3e", erg->torque_v);
+ fprintf(er->out_rot, "%12.3e", erg->V);
+ }
+
+ if ( do_per_step(step, rot->nstsout) )
+ {
+ /* Output to torque log file: */
+ if (bFlex)
+ {
+ fprintf(er->out_torque, "%12.3e%6d", t, g);
+ for (i=erg->slab_first; i<=erg->slab_last; i++)
+ {
+ islab = i - erg->slab_first; /* slab index */
+ /* Only output if enough weight is in slab */
+ if (erg->slab_weights[islab] > rotg->min_gaussian)
+ fprintf(er->out_torque, "%6d%12.3e", i, erg->slab_torque_v[islab]);
+ }
+ fprintf(er->out_torque , "\n");
+ }
+
+ /* Output to angles log file: */
+ if (erotgFitPOT == rotg->eFittype)
+ {
+ fprintf(er->out_angles, "%12.3e%6d%12.4f", t, g, erg->degangle);
+ /* Output energies at a set of angles around the reference angle */
+ for (i = 0; i < rotg->PotAngle_nstep; i++)
+ fprintf(er->out_angles, "%12.3e", erg->PotAngleFit->V[i]);
+ fprintf(er->out_angles, "\n");
+ }
+ }
+ }
+ if ( do_per_step(step, rot->nstrout) )
+ fprintf(er->out_rot, "\n");
+ }
+}
+
+
+/* Add the forces from enforced rotation potential to the local forces.
+ * Should be called after the SR forces have been evaluated */
+extern real add_rot_forces(t_rot *rot, rvec f[], t_commrec *cr, gmx_large_int_t step, real t)
+{
+ int g,l,ii;
+ t_rotgrp *rotg;
+ gmx_enfrot_t er; /* Pointer to the enforced rotation buffer variables */
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ real Vrot = 0.0; /* If more than one rotation group is present, Vrot
+ assembles the local parts from all groups */
+
+
+ er=rot->enfrot;
+
+ /* Loop over enforced rotation groups (usually 1, though)
+ * Apply the forces from rotation potentials */
+ for (g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ erg=rotg->enfrotgrp;
+ Vrot += erg->V; /* add the local parts from the nodes */
+ for (l=0; l<erg->nat_loc; l++)
+ {
+ /* Get the right index of the local force */
+ ii = erg->ind_loc[l];
+ /* Add */
+ rvec_inc(f[ii],erg->f_rot_loc[l]);
+ }
+ }
+
+ /* Reduce energy,torque, angles etc. to get the sum values (per rotation group)
+ * on the master and output these values to file. */
+ if ( (do_per_step(step, rot->nstrout) || do_per_step(step, rot->nstsout)) && er->bOut)
+ reduce_output(cr, rot, t, step);
+
+ /* When appending, er->bOut is FALSE the first time to avoid duplicate entries */
+ er->bOut = TRUE;
+
+ PRINT_POT_TAU
+
+ return Vrot;
+}
+
+
+/* The Gaussian norm is chosen such that the sum of the gaussian functions
+ * over the slabs is approximately 1.0 everywhere */
+#define GAUSS_NORM 0.569917543430618
+
+
+/* Calculate the maximum beta that leads to a gaussian larger min_gaussian,
+ * also does some checks
+ */
+static double calc_beta_max(real min_gaussian, real slab_dist)
+{
+ double sigma;
+ double arg;
+
+
+ /* Actually the next two checks are already made in grompp */
+ if (slab_dist <= 0)
+ gmx_fatal(FARGS, "Slab distance of flexible rotation groups must be >=0 !");
+ if (min_gaussian <= 0)
+ gmx_fatal(FARGS, "Cutoff value for Gaussian must be > 0. (You requested %f)");
+
+ /* Define the sigma value */
+ sigma = 0.7*slab_dist;
+
+ /* Calculate the argument for the logarithm and check that the log() result is negative or 0 */
+ arg = min_gaussian/GAUSS_NORM;
+ if (arg > 1.0)
+ gmx_fatal(FARGS, "min_gaussian of flexible rotation groups must be <%g", GAUSS_NORM);
+
+ return sqrt(-2.0*sigma*sigma*log(min_gaussian/GAUSS_NORM));
+}
+
+
+static gmx_inline real calc_beta(rvec curr_x, t_rotgrp *rotg, int n)
+{
+ return iprod(curr_x, rotg->vec) - rotg->slab_dist * n;
+}
+
+
+static gmx_inline real gaussian_weight(rvec curr_x, t_rotgrp *rotg, int n)
+{
+ const real norm = GAUSS_NORM;
+ real sigma;
+
+
+ /* Define the sigma value */
+ sigma = 0.7*rotg->slab_dist;
+ /* Calculate the Gaussian value of slab n for position curr_x */
+ return norm * exp( -0.5 * sqr( calc_beta(curr_x, rotg, n)/sigma ) );
+}
+
+
+/* Returns the weight in a single slab, also calculates the Gaussian- and mass-
+ * weighted sum of positions for that slab */
+static real get_slab_weight(int j, t_rotgrp *rotg, rvec xc[], real mc[], rvec *x_weighted_sum)
+{
+ rvec curr_x; /* The position of an atom */
+ rvec curr_x_weighted; /* The gaussian-weighted position */
+ real gaussian; /* A single gaussian weight */
+ real wgauss; /* gaussian times current mass */
+ real slabweight = 0.0; /* The sum of weights in the slab */
+ int i,islab;
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+
+
+ erg=rotg->enfrotgrp;
+ clear_rvec(*x_weighted_sum);
+
+ /* Slab index */
+ islab = j - erg->slab_first;
+
+ /* Loop over all atoms in the rotation group */
+ for (i=0; i<rotg->nat; i++)
+ {
+ copy_rvec(xc[i], curr_x);
+ gaussian = gaussian_weight(curr_x, rotg, j);
+ wgauss = gaussian * mc[i];
+ svmul(wgauss, curr_x, curr_x_weighted);
+ rvec_add(*x_weighted_sum, curr_x_weighted, *x_weighted_sum);
+ slabweight += wgauss;
+ } /* END of loop over rotation group atoms */
+
+ return slabweight;
+}
+
+
+static void get_slab_centers(
+ t_rotgrp *rotg, /* The rotation group information */
+ rvec *xc, /* The rotation group positions; will
+ typically be enfrotgrp->xc, but at first call
+ it is enfrotgrp->xc_ref */
+ real *mc, /* The masses of the rotation group atoms */
+ int g, /* The number of the rotation group */
+ real time, /* Used for output only */
+ FILE *out_slabs, /* For outputting center per slab information */
+ gmx_bool bOutStep, /* Is this an output step? */
+ gmx_bool bReference) /* If this routine is called from
+ init_rot_group we need to store
+ the reference slab centers */
+{
+ int j,islab;
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+
+
+ erg=rotg->enfrotgrp;
+
+ /* Loop over slabs */
+ for (j = erg->slab_first; j <= erg->slab_last; j++)
+ {
+ islab = j - erg->slab_first;
+ erg->slab_weights[islab] = get_slab_weight(j, rotg, xc, mc, &erg->slab_center[islab]);
+
+ /* We can do the calculations ONLY if there is weight in the slab! */
+ if (erg->slab_weights[islab] > WEIGHT_MIN)
+ {
+ svmul(1.0/erg->slab_weights[islab], erg->slab_center[islab], erg->slab_center[islab]);
+ }
+ else
+ {
+ /* We need to check this here, since we divide through slab_weights
+ * in the flexible low-level routines! */
+ gmx_fatal(FARGS, "Not enough weight in slab %d. Slab center cannot be determined!", j);
+ }
+
+ /* At first time step: save the centers of the reference structure */
+ if (bReference)
+ copy_rvec(erg->slab_center[islab], erg->slab_center_ref[islab]);
+ } /* END of loop over slabs */
+
+ /* Output on the master */
+ if ( (NULL != out_slabs) && bOutStep)
+ {
+ fprintf(out_slabs, "%12.3e%6d", time, g);
+ for (j = erg->slab_first; j <= erg->slab_last; j++)
+ {
+ islab = j - erg->slab_first;
+ fprintf(out_slabs, "%6d%12.3e%12.3e%12.3e",
+ j,erg->slab_center[islab][XX],erg->slab_center[islab][YY],erg->slab_center[islab][ZZ]);
+ }
+ fprintf(out_slabs, "\n");
+ }
+}
+
+
+static void calc_rotmat(
+ rvec vec,
+ real degangle, /* Angle alpha of rotation at time t in degrees */
+ matrix rotmat) /* Rotation matrix */
+{
+ real radangle; /* Rotation angle in radians */
+ real cosa; /* cosine alpha */
+ real sina; /* sine alpha */
+ real OMcosa; /* 1 - cos(alpha) */
+ real dumxy, dumxz, dumyz; /* save computations */
+ rvec rot_vec; /* Rotate around rot_vec ... */
+
+
+ radangle = degangle * M_PI/180.0;
+ copy_rvec(vec , rot_vec );
+
+ /* Precompute some variables: */
+ cosa = cos(radangle);
+ sina = sin(radangle);
+ OMcosa = 1.0 - cosa;
+ dumxy = rot_vec[XX]*rot_vec[YY]*OMcosa;
+ dumxz = rot_vec[XX]*rot_vec[ZZ]*OMcosa;
+ dumyz = rot_vec[YY]*rot_vec[ZZ]*OMcosa;
+
+ /* Construct the rotation matrix for this rotation group: */
+ /* 1st column: */
+ rotmat[XX][XX] = cosa + rot_vec[XX]*rot_vec[XX]*OMcosa;
+ rotmat[YY][XX] = dumxy + rot_vec[ZZ]*sina;
+ rotmat[ZZ][XX] = dumxz - rot_vec[YY]*sina;
+ /* 2nd column: */
+ rotmat[XX][YY] = dumxy - rot_vec[ZZ]*sina;
+ rotmat[YY][YY] = cosa + rot_vec[YY]*rot_vec[YY]*OMcosa;
+ rotmat[ZZ][YY] = dumyz + rot_vec[XX]*sina;
+ /* 3rd column: */
+ rotmat[XX][ZZ] = dumxz + rot_vec[YY]*sina;
+ rotmat[YY][ZZ] = dumyz - rot_vec[XX]*sina;
+ rotmat[ZZ][ZZ] = cosa + rot_vec[ZZ]*rot_vec[ZZ]*OMcosa;
+
+#ifdef PRINTMATRIX
+ int iii,jjj;
+
+ for (iii=0; iii<3; iii++) {
+ for (jjj=0; jjj<3; jjj++)
+ fprintf(stderr, " %10.8f ", rotmat[iii][jjj]);
+ fprintf(stderr, "\n");
+ }
+#endif
+}
+
+
+/* Calculates torque on the rotation axis tau = position x force */
+static gmx_inline real torque(
+ rvec rotvec, /* rotation vector; MUST be normalized! */
+ rvec force, /* force */
+ rvec x, /* position of atom on which the force acts */
+ rvec pivot) /* pivot point of rotation axis */
+{
+ rvec vectmp, tau;
+
+
+ /* Subtract offset */
+ rvec_sub(x,pivot,vectmp);
+
+ /* position x force */
+ cprod(vectmp, force, tau);
+
+ /* Return the part of the torque which is parallel to the rotation vector */
+ return iprod(tau, rotvec);
+}
+
+
+/* Right-aligned output of value with standard width */
+static void print_aligned(FILE *fp, char *str)
+{
+ fprintf(fp, "%12s", str);
+}
+
+
+/* Right-aligned output of value with standard short width */
+static void print_aligned_short(FILE *fp, char *str)
+{
+ fprintf(fp, "%6s", str);
+}
+
+
+static FILE *open_output_file(const char *fn, int steps, const char what[])
+{
+ FILE *fp;
+
+
+ fp = ffopen(fn, "w");
+
+ fprintf(fp, "# Output of %s is written in intervals of %d time step%s.\n#\n",
+ what,steps, steps>1 ? "s":"");
+
+ return fp;
+}
+
+
+/* Open output file for slab center data. Call on master only */
+static FILE *open_slab_out(const char *fn, t_rot *rot, const output_env_t oenv)
+{
+ FILE *fp;
+ int g,i;
+ t_rotgrp *rotg;
+
+
+ if (rot->enfrot->Flags & MD_APPENDFILES)
+ {
+ fp = gmx_fio_fopen(fn,"a");
+ }
+ else
+ {
+ fp = open_output_file(fn, rot->nstsout, "gaussian weighted slab centers");
+
+ for (g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ if (ISFLEX(rotg))
+ {
+ fprintf(fp, "# Rotation group %d (%s), slab distance %f nm, %s.\n",
+ g, erotg_names[rotg->eType], rotg->slab_dist,
+ rotg->bMassW? "centers of mass":"geometrical centers");
+ }
+ }
+
+ fprintf(fp, "# Reference centers are listed first (t=-1).\n");
+ fprintf(fp, "# The following columns have the syntax:\n");
+ fprintf(fp, "# ");
+ print_aligned_short(fp, "t");
+ print_aligned_short(fp, "grp");
+ /* Print legend for the first two entries only ... */
+ for (i=0; i<2; i++)
+ {
+ print_aligned_short(fp, "slab");
+ print_aligned(fp, "X center");
+ print_aligned(fp, "Y center");
+ print_aligned(fp, "Z center");
+ }
+ fprintf(fp, " ...\n");
+ fflush(fp);
+ }
+
+ return fp;
+}
+
+
+/* Adds 'buf' to 'str' */
+static void add_to_string(char **str, char *buf)
+{
+ int len;
+
+
+ len = strlen(*str) + strlen(buf) + 1;
+ srenew(*str, len);
+ strcat(*str, buf);
+}
+
+
+static void add_to_string_aligned(char **str, char *buf)
+{
+ char buf_aligned[STRLEN];
+
+ sprintf(buf_aligned, "%12s", buf);
+ add_to_string(str, buf_aligned);
+}
+
+
+/* Open output file and print some general information about the rotation groups.
+ * Call on master only */
+static FILE *open_rot_out(const char *fn, t_rot *rot, const output_env_t oenv)
+{
+ FILE *fp;
+ int g,nsets;
+ t_rotgrp *rotg;
+ const char **setname;
+ char buf[50], buf2[75];
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ gmx_bool bFlex;
+ char *LegendStr=NULL;
+
+
+ if (rot->enfrot->Flags & MD_APPENDFILES)
+ {
+ fp = gmx_fio_fopen(fn,"a");
+ }
+ else
+ {
+ fp = xvgropen(fn, "Rotation angles and energy", "Time (ps)", "angles (degrees) and energies (kJ/mol)", oenv);
+ fprintf(fp, "# Output of enforced rotation data is written in intervals of %d time step%s.\n#\n", rot->nstrout, rot->nstrout > 1 ? "s":"");
+ fprintf(fp, "# The scalar tau is the torque (kJ/mol) in the direction of the rotation vector v.\n");
+ fprintf(fp, "# To obtain the vectorial torque, multiply tau with the group's rot_vec.\n");
+ fprintf(fp, "# For flexible groups, tau(t,n) from all slabs n have been summed in a single value tau(t) here.\n");
+ fprintf(fp, "# The torques tau(t,n) are found in the rottorque.log (-rt) output file\n");
+
+ for (g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ erg=rotg->enfrotgrp;
+ bFlex = ISFLEX(rotg);
+
+ fprintf(fp, "#\n");
+ fprintf(fp, "# ROTATION GROUP %d, potential type '%s':\n" , g, erotg_names[rotg->eType]);
+ fprintf(fp, "# rot_massw%d %s\n" , g, yesno_names[rotg->bMassW]);
+ fprintf(fp, "# rot_vec%d %12.5e %12.5e %12.5e\n" , g, rotg->vec[XX], rotg->vec[YY], rotg->vec[ZZ]);
+ fprintf(fp, "# rot_rate%d %12.5e degrees/ps\n" , g, rotg->rate);
+ fprintf(fp, "# rot_k%d %12.5e kJ/(mol*nm^2)\n" , g, rotg->k);
+ if ( rotg->eType==erotgISO || rotg->eType==erotgPM || rotg->eType==erotgRM || rotg->eType==erotgRM2)
+ fprintf(fp, "# rot_pivot%d %12.5e %12.5e %12.5e nm\n", g, rotg->pivot[XX], rotg->pivot[YY], rotg->pivot[ZZ]);
+
+ if (bFlex)
+ {
+ fprintf(fp, "# rot_slab_distance%d %f nm\n", g, rotg->slab_dist);
+ fprintf(fp, "# rot_min_gaussian%d %12.5e\n", g, rotg->min_gaussian);
+ }
+
+ /* Output the centers of the rotation groups for the pivot-free potentials */
+ if ((rotg->eType==erotgISOPF) || (rotg->eType==erotgPMPF) || (rotg->eType==erotgRMPF) || (rotg->eType==erotgRM2PF
+ || (rotg->eType==erotgFLEXT) || (rotg->eType==erotgFLEX2T)) )
+ {
+ fprintf(fp, "# ref. grp. %d center %12.5e %12.5e %12.5e\n", g,
+ erg->xc_ref_center[XX], erg->xc_ref_center[YY], erg->xc_ref_center[ZZ]);
+
+ fprintf(fp, "# grp. %d init.center %12.5e %12.5e %12.5e\n", g,
+ erg->xc_center[XX], erg->xc_center[YY], erg->xc_center[ZZ]);
+ }
+
+ if ( (rotg->eType == erotgRM2) || (rotg->eType==erotgFLEX2) || (rotg->eType==erotgFLEX2T) )
+ {
+ fprintf(fp, "# rot_eps%d %12.5e nm^2\n", g, rotg->eps);
+ }
+ if (erotgFitPOT == rotg->eFittype)
+ {
+ fprintf(fp, "#\n");
+ fprintf(fp, "# theta_fit%d is determined by first evaluating the potential for %d angles around theta_ref%d.\n",
+ g, rotg->PotAngle_nstep, g);
+ fprintf(fp, "# The fit angle is the one with the smallest potential. It is given as the deviation\n");
+ fprintf(fp, "# from the reference angle, i.e. if theta_ref=X and theta_fit=Y, then the angle with\n");
+ fprintf(fp, "# minimal value of the potential is X+Y. Angular resolution is %g degrees.\n", rotg->PotAngle_step);
+ }
+ }
+
+ /* Print a nice legend */
+ snew(LegendStr, 1);
+ LegendStr[0] = '\0';
+ sprintf(buf, "# %6s", "time");
+ add_to_string_aligned(&LegendStr, buf);
+
+ nsets = 0;
+ snew(setname, 4*rot->ngrp);
+
+ for (g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ sprintf(buf, "theta_ref%d", g);
+ add_to_string_aligned(&LegendStr, buf);
+
+ sprintf(buf2, "%s (degrees)", buf);
+ setname[nsets] = strdup(buf2);
+ nsets++;
+ }
+ for (g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ bFlex = ISFLEX(rotg);
+
+ /* For flexible axis rotation we use RMSD fitting to determine the
+ * actual angle of the rotation group */
+ if (bFlex || erotgFitPOT == rotg->eFittype)
+ sprintf(buf, "theta_fit%d", g);
+ else
+ sprintf(buf, "theta_av%d", g);
+ add_to_string_aligned(&LegendStr, buf);
+ sprintf(buf2, "%s (degrees)", buf);
+ setname[nsets] = strdup(buf2);
+ nsets++;
+
+ sprintf(buf, "tau%d", g);
+ add_to_string_aligned(&LegendStr, buf);
+ sprintf(buf2, "%s (kJ/mol)", buf);
+ setname[nsets] = strdup(buf2);
+ nsets++;
+
+ sprintf(buf, "energy%d", g);
+ add_to_string_aligned(&LegendStr, buf);
+ sprintf(buf2, "%s (kJ/mol)", buf);
+ setname[nsets] = strdup(buf2);
+ nsets++;
+ }
+ fprintf(fp, "#\n");
+
+ if (nsets > 1)
+ xvgr_legend(fp, nsets, setname, oenv);
+ sfree(setname);
+
+ fprintf(fp, "#\n# Legend for the following data columns:\n");
+ fprintf(fp, "%s\n", LegendStr);
+ sfree(LegendStr);
+
+ fflush(fp);
+ }
+
+ return fp;
+}
+
+
+/* Call on master only */
+static FILE *open_angles_out(const char *fn, t_rot *rot, const output_env_t oenv)
+{
+ int g,i;
+ FILE *fp;
+ t_rotgrp *rotg;
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ char buf[100];
+
+
+ if (rot->enfrot->Flags & MD_APPENDFILES)
+ {
+ fp = gmx_fio_fopen(fn,"a");
+ }
+ else
+ {
+ /* Open output file and write some information about it's structure: */
+ fp = open_output_file(fn, rot->nstsout, "rotation group angles");
+ fprintf(fp, "# All angles given in degrees, time in ps.\n");
+ for (g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ erg=rotg->enfrotgrp;
+
+ /* Output for this group happens only if potential type is flexible or
+ * if fit type is potential! */
+ if ( ISFLEX(rotg) || (erotgFitPOT == rotg->eFittype) )
+ {
+ if (ISFLEX(rotg))
+ sprintf(buf, " slab distance %f nm, ", rotg->slab_dist);
+ else
+ buf[0] = '\0';
+
+ fprintf(fp, "#\n# ROTATION GROUP %d '%s',%s fit type '%s'.\n",
+ g, erotg_names[rotg->eType], buf, erotg_fitnames[rotg->eFittype]);
+
+ /* Special type of fitting using the potential minimum. This is
+ * done for the whole group only, not for the individual slabs. */
+ if (erotgFitPOT == rotg->eFittype)
+ {
+ fprintf(fp, "# To obtain theta_fit%d, the potential is evaluated for %d angles around theta_ref%d\n", g, rotg->PotAngle_nstep, g);
+ fprintf(fp, "# The fit angle in the rotation standard outfile is the one with minimal energy E(theta_fit) [kJ/mol].\n");
+ fprintf(fp, "#\n");
+ }
+
+ fprintf(fp, "# Legend for the group %d data columns:\n", g);
+ fprintf(fp, "# ");
+ print_aligned_short(fp, "time");
+ print_aligned_short(fp, "grp");
+ print_aligned(fp, "theta_ref");
+
+ if (erotgFitPOT == rotg->eFittype)
+ {
+ /* Output the set of angles around the reference angle */
+ for (i = 0; i < rotg->PotAngle_nstep; i++)
+ {
+ sprintf(buf, "E(%g)", erg->PotAngleFit->degangle[i]);
+ print_aligned(fp, buf);
+ }
+ }
+ else
+ {
+ /* Output fit angle for each slab */
+ print_aligned_short(fp, "slab");
+ print_aligned_short(fp, "atoms");
+ print_aligned(fp, "theta_fit");
+ print_aligned_short(fp, "slab");
+ print_aligned_short(fp, "atoms");
+ print_aligned(fp, "theta_fit");
+ fprintf(fp, " ...");
+ }
+ fprintf(fp, "\n");
+ }
+ }
+ fflush(fp);
+ }
+
+ return fp;
+}
+
+
+/* Open torque output file and write some information about it's structure.
+ * Call on master only */
+static FILE *open_torque_out(const char *fn, t_rot *rot, const output_env_t oenv)
+{
+ FILE *fp;
+ int g;
+ t_rotgrp *rotg;
+
+
+ if (rot->enfrot->Flags & MD_APPENDFILES)
+ {
+ fp = gmx_fio_fopen(fn,"a");
+ }
+ else
+ {
+ fp = open_output_file(fn, rot->nstsout,"torques");
+
+ for (g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ if (ISFLEX(rotg))
+ {
+ fprintf(fp, "# Rotation group %d (%s), slab distance %f nm.\n", g, erotg_names[rotg->eType], rotg->slab_dist);
+ fprintf(fp, "# The scalar tau is the torque (kJ/mol) in the direction of the rotation vector.\n");
+ fprintf(fp, "# To obtain the vectorial torque, multiply tau with\n");
+ fprintf(fp, "# rot_vec%d %10.3e %10.3e %10.3e\n", g, rotg->vec[XX], rotg->vec[YY], rotg->vec[ZZ]);
+ fprintf(fp, "#\n");
+ }
+ }
+ fprintf(fp, "# Legend for the following data columns: (tau=torque for that slab):\n");
+ fprintf(fp, "# ");
+ print_aligned_short(fp, "t");
+ print_aligned_short(fp, "grp");
+ print_aligned_short(fp, "slab");
+ print_aligned(fp, "tau");
+ print_aligned_short(fp, "slab");
+ print_aligned(fp, "tau");
+ fprintf(fp, " ...\n");
+ fflush(fp);
+ }
+
+ return fp;
+}
+
+
+static void swap_val(double* vec, int i, int j)
+{
+ double tmp = vec[j];
+
+
+ vec[j]=vec[i];
+ vec[i]=tmp;
+}
+
+
+static void swap_col(double **mat, int i, int j)
+{
+ double tmp[3] = {mat[0][j], mat[1][j], mat[2][j]};
+
+
+ mat[0][j]=mat[0][i];
+ mat[1][j]=mat[1][i];
+ mat[2][j]=mat[2][i];
+
+ mat[0][i]=tmp[0];
+ mat[1][i]=tmp[1];
+ mat[2][i]=tmp[2];
+}
+
+
+/* Eigenvectors are stored in columns of eigen_vec */
+static void diagonalize_symmetric(
+ double **matrix,
+ double **eigen_vec,
+ double eigenval[3])
+{
+ int n_rot;
+
+
+ jacobi(matrix,3,eigenval,eigen_vec,&n_rot);
+
+ /* sort in ascending order */
+ if (eigenval[0] > eigenval[1])
+ {
+ swap_val(eigenval, 0, 1);
+ swap_col(eigen_vec, 0, 1);
+ }
+ if (eigenval[1] > eigenval[2])
+ {
+ swap_val(eigenval, 1, 2);
+ swap_col(eigen_vec, 1, 2);
+ }
+ if (eigenval[0] > eigenval[1])
+ {
+ swap_val(eigenval, 0, 1);
+ swap_col(eigen_vec, 0, 1);
+ }
+}
+
+
+static void align_with_z(
+ rvec* s, /* Structure to align */
+ int natoms,
+ rvec axis)
+{
+ int i, j, k;
+ rvec zet = {0.0, 0.0, 1.0};
+ rvec rot_axis={0.0, 0.0, 0.0};
+ rvec *rotated_str=NULL;
+ real ooanorm;
+ real angle;
+ matrix rotmat;
+
+
+ snew(rotated_str, natoms);
+
+ /* Normalize the axis */
+ ooanorm = 1.0/norm(axis);
+ svmul(ooanorm, axis, axis);
+
+ /* Calculate the angle for the fitting procedure */
+ cprod(axis, zet, rot_axis);
+ angle = acos(axis[2]);
+ if (angle < 0.0)
+ angle += M_PI;
+
+ /* Calculate the rotation matrix */
+ calc_rotmat(rot_axis, angle*180.0/M_PI, rotmat);
+
+ /* Apply the rotation matrix to s */
+ for (i=0; i<natoms; i++)
+ {
+ for(j=0; j<3; j++)
+ {
+ for(k=0; k<3; k++)
+ {
+ rotated_str[i][j] += rotmat[j][k]*s[i][k];
+ }
+ }
+ }
+
+ /* Rewrite the rotated structure to s */
+ for(i=0; i<natoms; i++)
+ {
+ for(j=0; j<3; j++)
+ {
+ s[i][j]=rotated_str[i][j];
+ }
+ }
+
+ sfree(rotated_str);
+}
+
+
+static void calc_correl_matrix(rvec* Xstr, rvec* Ystr, double** Rmat, int natoms)
+{
+ int i, j, k;
+
+
+ for (i=0; i<3; i++)
+ for (j=0; j<3; j++)
+ Rmat[i][j] = 0.0;
+
+ for (i=0; i<3; i++)
+ for (j=0; j<3; j++)
+ for (k=0; k<natoms; k++)
+ Rmat[i][j] += Ystr[k][i] * Xstr[k][j];
+}
+
+
+static void weigh_coords(rvec* str, real* weight, int natoms)
+{
+ int i, j;
+
+
+ for(i=0; i<natoms; i++)
+ {
+ for(j=0; j<3; j++)
+ str[i][j] *= sqrt(weight[i]);
+ }
+}
+
+
+static real opt_angle_analytic(
+ rvec* ref_s,
+ rvec* act_s,
+ real* weight,
+ int natoms,
+ rvec ref_com,
+ rvec act_com,
+ rvec axis)
+{
+ int i, j, k;
+ rvec *ref_s_1=NULL;
+ rvec *act_s_1=NULL;
+ rvec shift;
+ double **Rmat, **RtR, **eigvec;
+ double eigval[3];
+ double V[3][3], WS[3][3];
+ double rot_matrix[3][3];
+ double opt_angle;
+
+
+ /* Do not change the original coordinates */
+ snew(ref_s_1, natoms);
+ snew(act_s_1, natoms);
+ for(i=0; i<natoms; i++)
+ {
+ copy_rvec(ref_s[i], ref_s_1[i]);
+ copy_rvec(act_s[i], act_s_1[i]);
+ }
+
+ /* Translate the structures to the origin */
+ shift[XX] = -ref_com[XX];
+ shift[YY] = -ref_com[YY];
+ shift[ZZ] = -ref_com[ZZ];
+ translate_x(ref_s_1, natoms, shift);
+
+ shift[XX] = -act_com[XX];
+ shift[YY] = -act_com[YY];
+ shift[ZZ] = -act_com[ZZ];
+ translate_x(act_s_1, natoms, shift);
+
+ /* Align rotation axis with z */
+ align_with_z(ref_s_1, natoms, axis);
+ align_with_z(act_s_1, natoms, axis);
+
+ /* Correlation matrix */
+ Rmat = allocate_square_matrix(3);
+
+ for (i=0; i<natoms; i++)
+ {
+ ref_s_1[i][2]=0.0;
+ act_s_1[i][2]=0.0;
+ }
+
+ /* Weight positions with sqrt(weight) */
+ if (NULL != weight)
+ {
+ weigh_coords(ref_s_1, weight, natoms);
+ weigh_coords(act_s_1, weight, natoms);
+ }
+
+ /* Calculate correlation matrices R=YXt (X=ref_s; Y=act_s) */
+ calc_correl_matrix(ref_s_1, act_s_1, Rmat, natoms);
+
+ /* Calculate RtR */
+ RtR = allocate_square_matrix(3);
+ for (i=0; i<3; i++)
+ {
+ for (j=0; j<3; j++)
+ {
+ for (k=0; k<3; k++)
+ {
+ RtR[i][j] += Rmat[k][i] * Rmat[k][j];
+ }
+ }
+ }
+ /* Diagonalize RtR */
+ snew(eigvec,3);
+ for (i=0; i<3; i++)
+ snew(eigvec[i],3);
+
+ diagonalize_symmetric(RtR, eigvec, eigval);
+ swap_col(eigvec,0,1);
+ swap_col(eigvec,1,2);
+ swap_val(eigval,0,1);
+ swap_val(eigval,1,2);
+
+ /* Calculate V */
+ for(i=0; i<3; i++)
+ {
+ for(j=0; j<3; j++)
+ {
+ V[i][j] = 0.0;
+ WS[i][j] = 0.0;
+ }
+ }
+
+ for (i=0; i<2; i++)
+ for (j=0; j<2; j++)
+ WS[i][j] = eigvec[i][j] / sqrt(eigval[j]);
+
+ for (i=0; i<3; i++)
+ {
+ for (j=0; j<3; j++)
+ {
+ for (k=0; k<3; k++)
+ {
+ V[i][j] += Rmat[i][k]*WS[k][j];
+ }
+ }
+ }
+ free_square_matrix(Rmat, 3);
+
+ /* Calculate optimal rotation matrix */
+ for (i=0; i<3; i++)
+ for (j=0; j<3; j++)
+ rot_matrix[i][j] = 0.0;
+
+ for (i=0; i<3; i++)
+ {
+ for(j=0; j<3; j++)
+ {
+ for(k=0; k<3; k++){
+ rot_matrix[i][j] += eigvec[i][k]*V[j][k];
+ }
+ }
+ }
+ rot_matrix[2][2] = 1.0;
+
+ /* In some cases abs(rot_matrix[0][0]) can be slighly larger
+ * than unity due to numerical inacurracies. To be able to calculate
+ * the acos function, we put these values back in range. */
+ if (rot_matrix[0][0] > 1.0)
+ {
+ rot_matrix[0][0] = 1.0;
+ }
+ else if (rot_matrix[0][0] < -1.0)
+ {
+ rot_matrix[0][0] = -1.0;
+ }
+
+ /* Determine the optimal rotation angle: */
+ opt_angle = (-1.0)*acos(rot_matrix[0][0])*180.0/M_PI;
+ if (rot_matrix[0][1] < 0.0)
+ opt_angle = (-1.0)*opt_angle;
+
+ /* Give back some memory */
+ free_square_matrix(RtR, 3);
+ sfree(ref_s_1);
+ sfree(act_s_1);
+ for (i=0; i<3; i++)
+ sfree(eigvec[i]);
+ sfree(eigvec);
+
+ return (real) opt_angle;
+}
+
+
+/* Determine angle of the group by RMSD fit to the reference */
+/* Not parallelized, call this routine only on the master */
+static real flex_fit_angle(t_rotgrp *rotg)
+{
+ int i;
+ rvec *fitcoords=NULL;
+ rvec center; /* Center of positions passed to the fit routine */
+ real fitangle; /* Angle of the rotation group derived by fitting */
+ rvec coord;
+ real scal;
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+
+
+ erg=rotg->enfrotgrp;
+
+ /* Get the center of the rotation group.
+ * Note, again, erg->xc has been sorted in do_flexible */
+ get_center(erg->xc, erg->mc_sorted, rotg->nat, center);
+
+ /* === Determine the optimal fit angle for the rotation group === */
+ if (rotg->eFittype == erotgFitNORM)
+ {
+ /* Normalize every position to it's reference length */
+ for (i=0; i<rotg->nat; i++)
+ {
+ /* Put the center of the positions into the origin */
+ rvec_sub(erg->xc[i], center, coord);
+ /* Determine the scaling factor for the length: */
+ scal = erg->xc_ref_length[erg->xc_sortind[i]] / norm(coord);
+ /* Get position, multiply with the scaling factor and save */
+ svmul(scal, coord, erg->xc_norm[i]);
+ }
+ fitcoords = erg->xc_norm;
+ }
+ else
+ {
+ fitcoords = erg->xc;
+ }
+ /* From the point of view of the current positions, the reference has rotated
+ * backwards. Since we output the angle relative to the fixed reference,
+ * we need the minus sign. */
+ fitangle = -opt_angle_analytic(erg->xc_ref_sorted, fitcoords, erg->mc_sorted,
+ rotg->nat, erg->xc_ref_center, center, rotg->vec);
+
+ return fitangle;
+}
+
+
+/* Determine actual angle of each slab by RMSD fit to the reference */
+/* Not parallelized, call this routine only on the master */
+static void flex_fit_angle_perslab(
+ int g,
+ t_rotgrp *rotg,
+ double t,
+ real degangle,
+ FILE *fp)
+{
+ int i,l,n,islab,ind;
+ rvec curr_x, ref_x;
+ rvec act_center; /* Center of actual positions that are passed to the fit routine */
+ rvec ref_center; /* Same for the reference positions */
+ real fitangle; /* Angle of a slab derived from an RMSD fit to
+ * the reference structure at t=0 */
+ t_gmx_slabdata *sd;
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ real OOm_av; /* 1/average_mass of a rotation group atom */
+ real m_rel; /* Relative mass of a rotation group atom */
+
+
+ erg=rotg->enfrotgrp;
+
+ /* Average mass of a rotation group atom: */
+ OOm_av = erg->invmass*rotg->nat;
+
+ /**********************************/
+ /* First collect the data we need */
+ /**********************************/
+
+ /* Collect the data for the individual slabs */
+ for (n = erg->slab_first; n <= erg->slab_last; n++)
+ {
+ islab = n - erg->slab_first; /* slab index */
+ sd = &(rotg->enfrotgrp->slab_data[islab]);
+ sd->nat = erg->lastatom[islab]-erg->firstatom[islab]+1;
+ ind = 0;
+
+ /* Loop over the relevant atoms in the slab */
+ for (l=erg->firstatom[islab]; l<=erg->lastatom[islab]; l++)
+ {
+ /* Current position of this atom: x[ii][XX/YY/ZZ] */
+ copy_rvec(erg->xc[l], curr_x);
+
+ /* The (unrotated) reference position of this atom is copied to ref_x.
+ * Beware, the xc coords have been sorted in do_flexible */
+ copy_rvec(erg->xc_ref_sorted[l], ref_x);
+
+ /* Save data for doing angular RMSD fit later */
+ /* Save the current atom position */
+ copy_rvec(curr_x, sd->x[ind]);
+ /* Save the corresponding reference position */
+ copy_rvec(ref_x , sd->ref[ind]);
+
+ /* Maybe also mass-weighting was requested. If yes, additionally
+ * multiply the weights with the relative mass of the atom. If not,
+ * multiply with unity. */
+ m_rel = erg->mc_sorted[l]*OOm_av;
+
+ /* Save the weight for this atom in this slab */
+ sd->weight[ind] = gaussian_weight(curr_x, rotg, n) * m_rel;
+
+ /* Next atom in this slab */
+ ind++;
+ }
+ }
+
+ /******************************/
+ /* Now do the fit calculation */
+ /******************************/
+
+ fprintf(fp, "%12.3e%6d%12.3f", t, g, degangle);
+
+ /* === Now do RMSD fitting for each slab === */
+ /* We require at least SLAB_MIN_ATOMS in a slab, such that the fit makes sense. */
+#define SLAB_MIN_ATOMS 4
+
+ for (n = erg->slab_first; n <= erg->slab_last; n++)
+ {
+ islab = n - erg->slab_first; /* slab index */
+ sd = &(rotg->enfrotgrp->slab_data[islab]);
+ if (sd->nat >= SLAB_MIN_ATOMS)
+ {
+ /* Get the center of the slabs reference and current positions */
+ get_center(sd->ref, sd->weight, sd->nat, ref_center);
+ get_center(sd->x , sd->weight, sd->nat, act_center);
+ if (rotg->eFittype == erotgFitNORM)
+ {
+ /* Normalize every position to it's reference length
+ * prior to performing the fit */
+ for (i=0; i<sd->nat;i++) /* Center */
+ {
+ rvec_dec(sd->ref[i], ref_center);
+ rvec_dec(sd->x[i] , act_center);
+ /* Normalize x_i such that it gets the same length as ref_i */
+ svmul( norm(sd->ref[i])/norm(sd->x[i]), sd->x[i], sd->x[i] );
+ }
+ /* We already subtracted the centers */
+ clear_rvec(ref_center);
+ clear_rvec(act_center);
+ }
+ fitangle = -opt_angle_analytic(sd->ref, sd->x, sd->weight, sd->nat,
+ ref_center, act_center, rotg->vec);
+ fprintf(fp, "%6d%6d%12.3f", n, sd->nat, fitangle);
+ }
+ }
+ fprintf(fp , "\n");
+
+#undef SLAB_MIN_ATOMS
+}
+
+
+/* Shift x with is */
+static gmx_inline void shift_single_coord(matrix box, rvec x, const ivec is)
+{
+ int tx,ty,tz;
+
+
+ tx=is[XX];
+ ty=is[YY];
+ tz=is[ZZ];
+
+ if(TRICLINIC(box))
+ {
+ x[XX] += tx*box[XX][XX]+ty*box[YY][XX]+tz*box[ZZ][XX];
+ x[YY] += ty*box[YY][YY]+tz*box[ZZ][YY];
+ x[ZZ] += tz*box[ZZ][ZZ];
+ } else
+ {
+ x[XX] += tx*box[XX][XX];
+ x[YY] += ty*box[YY][YY];
+ x[ZZ] += tz*box[ZZ][ZZ];
+ }
+}
+
+
+/* Determine the 'home' slab of this atom which is the
+ * slab with the highest Gaussian weight of all */
+#define round(a) (int)(a+0.5)
+static gmx_inline int get_homeslab(
+ rvec curr_x, /* The position for which the home slab shall be determined */
+ rvec rotvec, /* The rotation vector */
+ real slabdist) /* The slab distance */
+{
+ real dist;
+
+
+ /* The distance of the atom to the coordinate center (where the
+ * slab with index 0) is */
+ dist = iprod(rotvec, curr_x);
+
+ return round(dist / slabdist);
+}
+
+
+/* For a local atom determine the relevant slabs, i.e. slabs in
+ * which the gaussian is larger than min_gaussian
+ */
+static int get_single_atom_gaussians(
+ rvec curr_x,
+ t_rotgrp *rotg)
+{
+ int slab, homeslab;
+ real g;
+ int count = 0;
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+
+
+ erg=rotg->enfrotgrp;
+
+ /* Determine the 'home' slab of this atom: */
+ homeslab = get_homeslab(curr_x, rotg->vec, rotg->slab_dist);
+
+ /* First determine the weight in the atoms home slab: */
+ g = gaussian_weight(curr_x, rotg, homeslab);
+
+ erg->gn_atom[count] = g;
+ erg->gn_slabind[count] = homeslab;
+ count++;
+
+
+ /* Determine the max slab */
+ slab = homeslab;
+ while (g > rotg->min_gaussian)
+ {
+ slab++;
+ g = gaussian_weight(curr_x, rotg, slab);
+ erg->gn_slabind[count]=slab;
+ erg->gn_atom[count]=g;
+ count++;
+ }
+ count--;
+
+ /* Determine the max slab */
+ slab = homeslab;
+ do
+ {
+ slab--;
+ g = gaussian_weight(curr_x, rotg, slab);
+ erg->gn_slabind[count]=slab;
+ erg->gn_atom[count]=g;
+ count++;
+ }
+ while (g > rotg->min_gaussian);
+ count--;
+
+ return count;
+}
+
+
+static void flex2_precalc_inner_sum(t_rotgrp *rotg)
+{
+ int i,n,islab;
+ rvec xi; /* positions in the i-sum */
+ rvec xcn, ycn; /* the current and the reference slab centers */
+ real gaussian_xi;
+ rvec yi0;
+ rvec rin; /* Helper variables */
+ real fac,fac2;
+ rvec innersumvec;
+ real OOpsii,OOpsiistar;
+ real sin_rin; /* s_ii.r_ii */
+ rvec s_in,tmpvec,tmpvec2;
+ real mi,wi; /* Mass-weighting of the positions */
+ real N_M; /* N/M */
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+
+
+ erg=rotg->enfrotgrp;
+ N_M = rotg->nat * erg->invmass;
+
+ /* Loop over all slabs that contain something */
+ for (n=erg->slab_first; n <= erg->slab_last; n++)
+ {
+ islab = n - erg->slab_first; /* slab index */
+
+ /* The current center of this slab is saved in xcn: */
+ copy_rvec(erg->slab_center[islab], xcn);
+ /* ... and the reference center in ycn: */
+ copy_rvec(erg->slab_center_ref[islab+erg->slab_buffer], ycn);
+
+ /*** D. Calculate the whole inner sum used for second and third sum */
+ /* For slab n, we need to loop over all atoms i again. Since we sorted
+ * the atoms with respect to the rotation vector, we know that it is sufficient
+ * to calculate from firstatom to lastatom only. All other contributions will
+ * be very small. */
+ clear_rvec(innersumvec);
+ for (i = erg->firstatom[islab]; i <= erg->lastatom[islab]; i++)
+ {
+ /* Coordinate xi of this atom */
+ copy_rvec(erg->xc[i],xi);
+
+ /* The i-weights */
+ gaussian_xi = gaussian_weight(xi,rotg,n);
+ mi = erg->mc_sorted[i]; /* need the sorted mass here */
+ wi = N_M*mi;
+
+ /* Calculate rin */
+ copy_rvec(erg->xc_ref_sorted[i],yi0); /* Reference position yi0 */
+ rvec_sub(yi0, ycn, tmpvec2); /* tmpvec2 = yi0 - ycn */
+ mvmul(erg->rotmat, tmpvec2, rin); /* rin = Omega.(yi0 - ycn) */
+
+ /* Calculate psi_i* and sin */
+ rvec_sub(xi, xcn, tmpvec2); /* tmpvec2 = xi - xcn */
+ cprod(rotg->vec, tmpvec2, tmpvec); /* tmpvec = v x (xi - xcn) */
+ OOpsiistar = norm2(tmpvec)+rotg->eps; /* OOpsii* = 1/psii* = |v x (xi-xcn)|^2 + eps */
+ OOpsii = norm(tmpvec); /* OOpsii = 1 / psii = |v x (xi - xcn)| */
+
+ /* v x (xi - xcn) */
+ unitv(tmpvec, s_in); /* sin = ---------------- */
+ /* |v x (xi - xcn)| */
+
+ sin_rin=iprod(s_in,rin); /* sin_rin = sin . rin */
+
+ /* Now the whole sum */
+ fac = OOpsii/OOpsiistar;
+ svmul(fac, rin, tmpvec);
+ fac2 = fac*fac*OOpsii;
+ svmul(fac2*sin_rin, s_in, tmpvec2);
+ rvec_dec(tmpvec, tmpvec2);
+
+ svmul(wi*gaussian_xi*sin_rin, tmpvec, tmpvec2);
+
+ rvec_inc(innersumvec,tmpvec2);
+ } /* now we have the inner sum, used both for sum2 and sum3 */
+
+ /* Save it to be used in do_flex2_lowlevel */
+ copy_rvec(innersumvec, erg->slab_innersumvec[islab]);
+ } /* END of loop over slabs */
+}
+
+
+static void flex_precalc_inner_sum(t_rotgrp *rotg)
+{
+ int i,n,islab;
+ rvec xi; /* position */
+ rvec xcn, ycn; /* the current and the reference slab centers */
+ rvec qin,rin; /* q_i^n and r_i^n */
+ real bin;
+ rvec tmpvec;
+ rvec innersumvec; /* Inner part of sum_n2 */
+ real gaussian_xi; /* Gaussian weight gn(xi) */
+ real mi,wi; /* Mass-weighting of the positions */
+ real N_M; /* N/M */
+
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+
+
+ erg=rotg->enfrotgrp;
+ N_M = rotg->nat * erg->invmass;
+
+ /* Loop over all slabs that contain something */
+ for (n=erg->slab_first; n <= erg->slab_last; n++)
+ {
+ islab = n - erg->slab_first; /* slab index */
+
+ /* The current center of this slab is saved in xcn: */
+ copy_rvec(erg->slab_center[islab], xcn);
+ /* ... and the reference center in ycn: */
+ copy_rvec(erg->slab_center_ref[islab+erg->slab_buffer], ycn);
+
+ /* For slab n, we need to loop over all atoms i again. Since we sorted
+ * the atoms with respect to the rotation vector, we know that it is sufficient
+ * to calculate from firstatom to lastatom only. All other contributions will
+ * be very small. */
+ clear_rvec(innersumvec);
+ for (i=erg->firstatom[islab]; i<=erg->lastatom[islab]; i++)
+ {
+ /* Coordinate xi of this atom */
+ copy_rvec(erg->xc[i],xi);
+
+ /* The i-weights */
+ gaussian_xi = gaussian_weight(xi,rotg,n);
+ mi = erg->mc_sorted[i]; /* need the sorted mass here */
+ wi = N_M*mi;
+
+ /* Calculate rin and qin */
+ rvec_sub(erg->xc_ref_sorted[i], ycn, tmpvec); /* tmpvec = yi0-ycn */
+ mvmul(erg->rotmat, tmpvec, rin); /* rin = Omega.(yi0 - ycn) */
+ cprod(rotg->vec, rin, tmpvec); /* tmpvec = v x Omega*(yi0-ycn) */
+
+ /* v x Omega*(yi0-ycn) */
+ unitv(tmpvec, qin); /* qin = --------------------- */
+ /* |v x Omega*(yi0-ycn)| */
+
+ /* Calculate bin */
+ rvec_sub(xi, xcn, tmpvec); /* tmpvec = xi-xcn */
+ bin = iprod(qin, tmpvec); /* bin = qin*(xi-xcn) */
+
+ svmul(wi*gaussian_xi*bin, qin, tmpvec);
+
+ /* Add this contribution to the inner sum: */
+ rvec_add(innersumvec, tmpvec, innersumvec);
+ } /* now we have the inner sum vector S^n for this slab */
+ /* Save it to be used in do_flex_lowlevel */
+ copy_rvec(innersumvec, erg->slab_innersumvec[islab]);
+ }
+}
+
+
+static real do_flex2_lowlevel(
+ t_rotgrp *rotg,
+ real sigma, /* The Gaussian width sigma */
+ rvec x[],
+ gmx_bool bOutstepRot,
+ gmx_bool bOutstepSlab,
+ matrix box)
+{
+ int count,ic,ii,j,m,n,islab,iigrp,ifit;
+ rvec xj; /* position in the i-sum */
+ rvec yj0; /* the reference position in the j-sum */
+ rvec xcn, ycn; /* the current and the reference slab centers */
+ real V; /* This node's part of the rotation pot. energy */
+ real gaussian_xj; /* Gaussian weight */
+ real beta;
+
+ real numerator,fit_numerator;
+ rvec rjn,fit_rjn; /* Helper variables */
+ real fac,fac2;
+
+ real OOpsij,OOpsijstar;
+ real OOsigma2; /* 1/(sigma^2) */
+ real sjn_rjn;
+ real betasigpsi;
+ rvec sjn,tmpvec,tmpvec2,yj0_ycn;
+ rvec sum1vec_part,sum1vec,sum2vec_part,sum2vec,sum3vec,sum4vec,innersumvec;
+ real sum3,sum4;
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ real mj,wj; /* Mass-weighting of the positions */
+ real N_M; /* N/M */
+ real Wjn; /* g_n(x_j) m_j / Mjn */
+ gmx_bool bCalcPotFit;
+
+ /* To calculate the torque per slab */
+ rvec slab_force; /* Single force from slab n on one atom */
+ rvec slab_sum1vec_part;
+ real slab_sum3part,slab_sum4part;
+ rvec slab_sum1vec, slab_sum2vec, slab_sum3vec, slab_sum4vec;
+
+
+ erg=rotg->enfrotgrp;
+
+ /* Pre-calculate the inner sums, so that we do not have to calculate
+ * them again for every atom */
+ flex2_precalc_inner_sum(rotg);
+
+ bCalcPotFit = (bOutstepRot || bOutstepSlab) && (erotgFitPOT==rotg->eFittype);
+
+ /********************************************************/
+ /* Main loop over all local atoms of the rotation group */
+ /********************************************************/
+ N_M = rotg->nat * erg->invmass;
+ V = 0.0;
+ OOsigma2 = 1.0 / (sigma*sigma);
+ for (j=0; j<erg->nat_loc; j++)
+ {
+ /* Local index of a rotation group atom */
+ ii = erg->ind_loc[j];
+ /* Position of this atom in the collective array */
+ iigrp = erg->xc_ref_ind[j];
+ /* Mass-weighting */
+ mj = erg->mc[iigrp]; /* need the unsorted mass here */
+ wj = N_M*mj;
+
+ /* Current position of this atom: x[ii][XX/YY/ZZ]
+ * Note that erg->xc_center contains the center of mass in case the flex2-t
+ * potential was chosen. For the flex2 potential erg->xc_center must be
+ * zero. */
+ rvec_sub(x[ii], erg->xc_center, xj);
+
+ /* Shift this atom such that it is near its reference */
+ shift_single_coord(box, xj, erg->xc_shifts[iigrp]);
+
+ /* Determine the slabs to loop over, i.e. the ones with contributions
+ * larger than min_gaussian */
+ count = get_single_atom_gaussians(xj, rotg);
+
+ clear_rvec(sum1vec_part);
+ clear_rvec(sum2vec_part);
+ sum3 = 0.0;
+ sum4 = 0.0;
+ /* Loop over the relevant slabs for this atom */
+ for (ic=0; ic < count; ic++)
+ {
+ n = erg->gn_slabind[ic];
+
+ /* Get the precomputed Gaussian value of curr_slab for curr_x */
+ gaussian_xj = erg->gn_atom[ic];
+
+ islab = n - erg->slab_first; /* slab index */
+
+ /* The (unrotated) reference position of this atom is copied to yj0: */
+ copy_rvec(rotg->x_ref[iigrp], yj0);
+
+ beta = calc_beta(xj, rotg,n);
+
+ /* The current center of this slab is saved in xcn: */
+ copy_rvec(erg->slab_center[islab], xcn);
+ /* ... and the reference center in ycn: */
+ copy_rvec(erg->slab_center_ref[islab+erg->slab_buffer], ycn);
+
+ rvec_sub(yj0, ycn, yj0_ycn); /* yj0_ycn = yj0 - ycn */
+
+ /* Rotate: */
+ mvmul(erg->rotmat, yj0_ycn, rjn); /* rjn = Omega.(yj0 - ycn) */
+
+ /* Subtract the slab center from xj */
+ rvec_sub(xj, xcn, tmpvec2); /* tmpvec2 = xj - xcn */
+
+ /* Calculate sjn */
+ cprod(rotg->vec, tmpvec2, tmpvec); /* tmpvec = v x (xj - xcn) */
+
+ OOpsijstar = norm2(tmpvec)+rotg->eps; /* OOpsij* = 1/psij* = |v x (xj-xcn)|^2 + eps */
+
+ numerator = sqr(iprod(tmpvec, rjn));
+
+ /*********************************/
+ /* Add to the rotation potential */
+ /*********************************/
+ V += 0.5*rotg->k*wj*gaussian_xj*numerator/OOpsijstar;
+
+ /* If requested, also calculate the potential for a set of angles
+ * near the current reference angle */
+ if (bCalcPotFit)
+ {
+ for (ifit = 0; ifit < rotg->PotAngle_nstep; ifit++)
+ {
+ mvmul(erg->PotAngleFit->rotmat[ifit], yj0_ycn, fit_rjn);
+ fit_numerator = sqr(iprod(tmpvec, fit_rjn));
+ erg->PotAngleFit->V[ifit] += 0.5*rotg->k*wj*gaussian_xj*fit_numerator/OOpsijstar;
+ }
+ }
+
+ /*************************************/
+ /* Now calculate the force on atom j */
+ /*************************************/
+
+ OOpsij = norm(tmpvec); /* OOpsij = 1 / psij = |v x (xj - xcn)| */
+
+ /* v x (xj - xcn) */
+ unitv(tmpvec, sjn); /* sjn = ---------------- */
+ /* |v x (xj - xcn)| */
+
+ sjn_rjn=iprod(sjn,rjn); /* sjn_rjn = sjn . rjn */
+
+
+ /*** A. Calculate the first of the four sum terms: ****************/
+ fac = OOpsij/OOpsijstar;
+ svmul(fac, rjn, tmpvec);
+ fac2 = fac*fac*OOpsij;
+ svmul(fac2*sjn_rjn, sjn, tmpvec2);
+ rvec_dec(tmpvec, tmpvec2);
+ fac2 = wj*gaussian_xj; /* also needed for sum4 */
+ svmul(fac2*sjn_rjn, tmpvec, slab_sum1vec_part);
+ /********************/
+ /*** Add to sum1: ***/
+ /********************/
+ rvec_inc(sum1vec_part, slab_sum1vec_part); /* sum1 still needs to vector multiplied with v */
+
+ /*** B. Calculate the forth of the four sum terms: ****************/
+ betasigpsi = beta*OOsigma2*OOpsij; /* this is also needed for sum3 */
+ /********************/
+ /*** Add to sum4: ***/
+ /********************/
+ slab_sum4part = fac2*betasigpsi*fac*sjn_rjn*sjn_rjn; /* Note that fac is still valid from above */
+ sum4 += slab_sum4part;
+
+ /*** C. Calculate Wjn for second and third sum */
+ /* Note that we can safely divide by slab_weights since we check in
+ * get_slab_centers that it is non-zero. */
+ Wjn = gaussian_xj*mj/erg->slab_weights[islab];
+
+ /* We already have precalculated the inner sum for slab n */
+ copy_rvec(erg->slab_innersumvec[islab], innersumvec);
+
+ /* Weigh the inner sum vector with Wjn */
+ svmul(Wjn, innersumvec, innersumvec);
+
+ /*** E. Calculate the second of the four sum terms: */
+ /********************/
+ /*** Add to sum2: ***/
+ /********************/
+ rvec_inc(sum2vec_part, innersumvec); /* sum2 still needs to be vector crossproduct'ed with v */
+
+ /*** F. Calculate the third of the four sum terms: */
+ slab_sum3part = betasigpsi * iprod(sjn, innersumvec);
+ sum3 += slab_sum3part; /* still needs to be multiplied with v */
+
+ /*** G. Calculate the torque on the local slab's axis: */
+ if (bOutstepRot)
+ {
+ /* Sum1 */
+ cprod(slab_sum1vec_part, rotg->vec, slab_sum1vec);
+ /* Sum2 */
+ cprod(innersumvec, rotg->vec, slab_sum2vec);
+ /* Sum3 */
+ svmul(slab_sum3part, rotg->vec, slab_sum3vec);
+ /* Sum4 */
+ svmul(slab_sum4part, rotg->vec, slab_sum4vec);
+
+ /* The force on atom ii from slab n only: */
+ for (m=0; m<DIM; m++)
+ slab_force[m] = rotg->k * (-slab_sum1vec[m] + slab_sum2vec[m] - slab_sum3vec[m] + 0.5*slab_sum4vec[m]);
+
+ erg->slab_torque_v[islab] += torque(rotg->vec, slab_force, xj, xcn);
+ }
+ } /* END of loop over slabs */
+
+ /* Construct the four individual parts of the vector sum: */
+ cprod(sum1vec_part, rotg->vec, sum1vec); /* sum1vec = { } x v */
+ cprod(sum2vec_part, rotg->vec, sum2vec); /* sum2vec = { } x v */
+ svmul(sum3, rotg->vec, sum3vec); /* sum3vec = { } . v */
+ svmul(sum4, rotg->vec, sum4vec); /* sum4vec = { } . v */
+
+ /* Store the additional force so that it can be added to the force
+ * array after the normal forces have been evaluated */
+ for (m=0; m<DIM; m++)
+ erg->f_rot_loc[j][m] = rotg->k * (-sum1vec[m] + sum2vec[m] - sum3vec[m] + 0.5*sum4vec[m]);
+
+#ifdef SUM_PARTS
+ fprintf(stderr, "sum1: %15.8f %15.8f %15.8f\n", -rotg->k*sum1vec[XX], -rotg->k*sum1vec[YY], -rotg->k*sum1vec[ZZ]);
+ fprintf(stderr, "sum2: %15.8f %15.8f %15.8f\n", rotg->k*sum2vec[XX], rotg->k*sum2vec[YY], rotg->k*sum2vec[ZZ]);
+ fprintf(stderr, "sum3: %15.8f %15.8f %15.8f\n", -rotg->k*sum3vec[XX], -rotg->k*sum3vec[YY], -rotg->k*sum3vec[ZZ]);
+ fprintf(stderr, "sum4: %15.8f %15.8f %15.8f\n", 0.5*rotg->k*sum4vec[XX], 0.5*rotg->k*sum4vec[YY], 0.5*rotg->k*sum4vec[ZZ]);
+#endif
+
+ PRINT_FORCE_J
+
+ } /* END of loop over local atoms */
+
+ return V;
+}
+
+
+static real do_flex_lowlevel(
+ t_rotgrp *rotg,
+ real sigma, /* The Gaussian width sigma */
+ rvec x[],
+ gmx_bool bOutstepRot,
+ gmx_bool bOutstepSlab,
+ matrix box)
+{
+ int count,ic,ifit,ii,j,m,n,islab,iigrp;
+ rvec xj,yj0; /* current and reference position */
+ rvec xcn, ycn; /* the current and the reference slab centers */
+ rvec yj0_ycn; /* yj0 - ycn */
+ rvec xj_xcn; /* xj - xcn */
+ rvec qjn,fit_qjn; /* q_i^n */
+ rvec sum_n1,sum_n2; /* Two contributions to the rotation force */
+ rvec innersumvec; /* Inner part of sum_n2 */
+ rvec s_n;
+ rvec force_n; /* Single force from slab n on one atom */
+ rvec force_n1,force_n2; /* First and second part of force_n */
+ rvec tmpvec,tmpvec2,tmp_f; /* Helper variables */
+ real V; /* The rotation potential energy */
+ real OOsigma2; /* 1/(sigma^2) */
+ real beta; /* beta_n(xj) */
+ real bjn, fit_bjn; /* b_j^n */
+ real gaussian_xj; /* Gaussian weight gn(xj) */
+ real betan_xj_sigma2;
+ real mj,wj; /* Mass-weighting of the positions */
+ real N_M; /* N/M */
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ gmx_bool bCalcPotFit;
+
+
+ erg=rotg->enfrotgrp;
+
+ /* Pre-calculate the inner sums, so that we do not have to calculate
+ * them again for every atom */
+ flex_precalc_inner_sum(rotg);
+
+ bCalcPotFit = (bOutstepRot || bOutstepSlab) && (erotgFitPOT==rotg->eFittype);
+
+ /********************************************************/
+ /* Main loop over all local atoms of the rotation group */
+ /********************************************************/
+ OOsigma2 = 1.0/(sigma*sigma);
+ N_M = rotg->nat * erg->invmass;
+ V = 0.0;
+ for (j=0; j<erg->nat_loc; j++)
+ {
+ /* Local index of a rotation group atom */
+ ii = erg->ind_loc[j];
+ /* Position of this atom in the collective array */
+ iigrp = erg->xc_ref_ind[j];
+ /* Mass-weighting */
+ mj = erg->mc[iigrp]; /* need the unsorted mass here */
+ wj = N_M*mj;
+
+ /* Current position of this atom: x[ii][XX/YY/ZZ]
+ * Note that erg->xc_center contains the center of mass in case the flex-t
+ * potential was chosen. For the flex potential erg->xc_center must be
+ * zero. */
+ rvec_sub(x[ii], erg->xc_center, xj);
+
+ /* Shift this atom such that it is near its reference */
+ shift_single_coord(box, xj, erg->xc_shifts[iigrp]);
+
+ /* Determine the slabs to loop over, i.e. the ones with contributions
+ * larger than min_gaussian */
+ count = get_single_atom_gaussians(xj, rotg);
+
+ clear_rvec(sum_n1);
+ clear_rvec(sum_n2);
+
+ /* Loop over the relevant slabs for this atom */
+ for (ic=0; ic < count; ic++)
+ {
+ n = erg->gn_slabind[ic];
+
+ /* Get the precomputed Gaussian for xj in slab n */
+ gaussian_xj = erg->gn_atom[ic];
+
+ islab = n - erg->slab_first; /* slab index */
+
+ /* The (unrotated) reference position of this atom is saved in yj0: */
+ copy_rvec(rotg->x_ref[iigrp], yj0);
+
+ beta = calc_beta(xj, rotg, n);
+
+ /* The current center of this slab is saved in xcn: */
+ copy_rvec(erg->slab_center[islab], xcn);
+ /* ... and the reference center in ycn: */
+ copy_rvec(erg->slab_center_ref[islab+erg->slab_buffer], ycn);
+
+ rvec_sub(yj0, ycn, yj0_ycn); /* yj0_ycn = yj0 - ycn */
+
+ /* Rotate: */
+ mvmul(erg->rotmat, yj0_ycn, tmpvec2); /* tmpvec2= Omega.(yj0-ycn) */
+
+ /* Subtract the slab center from xj */
+ rvec_sub(xj, xcn, xj_xcn); /* xj_xcn = xj - xcn */
+
+ /* Calculate qjn */
+ cprod(rotg->vec, tmpvec2, tmpvec); /* tmpvec= v x Omega.(yj0-ycn) */
+
+ /* v x Omega.(yj0-ycn) */
+ unitv(tmpvec,qjn); /* qjn = --------------------- */
+ /* |v x Omega.(yj0-ycn)| */
+
+ bjn = iprod(qjn, xj_xcn); /* bjn = qjn * (xj - xcn) */
+
+ /*********************************/
+ /* Add to the rotation potential */
+ /*********************************/
+ V += 0.5*rotg->k*wj*gaussian_xj*sqr(bjn);
+
+ /* If requested, also calculate the potential for a set of angles
+ * near the current reference angle */
+ if (bCalcPotFit)
+ {
+ for (ifit = 0; ifit < rotg->PotAngle_nstep; ifit++)
+ {
+ /* As above calculate Omega.(yj0-ycn), now for the other angles */
+ mvmul(erg->PotAngleFit->rotmat[ifit], yj0_ycn, tmpvec2); /* tmpvec2= Omega.(yj0-ycn) */
+ /* As above calculate qjn */
+ cprod(rotg->vec, tmpvec2, tmpvec); /* tmpvec= v x Omega.(yj0-ycn) */
+ /* v x Omega.(yj0-ycn) */
+ unitv(tmpvec,fit_qjn); /* fit_qjn = --------------------- */
+ /* |v x Omega.(yj0-ycn)| */
+ fit_bjn = iprod(fit_qjn, xj_xcn); /* fit_bjn = fit_qjn * (xj - xcn) */
+ /* Add to the rotation potential for this angle */
+ erg->PotAngleFit->V[ifit] += 0.5*rotg->k*wj*gaussian_xj*sqr(fit_bjn);
+ }
+ }
+
+ /****************************************************************/
+ /* sum_n1 will typically be the main contribution to the force: */
+ /****************************************************************/
+ betan_xj_sigma2 = beta*OOsigma2; /* beta_n(xj)/sigma^2 */
+
+ /* The next lines calculate
+ * qjn - (bjn*beta(xj)/(2sigma^2))v */
+ svmul(bjn*0.5*betan_xj_sigma2, rotg->vec, tmpvec2);
+ rvec_sub(qjn,tmpvec2,tmpvec);
+
+ /* Multiply with gn(xj)*bjn: */
+ svmul(gaussian_xj*bjn,tmpvec,tmpvec2);
+
+ /* Sum over n: */
+ rvec_inc(sum_n1,tmpvec2);
+
+ /* We already have precalculated the Sn term for slab n */
+ copy_rvec(erg->slab_innersumvec[islab], s_n);
+ /* beta_n(xj) */
+ svmul(betan_xj_sigma2*iprod(s_n, xj_xcn), rotg->vec, tmpvec); /* tmpvec = ---------- s_n (xj-xcn) */
+ /* sigma^2 */
+
+ rvec_sub(s_n, tmpvec, innersumvec);
+
+ /* We can safely divide by slab_weights since we check in get_slab_centers
+ * that it is non-zero. */
+ svmul(gaussian_xj/erg->slab_weights[islab], innersumvec, innersumvec);
+
+ rvec_add(sum_n2, innersumvec, sum_n2);
+
+ /* Calculate the torque: */
+ if (bOutstepRot)
+ {
+ /* The force on atom ii from slab n only: */
+ svmul(-rotg->k*wj, tmpvec2 , force_n1); /* part 1 */
+ svmul( rotg->k*mj, innersumvec, force_n2); /* part 2 */
+ rvec_add(force_n1, force_n2, force_n);
+ erg->slab_torque_v[islab] += torque(rotg->vec, force_n, xj, xcn);
+ }
+ } /* END of loop over slabs */
+
+ /* Put both contributions together: */
+ svmul(wj, sum_n1, sum_n1);
+ svmul(mj, sum_n2, sum_n2);
+ rvec_sub(sum_n2,sum_n1,tmp_f); /* F = -grad V */
+
+ /* Store the additional force so that it can be added to the force
+ * array after the normal forces have been evaluated */
+ for(m=0; m<DIM; m++)
+ erg->f_rot_loc[j][m] = rotg->k*tmp_f[m];
+
+ PRINT_FORCE_J
+
+ } /* END of loop over local atoms */
+
+ return V;
+}
+
+#ifdef PRINT_COORDS
+static void print_coordinates(t_rotgrp *rotg, rvec x[], matrix box, int step)
+{
+ int i;
+ static FILE *fp;
+ static char buf[STRLEN];
+ static gmx_bool bFirst=1;
+
+
+ if (bFirst)
+ {
+ sprintf(buf, "coords%d.txt", cr->nodeid);
+ fp = fopen(buf, "w");
+ bFirst = 0;
+ }
+
+ fprintf(fp, "\nStep %d\n", step);
+ fprintf(fp, "box: %f %f %f %f %f %f %f %f %f\n",
+ box[XX][XX], box[XX][YY], box[XX][ZZ],
+ box[YY][XX], box[YY][YY], box[YY][ZZ],
+ box[ZZ][XX], box[ZZ][ZZ], box[ZZ][ZZ]);
+ for (i=0; i<rotg->nat; i++)
+ {
+ fprintf(fp, "%4d %f %f %f\n", i,
+ erg->xc[i][XX], erg->xc[i][YY], erg->xc[i][ZZ]);
+ }
+ fflush(fp);
+
+}
+#endif
+
+
+static int projection_compare(const void *a, const void *b)
+{
+ sort_along_vec_t *xca, *xcb;
+
+
+ xca = (sort_along_vec_t *)a;
+ xcb = (sort_along_vec_t *)b;
+
+ if (xca->xcproj < xcb->xcproj)
+ return -1;
+ else if (xca->xcproj > xcb->xcproj)
+ return 1;
+ else
+ return 0;
+}
+
+
+static void sort_collective_coordinates(
+ t_rotgrp *rotg, /* Rotation group */
+ sort_along_vec_t *data) /* Buffer for sorting the positions */
+{
+ int i;
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+
+
+ erg=rotg->enfrotgrp;
+
+ /* The projection of the position vector on the rotation vector is
+ * the relevant value for sorting. Fill the 'data' structure */
+ for (i=0; i<rotg->nat; i++)
+ {
+ data[i].xcproj = iprod(erg->xc[i], rotg->vec); /* sort criterium */
+ data[i].m = erg->mc[i];
+ data[i].ind = i;
+ copy_rvec(erg->xc[i] , data[i].x );
+ copy_rvec(rotg->x_ref[i], data[i].x_ref);
+ }
+ /* Sort the 'data' structure */
+ gmx_qsort(data, rotg->nat, sizeof(sort_along_vec_t), projection_compare);
+
+ /* Copy back the sorted values */
+ for (i=0; i<rotg->nat; i++)
+ {
+ copy_rvec(data[i].x , erg->xc[i] );
+ copy_rvec(data[i].x_ref, erg->xc_ref_sorted[i]);
+ erg->mc_sorted[i] = data[i].m;
+ erg->xc_sortind[i] = data[i].ind;
+ }
+}
+
+
+/* For each slab, get the first and the last index of the sorted atom
+ * indices */
+static void get_firstlast_atom_per_slab(t_rotgrp *rotg)
+{
+ int i,islab,n;
+ real beta;
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+
+
+ erg=rotg->enfrotgrp;
+
+ /* Find the first atom that needs to enter the calculation for each slab */
+ n = erg->slab_first; /* slab */
+ i = 0; /* start with the first atom */
+ do
+ {
+ /* Find the first atom that significantly contributes to this slab */
+ do /* move forward in position until a large enough beta is found */
+ {
+ beta = calc_beta(erg->xc[i], rotg, n);
+ i++;
+ } while ((beta < -erg->max_beta) && (i < rotg->nat));
+ i--;
+ islab = n - erg->slab_first; /* slab index */
+ erg->firstatom[islab] = i;
+ /* Proceed to the next slab */
+ n++;
+ } while (n <= erg->slab_last);
+
+ /* Find the last atom for each slab */
+ n = erg->slab_last; /* start with last slab */
+ i = rotg->nat-1; /* start with the last atom */
+ do
+ {
+ do /* move backward in position until a large enough beta is found */
+ {
+ beta = calc_beta(erg->xc[i], rotg, n);
+ i--;
+ } while ((beta > erg->max_beta) && (i > -1));
+ i++;
+ islab = n - erg->slab_first; /* slab index */
+ erg->lastatom[islab] = i;
+ /* Proceed to the next slab */
+ n--;
+ } while (n >= erg->slab_first);
+}
+
+
+/* Determine the very first and very last slab that needs to be considered
+ * For the first slab that needs to be considered, we have to find the smallest
+ * n that obeys:
+ *
+ * x_first * v - n*Delta_x <= beta_max
+ *
+ * slab index n, slab distance Delta_x, rotation vector v. For the last slab we
+ * have to find the largest n that obeys
+ *
+ * x_last * v - n*Delta_x >= -beta_max
+ *
+ */
+static gmx_inline int get_first_slab(
+ t_rotgrp *rotg, /* The rotation group (inputrec data) */
+ real max_beta, /* The max_beta value, instead of min_gaussian */
+ rvec firstatom) /* First atom after sorting along the rotation vector v */
+{
+ /* Find the first slab for the first atom */
+ return ceil((iprod(firstatom, rotg->vec) - max_beta)/rotg->slab_dist);
+}
+
+
+static gmx_inline int get_last_slab(
+ t_rotgrp *rotg, /* The rotation group (inputrec data) */
+ real max_beta, /* The max_beta value, instead of min_gaussian */
+ rvec lastatom) /* Last atom along v */
+{
+ /* Find the last slab for the last atom */
+ return floor((iprod(lastatom, rotg->vec) + max_beta)/rotg->slab_dist);
+}
+
+
+static void get_firstlast_slab_check(
+ t_rotgrp *rotg, /* The rotation group (inputrec data) */
+ t_gmx_enfrotgrp *erg, /* The rotation group (data only accessible in this file) */
+ rvec firstatom, /* First atom after sorting along the rotation vector v */
+ rvec lastatom, /* Last atom along v */
+ int g) /* The rotation group number */
+{
+ erg->slab_first = get_first_slab(rotg, erg->max_beta, firstatom);
+ erg->slab_last = get_last_slab(rotg, erg->max_beta, lastatom);
+
+ /* Check whether we have reference data to compare against */
+ if (erg->slab_first < erg->slab_first_ref)
+ gmx_fatal(FARGS, "%s No reference data for first slab (n=%d), unable to proceed.",
+ RotStr, erg->slab_first);
+
+ /* Check whether we have reference data to compare against */
+ if (erg->slab_last > erg->slab_last_ref)
+ gmx_fatal(FARGS, "%s No reference data for last slab (n=%d), unable to proceed.",
+ RotStr, erg->slab_last);
+}
+
+
+/* Enforced rotation with a flexible axis */
+static void do_flexible(
+ gmx_bool bMaster,
+ gmx_enfrot_t enfrot, /* Other rotation data */
+ t_rotgrp *rotg, /* The rotation group */
+ int g, /* Group number */
+ rvec x[], /* The local positions */
+ matrix box,
+ double t, /* Time in picoseconds */
+ gmx_large_int_t step, /* The time step */
+ gmx_bool bOutstepRot, /* Output to main rotation output file */
+ gmx_bool bOutstepSlab) /* Output per-slab data */
+{
+ int l,nslabs;
+ real sigma; /* The Gaussian width sigma */
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+
+
+ erg=rotg->enfrotgrp;
+
+ /* Define the sigma value */
+ sigma = 0.7*rotg->slab_dist;
+
+ /* Sort the collective coordinates erg->xc along the rotation vector. This is
+ * an optimization for the inner loop. */
+ sort_collective_coordinates(rotg, enfrot->data);
+
+ /* Determine the first relevant slab for the first atom and the last
+ * relevant slab for the last atom */
+ get_firstlast_slab_check(rotg, erg, erg->xc[0], erg->xc[rotg->nat-1], g);
+
+ /* Determine for each slab depending on the min_gaussian cutoff criterium,
+ * a first and a last atom index inbetween stuff needs to be calculated */
+ get_firstlast_atom_per_slab(rotg);
+
+ /* Determine the gaussian-weighted center of positions for all slabs */
+ get_slab_centers(rotg,erg->xc,erg->mc_sorted,g,t,enfrot->out_slabs,bOutstepSlab,FALSE);
+
+ /* Clear the torque per slab from last time step: */
+ nslabs = erg->slab_last - erg->slab_first + 1;
+ for (l=0; l<nslabs; l++)
+ erg->slab_torque_v[l] = 0.0;
+
+ /* Call the rotational forces kernel */
+ if (rotg->eType == erotgFLEX || rotg->eType == erotgFLEXT)
+ erg->V = do_flex_lowlevel(rotg, sigma, x, bOutstepRot, bOutstepSlab, box);
+ else if (rotg->eType == erotgFLEX2 || rotg->eType == erotgFLEX2T)
+ erg->V = do_flex2_lowlevel(rotg, sigma, x, bOutstepRot, bOutstepSlab, box);
+ else
+ gmx_fatal(FARGS, "Unknown flexible rotation type");
+
+ /* Determine angle by RMSD fit to the reference - Let's hope this */
+ /* only happens once in a while, since this is not parallelized! */
+ if ( bMaster && (erotgFitPOT != rotg->eFittype) )
+ {
+ if (bOutstepRot)
+ {
+ /* Fit angle of the whole rotation group */
+ erg->angle_v = flex_fit_angle(rotg);
+ }
+ if (bOutstepSlab)
+ {
+ /* Fit angle of each slab */
+ flex_fit_angle_perslab(g, rotg, t, erg->degangle, enfrot->out_angles);
+ }
+ }
+
+ /* Lump together the torques from all slabs: */
+ erg->torque_v = 0.0;
+ for (l=0; l<nslabs; l++)
+ erg->torque_v += erg->slab_torque_v[l];
+}
+
+
+/* Calculate the angle between reference and actual rotation group atom,
+ * both projected into a plane perpendicular to the rotation vector: */
+static void angle(t_rotgrp *rotg,
+ rvec x_act,
+ rvec x_ref,
+ real *alpha,
+ real *weight) /* atoms near the rotation axis should count less than atoms far away */
+{
+ rvec xp, xrp; /* current and reference positions projected on a plane perpendicular to pg->vec */
+ rvec dum;
+
+
+ /* Project x_ref and x into a plane through the origin perpendicular to rot_vec: */
+ /* Project x_ref: xrp = x_ref - (vec * x_ref) * vec */
+ svmul(iprod(rotg->vec, x_ref), rotg->vec, dum);
+ rvec_sub(x_ref, dum, xrp);
+ /* Project x_act: */
+ svmul(iprod(rotg->vec, x_act), rotg->vec, dum);
+ rvec_sub(x_act, dum, xp);
+
+ /* Retrieve information about which vector precedes. gmx_angle always
+ * returns a positive angle. */
+ cprod(xp, xrp, dum); /* if reference precedes, this is pointing into the same direction as vec */
+
+ if (iprod(rotg->vec, dum) >= 0)
+ *alpha = -gmx_angle(xrp, xp);
+ else
+ *alpha = +gmx_angle(xrp, xp);
+
+ /* Also return the weight */
+ *weight = norm(xp);
+}
+
+
+/* Project first vector onto a plane perpendicular to the second vector
+ * dr = dr - (dr.v)v
+ * Note that v must be of unit length.
+ */
+static gmx_inline void project_onto_plane(rvec dr, const rvec v)
+{
+ rvec tmp;
+
+
+ svmul(iprod(dr,v),v,tmp); /* tmp = (dr.v)v */
+ rvec_dec(dr, tmp); /* dr = dr - (dr.v)v */
+}
+
+
+/* Fixed rotation: The rotation reference group rotates around the v axis. */
+/* The atoms of the actual rotation group are attached with imaginary */
+/* springs to the reference atoms. */
+static void do_fixed(
+ t_rotgrp *rotg, /* The rotation group */
+ rvec x[], /* The positions */
+ matrix box, /* The simulation box */
+ double t, /* Time in picoseconds */
+ gmx_large_int_t step, /* The time step */
+ gmx_bool bOutstepRot, /* Output to main rotation output file */
+ gmx_bool bOutstepSlab) /* Output per-slab data */
+{
+ int ifit,j,jj,m;
+ rvec dr;
+ rvec tmp_f; /* Force */
+ real alpha; /* a single angle between an actual and a reference position */
+ real weight; /* single weight for a single angle */
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ rvec xi_xc; /* xi - xc */
+ gmx_bool bCalcPotFit;
+ rvec fit_xr_loc;
+
+ /* for mass weighting: */
+ real wi; /* Mass-weighting of the positions */
+ real N_M; /* N/M */
+ real k_wi; /* k times wi */
+
+ gmx_bool bProject;
+
+
+ erg=rotg->enfrotgrp;
+ bProject = (rotg->eType==erotgPM) || (rotg->eType==erotgPMPF);
+ bCalcPotFit = (bOutstepRot || bOutstepSlab) && (erotgFitPOT==rotg->eFittype);
+
+ N_M = rotg->nat * erg->invmass;
+
+ /* Each process calculates the forces on its local atoms */
+ for (j=0; j<erg->nat_loc; j++)
+ {
+ /* Calculate (x_i-x_c) resp. (x_i-u) */
+ rvec_sub(erg->x_loc_pbc[j], erg->xc_center, xi_xc);
+
+ /* Calculate Omega*(y_i-y_c)-(x_i-x_c) */
+ rvec_sub(erg->xr_loc[j], xi_xc, dr);
+
+ if (bProject)
+ project_onto_plane(dr, rotg->vec);
+
+ /* Mass-weighting */
+ wi = N_M*erg->m_loc[j];
+
+ /* Store the additional force so that it can be added to the force
+ * array after the normal forces have been evaluated */
+ k_wi = rotg->k*wi;
+ for (m=0; m<DIM; m++)
+ {
+ tmp_f[m] = k_wi*dr[m];
+ erg->f_rot_loc[j][m] = tmp_f[m];
+ erg->V += 0.5*k_wi*sqr(dr[m]);
+ }
+
+ /* If requested, also calculate the potential for a set of angles
+ * near the current reference angle */
+ if (bCalcPotFit)
+ {
+ for (ifit = 0; ifit < rotg->PotAngle_nstep; ifit++)
+ {
+ /* Index of this rotation group atom with respect to the whole rotation group */
+ jj = erg->xc_ref_ind[j];
+
+ /* Rotate with the alternative angle. Like rotate_local_reference(),
+ * just for a single local atom */
+ mvmul(erg->PotAngleFit->rotmat[ifit], rotg->x_ref[jj], fit_xr_loc); /* fit_xr_loc = Omega*(y_i-y_c) */
+
+ /* Calculate Omega*(y_i-y_c)-(x_i-x_c) */
+ rvec_sub(fit_xr_loc, xi_xc, dr);
+
+ if (bProject)
+ project_onto_plane(dr, rotg->vec);
+
+ /* Add to the rotation potential for this angle: */
+ erg->PotAngleFit->V[ifit] += 0.5*k_wi*norm2(dr);
+ }
+ }
+
+ if (bOutstepRot)
+ {
+ /* Add to the torque of this rotation group */
+ erg->torque_v += torque(rotg->vec, tmp_f, erg->x_loc_pbc[j], erg->xc_center);
+
+ /* Calculate the angle between reference and actual rotation group atom. */
+ angle(rotg, xi_xc, erg->xr_loc[j], &alpha, &weight); /* angle in rad, weighted */
+ erg->angle_v += alpha * weight;
+ erg->weight_v += weight;
+ }
+ /* If you want enforced rotation to contribute to the virial,
+ * activate the following lines:
+ if (MASTER(cr))
+ {
+ Add the rotation contribution to the virial
+ for(j=0; j<DIM; j++)
+ for(m=0;m<DIM;m++)
+ vir[j][m] += 0.5*f[ii][j]*dr[m];
+ }
+ */
+
+ PRINT_FORCE_J
+
+ } /* end of loop over local rotation group atoms */
+}
+
+
+/* Calculate the radial motion potential and forces */
+static void do_radial_motion(
+ t_rotgrp *rotg, /* The rotation group */
+ rvec x[], /* The positions */
+ matrix box, /* The simulation box */
+ double t, /* Time in picoseconds */
+ gmx_large_int_t step, /* The time step */
+ gmx_bool bOutstepRot, /* Output to main rotation output file */
+ gmx_bool bOutstepSlab) /* Output per-slab data */
+{
+ int j,jj,ifit;
+ rvec tmp_f; /* Force */
+ real alpha; /* a single angle between an actual and a reference position */
+ real weight; /* single weight for a single angle */
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ rvec xj_u; /* xj - u */
+ rvec tmpvec,fit_tmpvec;
+ real fac,fac2,sum=0.0;
+ rvec pj;
+ gmx_bool bCalcPotFit;
+
+ /* For mass weighting: */
+ real wj; /* Mass-weighting of the positions */
+ real N_M; /* N/M */
+
+
+ erg=rotg->enfrotgrp;
+ bCalcPotFit = (bOutstepRot || bOutstepSlab) && (erotgFitPOT==rotg->eFittype);
+
+ N_M = rotg->nat * erg->invmass;
+
+ /* Each process calculates the forces on its local atoms */
+ for (j=0; j<erg->nat_loc; j++)
+ {
+ /* Calculate (xj-u) */
+ rvec_sub(erg->x_loc_pbc[j], erg->xc_center, xj_u); /* xj_u = xj-u */
+
+ /* Calculate Omega.(yj0-u) */
+ cprod(rotg->vec, erg->xr_loc[j], tmpvec); /* tmpvec = v x Omega.(yj0-u) */
+
+ /* v x Omega.(yj0-u) */
+ unitv(tmpvec, pj); /* pj = --------------------- */
+ /* | v x Omega.(yj0-u) | */
+
+ fac = iprod(pj, xj_u); /* fac = pj.(xj-u) */
+ fac2 = fac*fac;
+
+ /* Mass-weighting */
+ wj = N_M*erg->m_loc[j];
+
+ /* Store the additional force so that it can be added to the force
+ * array after the normal forces have been evaluated */
+ svmul(-rotg->k*wj*fac, pj, tmp_f);
+ copy_rvec(tmp_f, erg->f_rot_loc[j]);
+ sum += wj*fac2;
+
+ /* If requested, also calculate the potential for a set of angles
+ * near the current reference angle */
+ if (bCalcPotFit)
+ {
+ for (ifit = 0; ifit < rotg->PotAngle_nstep; ifit++)
+ {
+ /* Index of this rotation group atom with respect to the whole rotation group */
+ jj = erg->xc_ref_ind[j];
+
+ /* Rotate with the alternative angle. Like rotate_local_reference(),
+ * just for a single local atom */
+ mvmul(erg->PotAngleFit->rotmat[ifit], rotg->x_ref[jj], fit_tmpvec); /* fit_tmpvec = Omega*(yj0-u) */
+
+ /* Calculate Omega.(yj0-u) */
+ cprod(rotg->vec, fit_tmpvec, tmpvec); /* tmpvec = v x Omega.(yj0-u) */
+ /* v x Omega.(yj0-u) */
+ unitv(tmpvec, pj); /* pj = --------------------- */
+ /* | v x Omega.(yj0-u) | */
+
+ fac = iprod(pj, xj_u); /* fac = pj.(xj-u) */
+ fac2 = fac*fac;
+
+ /* Add to the rotation potential for this angle: */
+ erg->PotAngleFit->V[ifit] += 0.5*rotg->k*wj*fac2;
+ }
+ }
+
+ if (bOutstepRot)
+ {
+ /* Add to the torque of this rotation group */
+ erg->torque_v += torque(rotg->vec, tmp_f, erg->x_loc_pbc[j], erg->xc_center);
+
+ /* Calculate the angle between reference and actual rotation group atom. */
+ angle(rotg, xj_u, erg->xr_loc[j], &alpha, &weight); /* angle in rad, weighted */
+ erg->angle_v += alpha * weight;
+ erg->weight_v += weight;
+ }
+
+ PRINT_FORCE_J
+
+ } /* end of loop over local rotation group atoms */
+ erg->V = 0.5*rotg->k*sum;
+}
+
+
+/* Calculate the radial motion pivot-free potential and forces */
+static void do_radial_motion_pf(
+ t_rotgrp *rotg, /* The rotation group */
+ rvec x[], /* The positions */
+ matrix box, /* The simulation box */
+ double t, /* Time in picoseconds */
+ gmx_large_int_t step, /* The time step */
+ gmx_bool bOutstepRot, /* Output to main rotation output file */
+ gmx_bool bOutstepSlab) /* Output per-slab data */
+{
+ int i,ii,iigrp,ifit,j;
+ rvec xj; /* Current position */
+ rvec xj_xc; /* xj - xc */
+ rvec yj0_yc0; /* yj0 - yc0 */
+ rvec tmp_f; /* Force */
+ real alpha; /* a single angle between an actual and a reference position */
+ real weight; /* single weight for a single angle */
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ rvec tmpvec, tmpvec2;
+ rvec innersumvec; /* Precalculation of the inner sum */
+ rvec innersumveckM;
+ real fac,fac2,V=0.0;
+ rvec qi,qj;
+ gmx_bool bCalcPotFit;
+
+ /* For mass weighting: */
+ real mj,wi,wj; /* Mass-weighting of the positions */
+ real N_M; /* N/M */
+
+
+ erg=rotg->enfrotgrp;
+ bCalcPotFit = (bOutstepRot || bOutstepSlab) && (erotgFitPOT==rotg->eFittype);
+
+ N_M = rotg->nat * erg->invmass;
+
+ /* Get the current center of the rotation group: */
+ get_center(erg->xc, erg->mc, rotg->nat, erg->xc_center);
+
+ /* Precalculate Sum_i [ wi qi.(xi-xc) qi ] which is needed for every single j */
+ clear_rvec(innersumvec);
+ for (i=0; i < rotg->nat; i++)
+ {
+ /* Mass-weighting */
+ wi = N_M*erg->mc[i];
+
+ /* Calculate qi. Note that xc_ref_center has already been subtracted from
+ * x_ref in init_rot_group.*/
+ mvmul(erg->rotmat, rotg->x_ref[i], tmpvec); /* tmpvec = Omega.(yi0-yc0) */
+
+ cprod(rotg->vec, tmpvec, tmpvec2); /* tmpvec2 = v x Omega.(yi0-yc0) */
+
+ /* v x Omega.(yi0-yc0) */
+ unitv(tmpvec2, qi); /* qi = ----------------------- */
+ /* | v x Omega.(yi0-yc0) | */
+
+ rvec_sub(erg->xc[i], erg->xc_center, tmpvec); /* tmpvec = xi-xc */
+
+ svmul(wi*iprod(qi, tmpvec), qi, tmpvec2);
+
+ rvec_inc(innersumvec, tmpvec2);
+ }
+ svmul(rotg->k*erg->invmass, innersumvec, innersumveckM);
+
+ /* Each process calculates the forces on its local atoms */
+ for (j=0; j<erg->nat_loc; j++)
+ {
+ /* Local index of a rotation group atom */
+ ii = erg->ind_loc[j];
+ /* Position of this atom in the collective array */
+ iigrp = erg->xc_ref_ind[j];
+ /* Mass-weighting */
+ mj = erg->mc[iigrp]; /* need the unsorted mass here */
+ wj = N_M*mj;
+
+ /* Current position of this atom: x[ii][XX/YY/ZZ] */
+ copy_rvec(x[ii], xj);
+
+ /* Shift this atom such that it is near its reference */
+ shift_single_coord(box, xj, erg->xc_shifts[iigrp]);
+
+ /* The (unrotated) reference position is yj0. yc0 has already
+ * been subtracted in init_rot_group */
+ copy_rvec(rotg->x_ref[iigrp], yj0_yc0); /* yj0_yc0 = yj0 - yc0 */
+
+ /* Calculate Omega.(yj0-yc0) */
+ mvmul(erg->rotmat, yj0_yc0, tmpvec2); /* tmpvec2 = Omega.(yj0 - yc0) */
+
+ cprod(rotg->vec, tmpvec2, tmpvec); /* tmpvec = v x Omega.(yj0-yc0) */
+
+ /* v x Omega.(yj0-yc0) */
+ unitv(tmpvec, qj); /* qj = ----------------------- */
+ /* | v x Omega.(yj0-yc0) | */
+
+ /* Calculate (xj-xc) */
+ rvec_sub(xj, erg->xc_center, xj_xc); /* xj_xc = xj-xc */
+
+ fac = iprod(qj, xj_xc); /* fac = qj.(xj-xc) */
+ fac2 = fac*fac;
+
+ /* Store the additional force so that it can be added to the force
+ * array after the normal forces have been evaluated */
+ svmul(-rotg->k*wj*fac, qj, tmp_f); /* part 1 of force */
+ svmul(mj, innersumveckM, tmpvec); /* part 2 of force */
+ rvec_inc(tmp_f, tmpvec);
+ copy_rvec(tmp_f, erg->f_rot_loc[j]);
+ V += wj*fac2;
+
+ /* If requested, also calculate the potential for a set of angles
+ * near the current reference angle */
+ if (bCalcPotFit)
+ {
+ for (ifit = 0; ifit < rotg->PotAngle_nstep; ifit++)
+ {
+ /* Rotate with the alternative angle. Like rotate_local_reference(),
+ * just for a single local atom */
+ mvmul(erg->PotAngleFit->rotmat[ifit], yj0_yc0, tmpvec2); /* tmpvec2 = Omega*(yj0-yc0) */
+
+ /* Calculate Omega.(yj0-u) */
+ cprod(rotg->vec, tmpvec2, tmpvec); /* tmpvec = v x Omega.(yj0-yc0) */
+ /* v x Omega.(yj0-yc0) */
+ unitv(tmpvec, qj); /* qj = ----------------------- */
+ /* | v x Omega.(yj0-yc0) | */
+
+ fac = iprod(qj, xj_xc); /* fac = qj.(xj-xc) */
+ fac2 = fac*fac;
+
+ /* Add to the rotation potential for this angle: */
+ erg->PotAngleFit->V[ifit] += 0.5*rotg->k*wj*fac2;
+ }
+ }
+
+ if (bOutstepRot)
+ {
+ /* Add to the torque of this rotation group */
+ erg->torque_v += torque(rotg->vec, tmp_f, xj, erg->xc_center);
+
+ /* Calculate the angle between reference and actual rotation group atom. */
+ angle(rotg, xj_xc, yj0_yc0, &alpha, &weight); /* angle in rad, weighted */
+ erg->angle_v += alpha * weight;
+ erg->weight_v += weight;
+ }
+
+ PRINT_FORCE_J
+
+ } /* end of loop over local rotation group atoms */
+ erg->V = 0.5*rotg->k*V;
+}
+
+
+/* Precalculate the inner sum for the radial motion 2 forces */
+static void radial_motion2_precalc_inner_sum(t_rotgrp *rotg, rvec innersumvec)
+{
+ int i;
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ rvec xi_xc; /* xj - xc */
+ rvec tmpvec,tmpvec2;
+ real fac,fac2;
+ rvec ri,si;
+ real siri;
+ rvec v_xi_xc; /* v x (xj - u) */
+ real psii,psiistar;
+ real wi; /* Mass-weighting of the positions */
+ real N_M; /* N/M */
+ rvec sumvec;
+
+ erg=rotg->enfrotgrp;
+ N_M = rotg->nat * erg->invmass;
+
+ /* Loop over the collective set of positions */
+ clear_rvec(sumvec);
+ for (i=0; i<rotg->nat; i++)
+ {
+ /* Mass-weighting */
+ wi = N_M*erg->mc[i];
+
+ rvec_sub(erg->xc[i], erg->xc_center, xi_xc); /* xi_xc = xi-xc */
+
+ /* Calculate ri. Note that xc_ref_center has already been subtracted from
+ * x_ref in init_rot_group.*/
+ mvmul(erg->rotmat, rotg->x_ref[i], ri); /* ri = Omega.(yi0-yc0) */
+
+ cprod(rotg->vec, xi_xc, v_xi_xc); /* v_xi_xc = v x (xi-u) */
+
+ fac = norm2(v_xi_xc);
+ /* 1 */
+ psiistar = 1.0/(fac + rotg->eps); /* psiistar = --------------------- */
+ /* |v x (xi-xc)|^2 + eps */
+
+ psii = gmx_invsqrt(fac); /* 1 */
+ /* psii = ------------- */
+ /* |v x (xi-xc)| */
+
+ svmul(psii, v_xi_xc, si); /* si = psii * (v x (xi-xc) ) */
+
+ fac = iprod(v_xi_xc, ri); /* fac = (v x (xi-xc)).ri */
+ fac2 = fac*fac;
+
+ siri = iprod(si, ri); /* siri = si.ri */
+
+ svmul(psiistar/psii, ri, tmpvec);
+ svmul(psiistar*psiistar/(psii*psii*psii) * siri, si, tmpvec2);
+ rvec_dec(tmpvec, tmpvec2);
+ cprod(tmpvec, rotg->vec, tmpvec2);
+
+ svmul(wi*siri, tmpvec2, tmpvec);
+
+ rvec_inc(sumvec, tmpvec);
+ }
+ svmul(rotg->k*erg->invmass, sumvec, innersumvec);
+}
+
+
+/* Calculate the radial motion 2 potential and forces */
+static void do_radial_motion2(
+ t_rotgrp *rotg, /* The rotation group */
+ rvec x[], /* The positions */
+ matrix box, /* The simulation box */
+ double t, /* Time in picoseconds */
+ gmx_large_int_t step, /* The time step */
+ gmx_bool bOutstepRot, /* Output to main rotation output file */
+ gmx_bool bOutstepSlab) /* Output per-slab data */
+{
+ int ii,iigrp,ifit,j;
+ rvec xj; /* Position */
+ real alpha; /* a single angle between an actual and a reference position */
+ real weight; /* single weight for a single angle */
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ rvec xj_u; /* xj - u */
+ rvec yj0_yc0; /* yj0 -yc0 */
+ rvec tmpvec,tmpvec2;
+ real fac,fit_fac,fac2,Vpart=0.0;
+ rvec rj,fit_rj,sj;
+ real sjrj;
+ rvec v_xj_u; /* v x (xj - u) */
+ real psij,psijstar;
+ real mj,wj; /* For mass-weighting of the positions */
+ real N_M; /* N/M */
+ gmx_bool bPF;
+ rvec innersumvec;
+ gmx_bool bCalcPotFit;
+
+
+ erg=rotg->enfrotgrp;
+
+ bPF = rotg->eType==erotgRM2PF;
+ bCalcPotFit = (bOutstepRot || bOutstepSlab) && (erotgFitPOT==rotg->eFittype);
+
+
+ clear_rvec(yj0_yc0); /* Make the compiler happy */
+
+ clear_rvec(innersumvec);
+ if (bPF)
+ {
+ /* For the pivot-free variant we have to use the current center of
+ * mass of the rotation group instead of the pivot u */
+ get_center(erg->xc, erg->mc, rotg->nat, erg->xc_center);
+
+ /* Also, we precalculate the second term of the forces that is identical
+ * (up to the weight factor mj) for all forces */
+ radial_motion2_precalc_inner_sum(rotg,innersumvec);
+ }
+
+ N_M = rotg->nat * erg->invmass;
+
+ /* Each process calculates the forces on its local atoms */
+ for (j=0; j<erg->nat_loc; j++)
+ {
+ if (bPF)
+ {
+ /* Local index of a rotation group atom */
+ ii = erg->ind_loc[j];
+ /* Position of this atom in the collective array */
+ iigrp = erg->xc_ref_ind[j];
+ /* Mass-weighting */
+ mj = erg->mc[iigrp];
+
+ /* Current position of this atom: x[ii] */
+ copy_rvec(x[ii], xj);
+
+ /* Shift this atom such that it is near its reference */
+ shift_single_coord(box, xj, erg->xc_shifts[iigrp]);
+
+ /* The (unrotated) reference position is yj0. yc0 has already
+ * been subtracted in init_rot_group */
+ copy_rvec(rotg->x_ref[iigrp], yj0_yc0); /* yj0_yc0 = yj0 - yc0 */
+
+ /* Calculate Omega.(yj0-yc0) */
+ mvmul(erg->rotmat, yj0_yc0, rj); /* rj = Omega.(yj0-yc0) */
+ }
+ else
+ {
+ mj = erg->m_loc[j];
+ copy_rvec(erg->x_loc_pbc[j], xj);
+ copy_rvec(erg->xr_loc[j], rj); /* rj = Omega.(yj0-u) */
+ }
+ /* Mass-weighting */
+ wj = N_M*mj;
+
+ /* Calculate (xj-u) resp. (xj-xc) */
+ rvec_sub(xj, erg->xc_center, xj_u); /* xj_u = xj-u */
+
+ cprod(rotg->vec, xj_u, v_xj_u); /* v_xj_u = v x (xj-u) */
+
+ fac = norm2(v_xj_u);
+ /* 1 */
+ psijstar = 1.0/(fac + rotg->eps); /* psistar = -------------------- */
+ /* |v x (xj-u)|^2 + eps */
+
+ psij = gmx_invsqrt(fac); /* 1 */
+ /* psij = ------------ */
+ /* |v x (xj-u)| */
+
+ svmul(psij, v_xj_u, sj); /* sj = psij * (v x (xj-u) ) */
+
+ fac = iprod(v_xj_u, rj); /* fac = (v x (xj-u)).rj */
+ fac2 = fac*fac;
+
+ sjrj = iprod(sj, rj); /* sjrj = sj.rj */
+
+ svmul(psijstar/psij, rj, tmpvec);
+ svmul(psijstar*psijstar/(psij*psij*psij) * sjrj, sj, tmpvec2);
+ rvec_dec(tmpvec, tmpvec2);
+ cprod(tmpvec, rotg->vec, tmpvec2);
+
+ /* Store the additional force so that it can be added to the force
+ * array after the normal forces have been evaluated */
+ svmul(-rotg->k*wj*sjrj, tmpvec2, tmpvec);
+ svmul(mj, innersumvec, tmpvec2); /* This is != 0 only for the pivot-free variant */
+
+ rvec_add(tmpvec2, tmpvec, erg->f_rot_loc[j]);
+ Vpart += wj*psijstar*fac2;
+
+ /* If requested, also calculate the potential for a set of angles
+ * near the current reference angle */
+ if (bCalcPotFit)
+ {
+ for (ifit = 0; ifit < rotg->PotAngle_nstep; ifit++)
+ {
+ if (bPF)
+ {
+ mvmul(erg->PotAngleFit->rotmat[ifit], yj0_yc0, fit_rj); /* fit_rj = Omega.(yj0-yc0) */
+ }
+ else
+ {
+ /* Position of this atom in the collective array */
+ iigrp = erg->xc_ref_ind[j];
+ /* Rotate with the alternative angle. Like rotate_local_reference(),
+ * just for a single local atom */
+ mvmul(erg->PotAngleFit->rotmat[ifit], rotg->x_ref[iigrp], fit_rj); /* fit_rj = Omega*(yj0-u) */
+ }
+ fit_fac = iprod(v_xj_u, fit_rj); /* fac = (v x (xj-u)).fit_rj */
+ /* Add to the rotation potential for this angle: */
+ erg->PotAngleFit->V[ifit] += 0.5*rotg->k*wj*psijstar*fit_fac*fit_fac;
+ }
+ }
+
+ if (bOutstepRot)
+ {
+ /* Add to the torque of this rotation group */
+ erg->torque_v += torque(rotg->vec, erg->f_rot_loc[j], xj, erg->xc_center);
+
+ /* Calculate the angle between reference and actual rotation group atom. */
+ angle(rotg, xj_u, rj, &alpha, &weight); /* angle in rad, weighted */
+ erg->angle_v += alpha * weight;
+ erg->weight_v += weight;
+ }
+
+ PRINT_FORCE_J
+
+ } /* end of loop over local rotation group atoms */
+ erg->V = 0.5*rotg->k*Vpart;
+}
+
+
+/* Determine the smallest and largest position vector (with respect to the
+ * rotation vector) for the reference group */
+static void get_firstlast_atom_ref(
+ t_rotgrp *rotg,
+ int *firstindex,
+ int *lastindex)
+{
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ int i;
+ real xcproj; /* The projection of a reference position on the
+ rotation vector */
+ real minproj, maxproj; /* Smallest and largest projection on v */
+
+
+
+ erg=rotg->enfrotgrp;
+
+ /* Start with some value */
+ minproj = iprod(rotg->x_ref[0], rotg->vec);
+ maxproj = minproj;
+
+ /* This is just to ensure that it still works if all the atoms of the
+ * reference structure are situated in a plane perpendicular to the rotation
+ * vector */
+ *firstindex = 0;
+ *lastindex = rotg->nat-1;
+
+ /* Loop over all atoms of the reference group,
+ * project them on the rotation vector to find the extremes */
+ for (i=0; i<rotg->nat; i++)
+ {
+ xcproj = iprod(rotg->x_ref[i], rotg->vec);
+ if (xcproj < minproj)
+ {
+ minproj = xcproj;
+ *firstindex = i;
+ }
+ if (xcproj > maxproj)
+ {
+ maxproj = xcproj;
+ *lastindex = i;
+ }
+ }
+}
+
+
+/* Allocate memory for the slabs */
+static void allocate_slabs(
+ t_rotgrp *rotg,
+ FILE *fplog,
+ int g,
+ gmx_bool bVerbose)
+{
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ int i, nslabs;
+
+
+ erg=rotg->enfrotgrp;
+
+ /* More slabs than are defined for the reference are never needed */
+ nslabs = erg->slab_last_ref - erg->slab_first_ref + 1;
+
+ /* Remember how many we allocated */
+ erg->nslabs_alloc = nslabs;
+
+ if ( (NULL != fplog) && bVerbose )
+ fprintf(fplog, "%s allocating memory to store data for %d slabs (rotation group %d).\n",
+ RotStr, nslabs,g);
+ snew(erg->slab_center , nslabs);
+ snew(erg->slab_center_ref , nslabs);
+ snew(erg->slab_weights , nslabs);
+ snew(erg->slab_torque_v , nslabs);
+ snew(erg->slab_data , nslabs);
+ snew(erg->gn_atom , nslabs);
+ snew(erg->gn_slabind , nslabs);
+ snew(erg->slab_innersumvec, nslabs);
+ for (i=0; i<nslabs; i++)
+ {
+ snew(erg->slab_data[i].x , rotg->nat);
+ snew(erg->slab_data[i].ref , rotg->nat);
+ snew(erg->slab_data[i].weight, rotg->nat);
+ }
+ snew(erg->xc_ref_sorted, rotg->nat);
+ snew(erg->xc_sortind , rotg->nat);
+ snew(erg->firstatom , nslabs);
+ snew(erg->lastatom , nslabs);
+}
+
+
+/* From the extreme coordinates of the reference group, determine the first
+ * and last slab of the reference. We can never have more slabs in the real
+ * simulation than calculated here for the reference.
+ */
+static void get_firstlast_slab_ref(t_rotgrp *rotg, real mc[], int ref_firstindex, int ref_lastindex)
+{
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ int first,last,firststart;
+ rvec dummy;
+
+
+ erg=rotg->enfrotgrp;
+ first = get_first_slab(rotg, erg->max_beta, rotg->x_ref[ref_firstindex]);
+ last = get_last_slab( rotg, erg->max_beta, rotg->x_ref[ref_lastindex ]);
+ firststart = first;
+
+ while (get_slab_weight(first, rotg, rotg->x_ref, mc, &dummy) > WEIGHT_MIN)
+ {
+ first--;
+ }
+ erg->slab_first_ref = first+1;
+ while (get_slab_weight(last, rotg, rotg->x_ref, mc, &dummy) > WEIGHT_MIN)
+ {
+ last++;
+ }
+ erg->slab_last_ref = last-1;
+
+ erg->slab_buffer = firststart - erg->slab_first_ref;
+}
+
+
+
+static void init_rot_group(FILE *fplog,t_commrec *cr,int g,t_rotgrp *rotg,
+ rvec *x,gmx_mtop_t *mtop,gmx_bool bVerbose,FILE *out_slabs, gmx_bool bOutputCenters)
+{
+ int i,ii;
+ rvec coord,*xdum;
+ gmx_bool bFlex,bColl;
+ t_atom *atom;
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ int ref_firstindex, ref_lastindex;
+ real mass,totalmass;
+ real start=0.0;
+
+
+ /* Do we have a flexible axis? */
+ bFlex = ISFLEX(rotg);
+ /* Do we use a global set of coordinates? */
+ bColl = ISCOLL(rotg);
+
+ erg=rotg->enfrotgrp;
+
+ /* Allocate space for collective coordinates if needed */
+ if (bColl)
+ {
+ snew(erg->xc , rotg->nat);
+ snew(erg->xc_shifts , rotg->nat);
+ snew(erg->xc_eshifts, rotg->nat);
+
+ /* Save the original (whole) set of positions such that later the
+ * molecule can always be made whole again */
+ snew(erg->xc_old , rotg->nat);
+ if (MASTER(cr))
+ {
+ for (i=0; i<rotg->nat; i++)
+ {
+ ii = rotg->ind[i];
+ copy_rvec(x[ii], erg->xc_old[i]);
+ }
+ }
+#ifdef GMX_MPI
+ if (PAR(cr))
+ gmx_bcast(rotg->nat*sizeof(erg->xc_old[0]),erg->xc_old, cr);
+#endif
+
+ if (rotg->eFittype == erotgFitNORM)
+ {
+ snew(erg->xc_ref_length, rotg->nat); /* in case fit type NORM is chosen */
+ snew(erg->xc_norm , rotg->nat);
+ }
+ }
+ else
+ {
+ snew(erg->xr_loc , rotg->nat);
+ snew(erg->x_loc_pbc, rotg->nat);
+ }
+
+ snew(erg->f_rot_loc , rotg->nat);
+ snew(erg->xc_ref_ind, rotg->nat);
+
+ /* Make space for the calculation of the potential at other angles (used
+ * for fitting only) */
+ if (erotgFitPOT == rotg->eFittype)
+ {
+ snew(erg->PotAngleFit, 1);
+ snew(erg->PotAngleFit->degangle, rotg->PotAngle_nstep);
+ snew(erg->PotAngleFit->V , rotg->PotAngle_nstep);
+ snew(erg->PotAngleFit->rotmat , rotg->PotAngle_nstep);
+
+ /* Get the set of angles around the reference angle */
+ start = -0.5 * (rotg->PotAngle_nstep - 1)*rotg->PotAngle_step;
+ for (i = 0; i < rotg->PotAngle_nstep; i++)
+ erg->PotAngleFit->degangle[i] = start + i*rotg->PotAngle_step;
+ }
+ else
+ {
+ erg->PotAngleFit = NULL;
+ }
+
+ /* xc_ref_ind needs to be set to identity in the serial case */
+ if (!PAR(cr))
+ for (i=0; i<rotg->nat; i++)
+ erg->xc_ref_ind[i] = i;
+
+ /* Copy the masses so that the center can be determined. For all types of
+ * enforced rotation, we store the masses in the erg->mc array. */
+ snew(erg->mc, rotg->nat);
+ if (bFlex)
+ snew(erg->mc_sorted, rotg->nat);
+ if (!bColl)
+ snew(erg->m_loc, rotg->nat);
+ totalmass=0.0;
+ for (i=0; i<rotg->nat; i++)
+ {
+ if (rotg->bMassW)
+ {
+ gmx_mtop_atomnr_to_atom(mtop,rotg->ind[i],&atom);
+ mass=atom->m;
+ }
+ else
+ {
+ mass=1.0;
+ }
+ erg->mc[i] = mass;
+ totalmass += mass;
+ }
+ erg->invmass = 1.0/totalmass;
+
+ /* Set xc_ref_center for any rotation potential */
+ if ((rotg->eType==erotgISO) || (rotg->eType==erotgPM) || (rotg->eType==erotgRM) || (rotg->eType==erotgRM2))
+ {
+ /* Set the pivot point for the fixed, stationary-axis potentials. This
+ * won't change during the simulation */
+ copy_rvec(rotg->pivot, erg->xc_ref_center);
+ copy_rvec(rotg->pivot, erg->xc_center );
+ }
+ else
+ {
+ /* Center of the reference positions */
+ get_center(rotg->x_ref, erg->mc, rotg->nat, erg->xc_ref_center);
+
+ /* Center of the actual positions */
+ if (MASTER(cr))
+ {
+ snew(xdum, rotg->nat);
+ for (i=0; i<rotg->nat; i++)
+ {
+ ii = rotg->ind[i];
+ copy_rvec(x[ii], xdum[i]);
+ }
+ get_center(xdum, erg->mc, rotg->nat, erg->xc_center);
+ sfree(xdum);
+ }
+#ifdef GMX_MPI
+ if (PAR(cr))
+ gmx_bcast(sizeof(erg->xc_center), erg->xc_center, cr);
+#endif
+ }
+
+ if ( (rotg->eType != erotgFLEX) && (rotg->eType != erotgFLEX2) )
+ {
+ /* Put the reference positions into origin: */
+ for (i=0; i<rotg->nat; i++)
+ rvec_dec(rotg->x_ref[i], erg->xc_ref_center);
+ }
+
+ /* Enforced rotation with flexible axis */
+ if (bFlex)
+ {
+ /* Calculate maximum beta value from minimum gaussian (performance opt.) */
+ erg->max_beta = calc_beta_max(rotg->min_gaussian, rotg->slab_dist);
+
+ /* Determine the smallest and largest coordinate with respect to the rotation vector */
+ get_firstlast_atom_ref(rotg, &ref_firstindex, &ref_lastindex);
+
+ /* From the extreme coordinates of the reference group, determine the first
+ * and last slab of the reference. */
+ get_firstlast_slab_ref(rotg, erg->mc, ref_firstindex, ref_lastindex);
+
+ /* Allocate memory for the slabs */
+ allocate_slabs(rotg, fplog, g, bVerbose);
+
+ /* Flexible rotation: determine the reference centers for the rest of the simulation */
+ erg->slab_first = erg->slab_first_ref;
+ erg->slab_last = erg->slab_last_ref;
+ get_slab_centers(rotg,rotg->x_ref,erg->mc,g,-1,out_slabs,bOutputCenters,TRUE);
+
+ /* Length of each x_rotref vector from center (needed if fit routine NORM is chosen): */
+ if (rotg->eFittype == erotgFitNORM)
+ {
+ for (i=0; i<rotg->nat; i++)
+ {
+ rvec_sub(rotg->x_ref[i], erg->xc_ref_center, coord);
+ erg->xc_ref_length[i] = norm(coord);
+ }
+ }
+ }
+}
+
+
+extern void dd_make_local_rotation_groups(gmx_domdec_t *dd,t_rot *rot)
+{
+ gmx_ga2la_t ga2la;
+ int g;
+ t_rotgrp *rotg;
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+
+ ga2la = dd->ga2la;
+
+ for(g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ erg = rotg->enfrotgrp;
+
+
+ dd_make_local_group_indices(ga2la,rotg->nat,rotg->ind,
+ &erg->nat_loc,&erg->ind_loc,&erg->nalloc_loc,erg->xc_ref_ind);
+ }
+}
+
+
+/* Calculate the size of the MPI buffer needed in reduce_output() */
+static int calc_mpi_bufsize(t_rot *rot)
+{
+ int g;
+ int count_group, count_total;
+ t_rotgrp *rotg;
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+
+
+ count_total = 0;
+ for (g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ erg = rotg->enfrotgrp;
+
+ /* Count the items that are transferred for this group: */
+ count_group = 4; /* V, torque, angle, weight */
+
+ /* Add the maximum number of slabs for flexible groups */
+ if (ISFLEX(rotg))
+ count_group += erg->slab_last_ref - erg->slab_first_ref + 1;
+
+ /* Add space for the potentials at different angles: */
+ if (erotgFitPOT == rotg->eFittype)
+ count_group += rotg->PotAngle_nstep;
+
+ /* Add to the total number: */
+ count_total += count_group;
+ }
+
+ return count_total;
+}
+
+
+extern void init_rot(FILE *fplog,t_inputrec *ir,int nfile,const t_filenm fnm[],
+ t_commrec *cr, rvec *x, matrix box, gmx_mtop_t *mtop, const output_env_t oenv,
+ gmx_bool bVerbose, unsigned long Flags)
+{
+ t_rot *rot;
+ t_rotgrp *rotg;
+ int g;
+ int nat_max=0; /* Size of biggest rotation group */
+ gmx_enfrot_t er; /* Pointer to the enforced rotation buffer variables */
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ rvec *x_pbc=NULL; /* Space for the pbc-correct atom positions */
+
+
+ if ( (PAR(cr)) && !DOMAINDECOMP(cr) )
+ gmx_fatal(FARGS, "Enforced rotation is only implemented for domain decomposition!");
+
+ if ( MASTER(cr) && bVerbose)
+ fprintf(stdout, "%s Initializing ...\n", RotStr);
+
+ rot = ir->rot;
+ snew(rot->enfrot, 1);
+ er = rot->enfrot;
+ er->Flags = Flags;
+
+ /* When appending, skip first output to avoid duplicate entries in the data files */
+ if (er->Flags & MD_APPENDFILES)
+ er->bOut = FALSE;
+ else
+ er->bOut = TRUE;
+
+ if ( MASTER(cr) && er->bOut )
+ please_cite(fplog, "Kutzner2011");
+
+ /* Output every step for reruns */
+ if (er->Flags & MD_RERUN)
+ {
+ if (NULL != fplog)
+ fprintf(fplog, "%s rerun - will write rotation output every available step.\n", RotStr);
+ rot->nstrout = 1;
+ rot->nstsout = 1;
+ }
+
+ er->out_slabs = NULL;
+ if ( MASTER(cr) && HaveFlexibleGroups(rot) )
+ er->out_slabs = open_slab_out(opt2fn("-rs",nfile,fnm), rot, oenv);
+
+ if (MASTER(cr))
+ {
+ /* Remove pbc, make molecule whole.
+ * When ir->bContinuation=TRUE this has already been done, but ok. */
+ snew(x_pbc,mtop->natoms);
+ m_rveccopy(mtop->natoms,x,x_pbc);
+ do_pbc_first_mtop(NULL,ir->ePBC,box,mtop,x_pbc);
+ }
+
+ for (g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+
+ if (NULL != fplog)
+ fprintf(fplog,"%s group %d type '%s'\n", RotStr, g, erotg_names[rotg->eType]);
+
+ if (rotg->nat > 0)
+ {
+ /* Allocate space for the rotation group's data: */
+ snew(rotg->enfrotgrp, 1);
+ erg = rotg->enfrotgrp;
+
+ nat_max=max(nat_max, rotg->nat);
+
+ if (PAR(cr))
+ {
+ erg->nat_loc = 0;
+ erg->nalloc_loc = 0;
+ erg->ind_loc = NULL;
+ }
+ else
+ {
+ erg->nat_loc = rotg->nat;
+ erg->ind_loc = rotg->ind;
+ }
+ init_rot_group(fplog,cr,g,rotg,x_pbc,mtop,bVerbose,er->out_slabs,
+ !(er->Flags & MD_APPENDFILES) ); /* Do not output the reference centers
+ * again if we are appending */
+ }
+ }
+
+ /* Allocate space for enforced rotation buffer variables */
+ er->bufsize = nat_max;
+ snew(er->data, nat_max);
+ snew(er->xbuf, nat_max);
+ snew(er->mbuf, nat_max);
+
+ /* Buffers for MPI reducing torques, angles, weights (for each group), and V */
+ if (PAR(cr))
+ {
+ er->mpi_bufsize = calc_mpi_bufsize(rot) + 100; /* larger to catch errors */
+ snew(er->mpi_inbuf , er->mpi_bufsize);
+ snew(er->mpi_outbuf, er->mpi_bufsize);
+ }
+ else
+ {
+ er->mpi_bufsize = 0;
+ er->mpi_inbuf = NULL;
+ er->mpi_outbuf = NULL;
+ }
+
+ /* Only do I/O on the MASTER */
+ er->out_angles = NULL;
+ er->out_rot = NULL;
+ er->out_torque = NULL;
+ if (MASTER(cr))
+ {
+ er->out_rot = open_rot_out(opt2fn("-ro",nfile,fnm), rot, oenv);
+
+ if (rot->nstsout > 0)
+ {
+ if ( HaveFlexibleGroups(rot) || HavePotFitGroups(rot) )
+ er->out_angles = open_angles_out(opt2fn("-ra",nfile,fnm), rot, oenv);
+ if ( HaveFlexibleGroups(rot) )
+ er->out_torque = open_torque_out(opt2fn("-rt",nfile,fnm), rot, oenv);
+ }
+
+ sfree(x_pbc);
+ }
+}
+
+
+extern void finish_rot(FILE *fplog,t_rot *rot)
+{
+ gmx_enfrot_t er; /* Pointer to the enforced rotation buffer variables */
+
+
+ er=rot->enfrot;
+ if (er->out_rot)
+ gmx_fio_fclose(er->out_rot);
+ if (er->out_slabs)
+ gmx_fio_fclose(er->out_slabs);
+ if (er->out_angles)
+ gmx_fio_fclose(er->out_angles);
+ if (er->out_torque)
+ gmx_fio_fclose(er->out_torque);
+}
+
+
+/* Rotate the local reference positions and store them in
+ * erg->xr_loc[0...(nat_loc-1)]
+ *
+ * Note that we already subtracted u or y_c from the reference positions
+ * in init_rot_group().
+ */
+static void rotate_local_reference(t_rotgrp *rotg)
+{
+ gmx_enfrotgrp_t erg;
+ int i,ii;
+
+
+ erg=rotg->enfrotgrp;
+
+ for (i=0; i<erg->nat_loc; i++)
+ {
+ /* Index of this rotation group atom with respect to the whole rotation group */
+ ii = erg->xc_ref_ind[i];
+ /* Rotate */
+ mvmul(erg->rotmat, rotg->x_ref[ii], erg->xr_loc[i]);
+ }
+}
+
+
+/* Select the PBC representation for each local x position and store that
+ * for later usage. We assume the right PBC image of an x is the one nearest to
+ * its rotated reference */
+static void choose_pbc_image(rvec x[], t_rotgrp *rotg, matrix box, int npbcdim)
+{
+ int d,i,ii,m;
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ rvec xref,xcurr,dx;
+ ivec shift;
+
+
+ erg=rotg->enfrotgrp;
+
+ for (i=0; i<erg->nat_loc; i++)
+ {
+ clear_ivec(shift);
+
+ /* Index of a rotation group atom */
+ ii = erg->ind_loc[i];
+
+ /* Get the reference position. The pivot was already
+ * subtracted in init_rot_group() from the reference positions. Also,
+ * the reference positions have already been rotated in
+ * rotate_local_reference() */
+ copy_rvec(erg->xr_loc[i], xref);
+
+ /* Subtract the (old) center from the current positions
+ * (just to determine the shifts!) */
+ rvec_sub(x[ii], erg->xc_center, xcurr);
+
+ /* Shortest PBC distance between the atom and its reference */
+ rvec_sub(xcurr, xref, dx);
+
+ /* Determine the shift for this atom */
+ for(m=npbcdim-1; m>=0; m--)
+ {
+ while (dx[m] < -0.5*box[m][m])
+ {
+ for(d=0; d<DIM; d++)
+ dx[d] += box[m][d];
+ shift[m]++;
+ }
+ while (dx[m] >= 0.5*box[m][m])
+ {
+ for(d=0; d<DIM; d++)
+ dx[d] -= box[m][d];
+ shift[m]--;
+ }
+ }
+
+ /* Apply the shift to the current atom */
+ copy_rvec(x[ii], erg->x_loc_pbc[i]);
+ shift_single_coord(box, erg->x_loc_pbc[i], shift);
+ }
+}
+
+
+extern void do_rotation(
+ t_commrec *cr,
+ t_inputrec *ir,
+ matrix box,
+ rvec x[],
+ real t,
+ gmx_large_int_t step,
+ gmx_wallcycle_t wcycle,
+ gmx_bool bNS)
+{
+ int g,i,ii;
+ t_rot *rot;
+ t_rotgrp *rotg;
+ gmx_bool outstep_slab, outstep_rot;
+ gmx_bool bFlex,bColl;
+ gmx_enfrot_t er; /* Pointer to the enforced rotation buffer variables */
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ rvec transvec;
+ t_gmx_potfit *fit=NULL; /* For fit type 'potential' determine the fit
+ angle via the potential minimum */
+
+ /* Enforced rotation cycle counting: */
+ gmx_cycles_t cycles_comp; /* Cycles for the enf. rotation computation
+ only, does not count communication. This
+ counter is used for load-balancing */
+
+#ifdef TAKETIME
+ double t0;
+#endif
+
+ rot=ir->rot;
+ er=rot->enfrot;
+
+ /* When to output in main rotation output file */
+ outstep_rot = do_per_step(step, rot->nstrout) && er->bOut;
+ /* When to output per-slab data */
+ outstep_slab = do_per_step(step, rot->nstsout) && er->bOut;
+
+ /* Output time into rotation output file */
+ if (outstep_rot && MASTER(cr))
+ fprintf(er->out_rot, "%12.3e",t);
+
+ /**************************************************************************/
+ /* First do ALL the communication! */
+ for(g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ erg=rotg->enfrotgrp;
+
+ /* Do we have a flexible axis? */
+ bFlex = ISFLEX(rotg);
+ /* Do we use a collective (global) set of coordinates? */
+ bColl = ISCOLL(rotg);
+
+ /* Calculate the rotation matrix for this angle: */
+ erg->degangle = rotg->rate * t;
+ calc_rotmat(rotg->vec,erg->degangle,erg->rotmat);
+
+ if (bColl)
+ {
+ /* Transfer the rotation group's positions such that every node has
+ * all of them. Every node contributes its local positions x and stores
+ * it in the collective erg->xc array. */
+ communicate_group_positions(cr,erg->xc, erg->xc_shifts, erg->xc_eshifts, bNS,
+ x, rotg->nat, erg->nat_loc, erg->ind_loc, erg->xc_ref_ind, erg->xc_old, box);
+ }
+ else
+ {
+ /* Fill the local masses array;
+ * this array changes in DD/neighborsearching steps */
+ if (bNS)
+ {
+ for (i=0; i<erg->nat_loc; i++)
+ {
+ /* Index of local atom w.r.t. the collective rotation group */
+ ii = erg->xc_ref_ind[i];
+ erg->m_loc[i] = erg->mc[ii];
+ }
+ }
+
+ /* Calculate Omega*(y_i-y_c) for the local positions */
+ rotate_local_reference(rotg);
+
+ /* Choose the nearest PBC images of the group atoms with respect
+ * to the rotated reference positions */
+ choose_pbc_image(x, rotg, box, 3);
+
+ /* Get the center of the rotation group */
+ if ( (rotg->eType==erotgISOPF) || (rotg->eType==erotgPMPF) )
+ get_center_comm(cr, erg->x_loc_pbc, erg->m_loc, erg->nat_loc, rotg->nat, erg->xc_center);
+ }
+
+ } /* End of loop over rotation groups */
+
+ /**************************************************************************/
+ /* Done communicating, we can start to count cycles for the load balancing now ... */
+ cycles_comp = gmx_cycles_read();
+
+
+#ifdef TAKETIME
+ t0 = MPI_Wtime();
+#endif
+
+ for(g=0; g<rot->ngrp; g++)
+ {
+ rotg = &rot->grp[g];
+ erg=rotg->enfrotgrp;
+
+ bFlex = ISFLEX(rotg);
+ bColl = ISCOLL(rotg);
+
+ if (outstep_rot && MASTER(cr))
+ fprintf(er->out_rot, "%12.4f", erg->degangle);
+
+ /* Calculate angles and rotation matrices for potential fitting: */
+ if ( (outstep_rot || outstep_slab) && (erotgFitPOT == rotg->eFittype) )
+ {
+ fit = erg->PotAngleFit;
+ for (i = 0; i < rotg->PotAngle_nstep; i++)
+ {
+ calc_rotmat(rotg->vec, erg->degangle + fit->degangle[i], fit->rotmat[i]);
+
+ /* Clear value from last step */
+ erg->PotAngleFit->V[i] = 0.0;
+ }
+ }
+
+ /* Clear values from last time step */
+ erg->V = 0.0;
+ erg->torque_v = 0.0;
+ erg->angle_v = 0.0;
+ erg->weight_v = 0.0;
+
+ switch(rotg->eType)
+ {
+ case erotgISO:
+ case erotgISOPF:
+ case erotgPM:
+ case erotgPMPF:
+ do_fixed(rotg,x,box,t,step,outstep_rot,outstep_slab);
+ break;
+ case erotgRM:
+ do_radial_motion(rotg,x,box,t,step,outstep_rot,outstep_slab);
+ break;
+ case erotgRMPF:
+ do_radial_motion_pf(rotg,x,box,t,step,outstep_rot,outstep_slab);
+ break;
+ case erotgRM2:
+ case erotgRM2PF:
+ do_radial_motion2(rotg,x,box,t,step,outstep_rot,outstep_slab);
+ break;
+ case erotgFLEXT:
+ case erotgFLEX2T:
+ /* Subtract the center of the rotation group from the collective positions array
+ * Also store the center in erg->xc_center since it needs to be subtracted
+ * in the low level routines from the local coordinates as well */
+ get_center(erg->xc, erg->mc, rotg->nat, erg->xc_center);
+ svmul(-1.0, erg->xc_center, transvec);
+ translate_x(erg->xc, rotg->nat, transvec);
+ do_flexible(MASTER(cr),er,rotg,g,x,box,t,step,outstep_rot,outstep_slab);
+ break;
+ case erotgFLEX:
+ case erotgFLEX2:
+ /* Do NOT subtract the center of mass in the low level routines! */
+ clear_rvec(erg->xc_center);
+ do_flexible(MASTER(cr),er,rotg,g,x,box,t,step,outstep_rot,outstep_slab);
+ break;
+ default:
+ gmx_fatal(FARGS, "No such rotation potential.");
+ break;
+ }
+ }
+
+#ifdef TAKETIME
+ if (MASTER(cr))
+ fprintf(stderr, "%s calculation (step %d) took %g seconds.\n", RotStr, step, MPI_Wtime()-t0);
+#endif
+
+ /* Stop the enforced rotation cycle counter and add the computation-only
+ * cycles to the force cycles for load balancing */
+ cycles_comp = gmx_cycles_read() - cycles_comp;
+
+ if (DOMAINDECOMP(cr) && wcycle)
+ dd_cycles_add(cr->dd,cycles_comp,ddCyclF);
+}
#include "pull.h"
#include "gmx_ga2la.h"
-void pull_d_pbc_dx(int npbcdim,matrix box,
- const dvec x1, const dvec x2, dvec dx)
-{
- int m,d;
-
- /* Only correct for atom pairs with a distance within
- * half of the smallest diagonal element of box.
- */
- dvec_sub(x1,x2,dx);
- for(m=npbcdim-1; m>=0; m--) {
- while (dx[m] < -0.5*box[m][m]) {
- for(d=0; d<DIM; d++)
- dx[d] += box[m][d];
- }
- while (dx[m] >= 0.5*box[m][m]) {
- for(d=0; d<DIM; d++)
- dx[d] -= box[m][d];
- }
- }
-}
-
static void pull_set_pbcatom(t_commrec *cr, t_pullgrp *pg,
t_mdatoms *md, rvec *x,
rvec x_pbc)
{1,6,11},
{4,6,0}};
char
- *buf;
+ *buf=NULL;
int
i;
/* we read the number of cpus and environment from the environment
* if set.
*/
- snew(buf,20);
buf = getenv("NCPUS");
if (buf)
sscanf(buf,"%d",&qm->nQMcpus);
else
qm->nQMcpus=1;
fprintf(stderr,"number of CPUs for gaussian = %d\n",qm->nQMcpus);
- snew(buf,50);
buf = getenv("MEM");
if (buf)
sscanf(buf,"%d",&qm->QMmem);
else
qm->QMmem=50000000;
fprintf(stderr,"memory for gaussian = %d\n",qm->QMmem);
- snew(buf,30);
buf = getenv("ACC");
if (buf)
sscanf(buf,"%d",&qm->accuracy);
else
qm->accuracy=8;
fprintf(stderr,"accuracy in l510 = %d\n",qm->accuracy);
- snew(buf,30);
+
buf = getenv("CPMCSCF");
if (buf)
{
fprintf(stderr,"using cp-mcscf in l1003\n");
else
fprintf(stderr,"NOT using cp-mcscf in l1003\n");
- snew(buf,50);
buf = getenv("SASTEP");
if (buf)
sscanf(buf,"%d",&qm->SAstep);
* if set.
*/
fprintf(stderr,"Level of SA at start = %d\n",qm->SAstep);
-
-
/* punch the LJ C6 and C12 coefficients to be picked up by
* gaussian and usd to compute the LJ interaction between the
* MM and QM atoms.
fclose(out);
}
/* gaussian settings on the system */
- snew(buf,200);
buf = getenv("GAUSS_DIR");
fprintf(stderr,"%s",buf);
if (buf){
- snew(qm->gauss_dir,200);
- sscanf(buf,"%s",qm->gauss_dir);
+ qm->gauss_dir=strdup(buf);
}
else
gmx_fatal(FARGS,"no $GAUSS_DIR, check gaussian manual\n");
- snew(buf,200);
buf = getenv("GAUSS_EXE");
if (buf){
- snew(qm->gauss_exe,200);
- sscanf(buf,"%s",qm->gauss_exe);
+ qm->gauss_exe=strdup(buf);
}
else
gmx_fatal(FARGS,"no $GAUSS_EXE, check gaussian manual\n");
-
- snew(buf,200);
buf = getenv("DEVEL_DIR");
if (buf){
- snew(qm->devel_dir,200);
- sscanf(buf,"%s",qm->devel_dir);
+ qm->devel_dir = strdup (buf);
}
else
gmx_fatal(FARGS,"no $DEVEL_DIR, this is were the modified links reside.\n");
-
/* if(fr->bRF){*/
/* reactionfield, file is needed using gaussian */
/* rffile=fopen("rf.dat","w");*/
eQMmethod_names[qm->QMmethod]);
if(qm->QMmethod>=eQMmethodRHF){
- fprintf(out,"/%s",
- eQMbasis_names[qm->QMbasis]);
if(qm->QMmethod==eQMmethodCASSCF){
/* in case of cas, how many electrons and orbitals do we need?
*/
fprintf(out,"(%d,%d)",
qm->CASelectrons,qm->CASorbitals);
}
+ fprintf(out,"/%s",
+ eQMbasis_names[qm->QMbasis]);
}
}
- if(QMMMrec->QMMMscheme==eQMMMschemenormal){
+ if(QMMMrec->QMMMscheme==eQMMMschemenormal && mm->nrMMatoms){
fprintf(out," %s",
"Charge ");
}
void do_gaussian(int step,char *exe)
{
char
- buf[100];
+ buf[STRLEN];
/* make the call to the gaussian binary through system()
* The location of the binary will be picked up from the
} /* QMlayer_comp */
-void sort_QMlayers(t_QMMMrec *qr){
- /* sorts QM layers from small to big */
- qsort(qr->qm,qr->nrQMlayers,
- (size_t)sizeof(qr->qm[0]),
- QMlayer_comp);
-} /* sort_QMlayers */
-
-
real call_QMroutine(t_commrec *cr, t_forcerec *fr, t_QMrec *qm,
t_MMrec *mm, rvec f[], rvec fshift[])
{
else
{
/* do an ab-initio calculation */
- if (qm->bSH)
+ if (qm->bSH && qm->QMmethod==eQMmethodCASSCF)
{
#ifdef GMX_QMMM_GAUSSIAN
QMener = call_gaussian_SH(cr,fr,qm,mm,f,fshift);
c6au = (HARTREE2KJ*AVOGADRO*pow(BOHR2NM,6));
c12au = (HARTREE2KJ*AVOGADRO*pow(BOHR2NM,12));
- fprintf(stderr,"there we go!\n");
+ /* issue a fatal if the user wants to run with more than one node */
+ if ( PAR(cr)) gmx_fatal(FARGS,"QM/MM does not work in parallel, use a single node instead\n");
/* Make a local copy of the QMMMrec */
qr = fr->qr;
int i,j,nmol,type,mb,mt,a_offset,cg,mol,ftype,nra;
real qS,alpha;
int aS,aN=0; /* Shell and nucleus */
- int bondtypes[] = { F_BONDS, F_HARMONIC, F_CUBICBONDS, F_POLARIZATION, F_WATER_POL };
+ int bondtypes[] = { F_BONDS, F_HARMONIC, F_CUBICBONDS, F_POLARIZATION, F_ANHARM_POL, F_WATER_POL };
#define NBT asize(bondtypes)
t_iatom *ia;
gmx_mtop_atomloop_block_t aloopb;
case F_HARMONIC:
case F_CUBICBONDS:
case F_POLARIZATION:
+ case F_ANHARM_POL:
if (atom[ia[1]].ptype == eptShell) {
aS = ia[1];
aN = ia[2];
shell[nsi].k += ffparams->iparams[type].cubic.kb;
break;
case F_POLARIZATION:
+ case F_ANHARM_POL:
if (qS != atom[aS].qB)
gmx_fatal(FARGS,"polarize can not be used with qA != qB");
shell[nsi].k += sqr(qS)*ONE_4PI_EPS0/
#include "pbc.h"
#include "chargegroup.h"
#include "vec.h"
-#include "time.h"
+#include <time.h>
#include "nrnb.h"
#include "mshift.h"
#include "mdrun.h"
#include "trnio.h"
#include "xtcio.h"
#include "copyrite.h"
-
+#include "pull_rotation.h"
#include "mpelogging.h"
#include "domdec.h"
#include "partdec.h"
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
+#include "adress.h"
#include "qmmm.h"
#if 0
double dt;
char buf[48];
-#ifndef GMX_THREADS
+#ifndef GMX_THREAD_MPI
if (!PAR(cr))
#endif
{
ir->delta_t/1000*24*60*60/runtime->time_per_step);
}
}
-#ifndef GMX_THREADS
+#ifndef GMX_THREAD_MPI
if (PAR(cr))
{
fprintf(out,"\n");
double mu[2*DIM];
gmx_bool bSepDVDL,bStateChanged,bNS,bFillGrid,bCalcCGCM,bBS;
gmx_bool bDoLongRange,bDoForces,bSepLRF;
+ gmx_bool bDoAdressWF;
matrix boxs;
real e,v,dvdl;
t_pbc pbc;
bDoLongRange = (fr->bTwinRange && bNS && (flags & GMX_FORCE_DOLR));
bDoForces = (flags & GMX_FORCE_FORCES);
bSepLRF = (bDoLongRange && bDoForces && (flags & GMX_FORCE_SEPLRF));
+ /* should probably move this to the forcerec since it doesn't change */
+ bDoAdressWF = ((fr->adress_type!=eAdressOff));
if (bStateChanged)
{
}
if (bStateChanged)
{
+
+ /* update adress weight beforehand */
+ if(bDoAdressWF)
+ {
+ /* need pbc for adress weight calculation with pbc_dx */
+ set_pbc(&pbc,inputrec->ePBC,box);
+ if(fr->adress_site == eAdressSITEcog)
+ {
+ update_adress_weights_cog(top->idef.iparams,top->idef.il,x,fr,mdatoms,
+ inputrec->ePBC==epbcNONE ? NULL : &pbc);
+ }
+ else if (fr->adress_site == eAdressSITEcom)
+ {
+ update_adress_weights_com(fplog,cg0,cg1,&(top->cgs),x,fr,mdatoms,
+ inputrec->ePBC==epbcNONE ? NULL : &pbc);
+ }
+ else if (fr->adress_site == eAdressSITEatomatom){
+ update_adress_weights_atom_per_atom(cg0,cg1,&(top->cgs),x,fr,mdatoms,
+ inputrec->ePBC==epbcNONE ? NULL : &pbc);
+ }
+ else
+ {
+ update_adress_weights_atom(cg0,cg1,&(top->cgs),x,fr,mdatoms,
+ inputrec->ePBC==epbcNONE ? NULL : &pbc);
+ }
+ }
+
for(i=0; i<2; i++)
{
for(j=0;j<DIM;j++)
dd_force_flop_start(cr->dd,nrnb);
}
}
-
+
+ if (inputrec->bRot)
+ {
+ /* Enforced rotation has its own cycle counter that starts after the collective
+ * coordinates have been communicated. It is added to ddCyclF to allow
+ * for proper load-balancing */
+ wallcycle_start(wcycle,ewcROT);
+ do_rotation(cr,inputrec,box,x,t,step,wcycle,bNS);
+ wallcycle_stop(wcycle,ewcROT);
+ }
+
/* Start the force cycle counter.
* This counter is stopped in do_forcelow_level.
* No parallel communication should occur while this counter is running,
* since that will interfere with the dynamic load balancing.
*/
wallcycle_start(wcycle,ewcFORCE);
-
+
if (bDoForces)
{
/* Reset forces for which the virial is calculated separately:
if ((flags & GMX_FORCE_BONDED) && top->idef.il[F_POSRES].nr > 0)
{
- /* Position restraints always require full pbc */
- set_pbc(&pbc,inputrec->ePBC,box);
+ /* Position restraints always require full pbc. Check if we already did it for Adress */
+ if(!(bStateChanged && bDoAdressWF))
+ {
+ set_pbc(&pbc,inputrec->ePBC,box);
+ }
v = posres(top->idef.il[F_POSRES].nr,top->idef.il[F_POSRES].iatoms,
top->idef.iparams_posres,
(const rvec*)x,fr->f_novirsum,fr->vir_diag_posres,
start,homenr,mdatoms->chargeA,x,fr->f_novirsum,
inputrec->ex,inputrec->et,t);
}
+
+ if (bDoAdressWF && fr->adress_icor == eAdressICThermoForce)
+ {
+ /* Compute thermodynamic force in hybrid AdResS region */
+ adress_thermo_force(start,homenr,&(top->cgs),x,fr->f_novirsum,fr,mdatoms,
+ inputrec->ePBC==epbcNONE ? NULL : &pbc);
+ }
/* Communicate the forces */
if (PAR(cr))
}
}
+ enerd->term[F_COM_PULL] = 0;
if (inputrec->ePull == epullUMBRELLA || inputrec->ePull == epullCONST_F)
{
/* Calculate the center of mass forces, this requires communication,
*/
set_pbc(&pbc,inputrec->ePBC,box);
dvdl = 0;
- enerd->term[F_COM_PULL] =
+ enerd->term[F_COM_PULL] +=
pull_potential(inputrec->ePull,inputrec->pull,mdatoms,&pbc,
cr,t,lambda,x,f,vir_force,&dvdl);
if (bSepDVDL)
}
enerd->dvdl_lin += dvdl;
}
+
+ /* Add the forces from enforced rotation potentials (if any) */
+ if (inputrec->bRot)
+ {
+ wallcycle_start(wcycle,ewcROTadd);
+ enerd->term[F_COM_PULL] += add_rot_forces(inputrec->rot, f, cr,step,t);
+ wallcycle_stop(wcycle,ewcROTadd);
+ }
if (PAR(cr) && !(cr->duty & DUTY_PME))
{
mtop,ir, (*outf)->fp_dhdl);
}
+ if (ir->bAdress)
+ {
+ please_cite(fplog,"Fritsch12");
+ please_cite(fplog,"Junghans10");
+ }
/* Initiate variables */
clear_mat(force_vir);
clear_mat(shake_vir);
*yp = (Fp+Geps+2.0*Heps2)*tabscale;
}
-
-static void splint(real xa[],real ya[],real y2a[],
- int n,real x,real *y,real *yp)
-{
- int klo,khi,k;
- real h,b,a,eps;
- real F,G,H;
-
- klo=1;
- khi=n;
-
- while ((khi-klo) > 1) {
- k=(khi+klo) >> 1;
- if (xa[k] > x)
- khi=k;
- else
- klo=k;
- }
- h = xa[khi]-xa[klo];
- if (h == 0.0)
- gmx_fatal(FARGS,"Bad XA input to function splint");
- a = (xa[khi]-x)/h;
- b = (x-xa[klo])/h;
- *y = a*ya[klo]+b*ya[khi]+((a*a*a-a)*y2a[klo]+(b*b*b-b)*y2a[khi])*(h*h)/6.0;
- *yp = (ya[khi]-ya[klo])/h+((3*a*a-1)*y2a[klo]-(3*b*b-1)*y2a[khi])*h/6.0;
-
- eps = b;
- F = (ya[khi]-ya[klo]-(h*h/6.0)*(2*y2a[klo]+y2a[khi]));
- G = (h*h/2.0)*y2a[klo];
- H = (h*h/6.0)*(y2a[khi]-y2a[klo]);
- *y = ya[klo] + eps*F + eps*eps*G + eps*eps*eps*H;
- *yp = (F + 2*eps*G + 3*eps*eps*H)/h;
-}
-
-
static void copy2table(int n,int offset,int stride,
double x[],double Vtab[],double Ftab[],
real dest[])
gmx_bool bReadTab,bGenTab;
real x0,y0,yp;
int i,j,k,nx,nx0,tabsel[etiNR];
- void * p_tmp;
double r,r2,Vtab,Ftab,expterm;
t_forcetable table;
* to do this :-)
*/
- /* 4 fp entries per table point, nx+1 points, and 16 bytes extra
- to align it. */
- p_tmp = malloc(4*(nx+1)*sizeof(real)+16);
-
- /* align it - size_t has the same same as a pointer */
- table.tab = (real *) (((size_t) p_tmp + 16) & (~((size_t) 15)));
+ snew_aligned(table.tab,4*nx,16);
init_table(out,nx,nx0,table.scale,&(td[0]),!bReadTab);
}
+t_forcetable make_atf_table(FILE *out,const output_env_t oenv,
+ const t_forcerec *fr,
+ const char *fn,
+ matrix box)
+{
+ const char *fns[3] = { "tf_tab.xvg", "atfdtab.xvg", "atfrtab.xvg" };
+ FILE *fp;
+ t_tabledata *td;
+ real x0,y0,yp,rtab;
+ int i,nx,nx0;
+ real rx, ry, rz, box_r;
+
+ t_forcetable table;
+
+
+ /* Set the table dimensions for ATF, not really necessary to
+ * use etiNR (since we only have one table, but ...)
+ */
+ snew(td,1);
+
+ if (fr->adress_type == eAdressSphere){
+ /* take half box diagonal direction as tab range */
+ rx = 0.5*box[0][0]+0.5*box[1][0]+0.5*box[2][0];
+ ry = 0.5*box[0][1]+0.5*box[1][1]+0.5*box[2][1];
+ rz = 0.5*box[0][2]+0.5*box[1][2]+0.5*box[2][2];
+ box_r = sqrt(rx*rx+ry*ry+rz*rz);
+
+ }else{
+ /* xsplit: take half box x direction as tab range */
+ box_r = box[0][0]/2;
+ }
+ table.r = box_r;
+ table.scale = 0;
+ table.n = 0;
+ table.scale_exp = 0;
+ nx0 = 10;
+ nx = 0;
+
+ read_tables(out,fn,1,0,td);
+ rtab = td[0].x[td[0].nx-1];
+
+ if (fr->adress_type == eAdressXSplit && (rtab < box[0][0]/2)){
+ gmx_fatal(FARGS,"AdResS full box therm force table in file %s extends to %f:\n"
+ "\tshould extend to at least half the length of the box in x-direction"
+ "%f\n",fn,rtab, box[0][0]/2);
+ }
+ if (rtab < box_r){
+ gmx_fatal(FARGS,"AdResS full box therm force table in file %s extends to %f:\n"
+ "\tshould extend to at least for spherical adress"
+ "%f (=distance from center to furthermost point in box \n",fn,rtab, box_r);
+ }
+
+
+ table.n = td[0].nx;
+ nx = table.n;
+ table.scale = td[0].tabscale;
+ nx0 = td[0].nx0;
+
+ /* Each table type (e.g. coul,lj6,lj12) requires four
+ * numbers per datapoint. For performance reasons we want
+ * the table data to be aligned to 16-byte. This is accomplished
+ * by allocating 16 bytes extra to a temporary pointer, and then
+ * calculating an aligned pointer. This new pointer must not be
+ * used in a free() call, but thankfully we're sloppy enough not
+ * to do this :-)
+ */
+
+ snew_aligned(table.tab,4*nx,16);
+
+ copy2table(table.n,0,4,td[0].x,td[0].v,td[0].f,table.tab);
+
+ if(bDebugMode())
+ {
+ fp=xvgropen(fns[0],fns[0],"r","V",oenv);
+ /* plot the output 5 times denser than the table data */
+ /* for(i=5*nx0;i<5*table.n;i++) */
+
+ for(i=5*((nx0+1)/2); i<5*table.n; i++)
+ {
+ /* x0=i*table.r/(5*table.n); */
+ x0 = i*table.r/(5*(table.n-1));
+ evaluate_table(table.tab,0,4,table.scale,x0,&y0,&yp);
+ fprintf(fp,"%15.10e %15.10e %15.10e\n",x0,y0,yp);
+
+ }
+ ffclose(fp);
+ }
+
+ done_tabledata(&(td[0]));
+ sfree(td);
+
+ return table;
+}
+
bondedtable_t make_bonded_table(FILE *fplog,char *fn,int angle)
{
t_tabledata td;
} t_gmx_update;
-void store_rvec(rvec *from, rvec *to, int n) {
- int i;
- for (i=0;i<n;i++) {
- copy_rvec(from[i],to[i]);
- }
-}
-
static void do_update_md(int start,int nrend,double dt,
t_grp_tcstat *tcstat,t_grp_acc *gstat,double nh_vxi[],
rvec accel[],ivec nFreeze[],real invmass[],
{
kT = BOLTZ*ref_t[n];
/* The mass is encounted for later, since this differs per atom */
- sig[n].V = sqrt(2*kT*(1 - sdc[n].em));
+ sig[n].V = sqrt(kT*(1 - sdc[n].em*sdc[n].em));
}
for(n=start; n<start+homenr; n++)
at = type[i];
Cd = nbfp[ntw[w]+2*at];
Cr = nbfp[ntw[w]+2*at+1];
- if (!((Cd==0 && Cr==0) || egp_flags[ggid] & EGP_EXCL))
+ if (!((Cd==0 && Cr==0) || (egp_flags[ggid] & EGP_EXCL)))
{
if (w == 0)
{
set_mat(fp,mat,iatom,4,j,4,bSymm,shift);
njtot+=16;
break;
+ default:
gmx_incons("non-existing solvent type");
}
}
+++ /dev/null
-.deps
-.libs
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-# Note: Makefile is automatically generated from Makefile.in by the configure
-# script, and Makefile.in is generated from Makefile.am by automake.
-
-LDADD = ../mdlib/libmd@LIBSUFFIX@.la ../gmxlib/libgmx@LIBSUFFIX@.la
-
-# Ngmx requires X11 - nothing is built if it doesn't exist
-
-if USE_X11
-
-AM_CPPFLAGS = -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\" $(X_CFLAGS)
-AM_LDFLAGS = $(X_LIBS) $(X_PRE_LIBS) -lX11 $(X_EXTRA_LIBS)
-bin_PROGRAMS = ngmx g_xrama
-EXTRA_PROGRAMS = test_ngmx_dialog g_showcol
-
-endif
-
-XSRC = xutil.c xmb.c x11.c \
- xdlghi.c fgrid.c xdlgitem.c \
- popup.c pulldown.c xdlg.c \
- manager.c buttons.c nmol.c \
- nleg.c dialogs.c logo.c \
- filter.c molps.c Xstuff.h \
- dialogs.h logo.h molps.h \
- nleg.h nmol.h pulldown.h \
- xdlg.h xdlgitem.h xutil.h \
- buttons.h fgrid.h manager.h \
- nener.h nload.h popup.h \
- x11.h xdlghi.h xmb.h
-
-EXTRA_DIST = alert.bm gromacs.bm play.bm \
- rewind.bm stop_ani.bm ff.bm \
- info.bm rama.bm stop.bm
-
-
-ngmx_SOURCES = ngmx.c $(XSRC)
-g_xrama_SOURCES = g_xrama.c $(XSRC)
-g_showcol_SOURCES = g_showcol.c $(XSRC)
-test_ngmx_dialog_SOURCES = test_ngmx_dialog.c $(XSRC)
-
-CLEANFILES = *~ \\\#*
sprintf(tmp,"%ctmp%cdialogXXXXXX",DIR_SEPARATOR,DIR_SEPARATOR);
gmx_tmpnam(tmp);
}
+ else
+ {
+ fclose(tfil);
+ }
if ((tfil = fopen(tmp,"w")) == NULL)
gmx_fatal(FARGS,"Can not open tmp file %s",tmp);
#endif
break;
case DLG_EXIT:
- if ((bOk=(gmx_strcasecmp("ok",set))==0))
+ if ((bOk=gmx_strcasecmp("ok",set))==0)
strcpy(gmx->confout,EditText(dlg,eExConf));
HideDlg(dlg);
if (bOk)
#include <math.h>
#include "sysstuff.h"
-#include "string.h"
+#include <string.h>
#include "smalloc.h"
#include "macros.h"
#include "xutil.h"
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Gyas ROwers Mature At Cryogenic Speed
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <math.h>
-#include <smalloc.h>
-#include <macros.h>
-#include <names.h>
-#include "nener.h"
-#include "buttons.h"
-
-static void DrawEGraph(t_x11 *x11,t_enerwin *ew)
-{
- t_windata *wd;
- int i,EHeight,EZero;
- real epr,scale,MaxE,MinE;
- char maxstr[80];
- int y;
-
- wd=&(ew->wd);
- /* Clear */
- XClearWindow(x11->disp,wd->self);
-
- /* Calculate boundaries */
- MaxE=MinE=ew->e[ew->etype][0];
- for (i=1; (i<ew->nlast); i++) {
- MaxE=max(ew->e[ew->etype][i],MaxE);
- MinE=min(ew->e[ew->etype][i],MinE);
- }
-
- /* Print title */
- epr=max(fabs(MaxE),fabs(MinE));
- sprintf(maxstr,"%.0f",epr);
- EHeight=XTextHeight(x11->font)+AIR;
- TextInRect(x11,wd->self,EType[ew->etype],AIR,0,
- wd->width-2*AIR,EHeight,eXLeft,eYCenter);
- TextInRect(x11,wd->self,maxstr,AIR,0,
- wd->width-2*AIR,EHeight,eXRight,eYCenter);
- XDrawLine(x11->disp, wd->self,x11->gc,0,EHeight,wd->width,EHeight);
-
- if (ew->nlast==0)
- return;
-
- if (fabs(MaxE-MinE) < 1e-5)
- return;
-
- EZero=(wd->height-EHeight)/2;
- scale=EZero/(real) epr;
- EZero+=EHeight;
- XDrawLine(x11->disp,wd->self,x11->gc,0,EZero,wd->width,EZero);
-
- for(i=0; (i<ew->nlast); i++) {
- y=ew->e[ew->etype][i]*scale;
- if (y)
- XDrawLine(x11->disp,wd->self,x11->gc,i,EZero,i,EZero-y);
- }
-}
-
-static gmx_bool EWCallBack(t_x11 *x11,XEvent *event, Window w, void *data)
-{
- t_enerwin *ew;
- int i,x,y,width;
-
- return FALSE;
- ew=(t_enerwin *)data;
- switch(event->type) {
- case Expose:
- XSetForeground(x11->disp,x11->gc,WHITE);
- DrawEGraph(x11,ew);
- XSetForeground(x11->disp,x11->gc,x11->fg);
- break;
- case ConfigureNotify:
- ew->wd.x=event->xconfigure.x;
- ew->wd.y=event->xconfigure.y;
- ew->wd.width=event->xconfigure.width;
- ew->wd.height=event->xconfigure.height;
- if (ew->wd.width > ew->nwidth) {
- ew->nwidth=ew->wd.width;
- for (i=0; (i<ew->nre); i++)
- srenew(ew->e[i],ew->nwidth);
- }
- break;
- case ButtonPress:
- x=event->xbutton.x;
- y=ew->wd.y+event->xbutton.y;
- width=menu_width(ew->selener);
- x=min(x+ew->wd.x,ew->wd.x+ew->wd.width-width);
- printf("Showing at %d,%d, width %d\n",x,y,width);
- show_menu(x11,ew->selener,x,y,TRUE);
- break;
- case ClientMessage:
- ew->etype=event->xclient.data.l[0];
- ExposeWin(x11->disp,ew->wd.self);
- /* Fall thru... */
- case ButtonRelease:
- hide_menu(x11,ew->selener);
- break;
- default:
- break;
- }
- return FALSE;
-}
-
-static void create_selener(t_x11 *x11,t_enerwin *ew,Window Parent)
-{
- static t_mentry *se;
- int i;
-
- snew(se,ew->nre);
- for(i=0; (i<ew->nre); i++) {
- se[i].send_to=ew->wd.self;
- se[i].nreturn=i;
- se[i].bChecked=FALSE;
- se[i].str=EType[i];
- }
- ew->selener=init_menu(x11,Parent,x11->fg,x11->bg,ew->nre,se,1);
-}
-
-t_enerwin *init_ew(t_x11 *x11,Window Parent,
- int x,int y,int width,int height,
- unsigned long fg,unsigned long bg)
-{
- t_enerwin *ew;
- int i;
-
- snew(ew,1);
- ew->etype=0;
- ew->nlast=0;
- ew->nwidth=width;
- ew->nre=F_NRE;
- snew(ew->e,ew->nre);
- for(i=0; (i<ew->nre); i++)
- snew(ew->e[i],width);
- InitWin(&ew->wd,x,y,width,height,1,"Ener Window");
- ew->wd.self=XCreateSimpleWindow(x11->disp,Parent,x,y,1,1,1,fg,bg);
- x11->RegisterCallback(x11,ew->wd.self,Parent,EWCallBack,ew);
- x11->SetInputMask(x11,ew->wd.self,ExposureMask | ButtonPressMask |
- ButtonReleaseMask | StructureNotifyMask |
- OwnerGrabButtonMask);
- create_selener(x11,ew,Parent);
-
- return ew;
-}
-
-void map_ewin(t_x11 *x11,t_enerwin *ew)
-{
- XMapWindow(x11->disp,ew->wd.self);
-}
-
-void add_ener(t_x11 *x11,t_enerwin *ew,t_energy e[])
-{
- int i,j,w;
-
- w=ew->nwidth/2;
- if (ew->nlast >= ew->nwidth) {
- for(j=0; (j<ew->nre); j++)
- for(i=0; (i<w); i++)
- ew->e[j][i]=ew->e[j][i+w];
- ew->nlast=w;
- }
-
- for(j=0; (j<ew->nre); j++) {
- ew->e[j][ew->nlast]=e[j].e;
- }
- ew->nlast++;
- ExposeWin(x11->disp,ew->wd.self);
-}
-
-void rewind_ener(t_x11 *x11,t_enerwin *ew)
-{
- ew->nlast=0;
- ExposeWin(x11->disp,ew->wd.self);
-}
-
-void done_ew(t_x11 *x11,t_enerwin *ew)
-{
- done_menu(x11,ew->selener);
- x11->UnRegisterCallback(x11,ew->wd.self);
- sfree(ew);
-}
-
-
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Gyas ROwers Mature At Cryogenic Speed
- */
-
-#ifndef _nener_h
-#define _nener_h
-
-#include "x11.h"
-#include "xutil.h"
-#include "popup.h"
-
-typedef struct {
- t_windata wd; /* Window struct */
- t_menu *selener; /* The Select energy menu */
- int nre,nwidth; /* The number of terms */
- int nlast; /* The last frame added */
- int etype; /* The term selected */
- real **e; /* The energy array */
-} t_enerwin;
-
-extern t_enerwin *init_ew(t_x11 *x11,Window Parent,
- int x,int y,int width,int height,
- unsigned long fg,unsigned long bg);
-
-extern void map_ewin(t_x11 *x11,t_enerwin *ew);
-
-extern void add_ener(t_x11 *x11,t_enerwin *ew,t_energy e[]);
-
-extern void rewind_ener(t_x11 *x11,t_enerwin *ew);
-
-extern void done_ew(t_x11 *x11,t_enerwin *ew);
-
-#endif /* _nener_h */
void init_gmx(t_x11 *x11,char *program,int nfile,t_filenm fnm[],
const output_env_t oenv);
-int EventSignaller(t_manager *man);
-
static void dump_xw(char *dispname,Window w,char *fn)
{
char comm[256];
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Gyas ROwers Mature At Cryogenic Speed
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <math.h>
-#include <typedefs.h>
-#include <macros.h>
-#include <smalloc.h>
-#include <string.h>
-#include "nload.h"
-#include "buttons.h"
-
-void DrawLoad(t_x11 *x11,t_windata *Win,int nloads,int *loadinfo)
-{
- static char *Strings[] = { "Unbalance","Single Node","Your Ad Here ?"};
- int i,y0,bwidth,boff,bar,bmax,bmin,ym,yh;
- int *lb;
- real bav,bscale;
- char maxstr[6];
-
- return;
-
- XClearWindow(x11->disp, Win->self);
- y0=XTextHeight(x11->font)+AIR;
- yh=(Win->height-y0)/2;
- ym=y0+yh;
- XSetForeground(x11->disp,x11->gc,WHITE);
- XDrawLine(x11->disp,Win->self,x11->gc,0,y0,Win->width,y0);
-
- if (nloads >= 2) {
- TextInRect(x11,Win->self,Strings[0],AIR,0,Win->width-2*AIR,y0,
- eXLeft,eYCenter);
- if (loadinfo[0] == 0) {
- nloads--;
- lb=&loadinfo[1];
- }
- else {
- lb=loadinfo;
- if (loadinfo[nloads-1] == 0)
- nloads--;
- }
- bwidth = (Win->width) / nloads;
- boff = (Win->width % nloads)/2;
- bav = 0.0;
-
- bmax=bmin=lb[0];
-
- for (i=1; (i<nloads); i++) {
- bmax = max (bmax,lb[i]);
- bmin = min (bmin,lb[i]);
- bav += lb[i];
- }
- bav/=nloads;
- bscale = (yh-2)/max(fabs(bmax-bav),fabs(bav-bmin));
- sprintf(maxstr,"(%d%%)",(int)(100.0*(bmax-bav)/bav));
- TextInRect(x11,Win->self,maxstr,AIR,0,Win->width-2*AIR,y0,
- eXRight,eYCenter);
-
- XDrawLine(x11->disp,Win->self,x11->gc,0,ym,Win->width,ym);
- if (bmax-bmin) {
- for(i=0; i<nloads; i++) {
- bar=(lb[i]-bav)*bscale;
- if (bar != 0) {
- if (bar > 0)
- XFillRectangle(x11->disp,Win->self,x11->gc,
- (i*bwidth)+boff+1,ym-bar+1,bwidth-2,bar);
- else
- XFillRectangle(x11->disp,Win->self,x11->gc,
- (i*bwidth)+boff+1,ym,bwidth-2,-bar);
- }
- }
-
- }
- }
- else {
- TextInRect(x11,Win->self,Strings[1],AIR,0,Win->width,y0,eXLeft,eYCenter);
- TextInRect(x11,Win->self,Strings[2],AIR,y0,Win->width,
- Win->height-y0,eXLeft,eYCenter);
- }
- XSetForeground(x11->disp,x11->gc,x11->fg);
-}
-
-static gmx_bool LWCallBack(t_x11 *x11,XEvent *event, Window w, void *data)
-{
- t_loadwin *lw;
-
- lw=(t_loadwin *)data;
- switch(event->type) {
- case Expose:
- DrawLoad(x11,&lw->wd,lw->nnodes,lw->load);
- break;
- default:
- break;
- }
- return FALSE;
-}
-
-t_loadwin *init_lw(t_x11 *x11,Window Parent,
- int x,int y,int width,int height,
- unsigned long fg,unsigned long bg)
-{
- t_loadwin *lw;
-
- snew(lw,1);
- snew(lw->load,MAXNODES);
- lw->nnodes=1;
- InitWin(&lw->wd,x,y,width,height,1,"Load Window");
- lw->wd.self=XCreateSimpleWindow(x11->disp,Parent,x,y,1,1,1,fg,bg);
- x11->RegisterCallback(x11,lw->wd.self,Parent,LWCallBack,lw);
- x11->SetInputMask(x11,lw->wd.self,ExposureMask);
-
- return lw;
-}
-
-void map_lw(t_x11 *x11,t_loadwin *lw)
-{
- XMapWindow(x11->disp,lw->wd.self);
-}
-
-void set_load(t_x11 *x11,t_loadwin *lw,int nnodes,int load[])
-{
- int i;
- gmx_bool bChange=FALSE;
-
- lw->nnodes=nnodes;
- for(i=0; (i<nnodes); i++)
- if (lw->load[i] != load[i]) {
- bChange=TRUE;
- lw->load[i]=load[i];
- }
- if (bChange)
- ExposeWin(x11->disp,lw->wd.self);
-}
-
-void done_lw(t_x11 *x11,t_loadwin *lw)
-{
- x11->UnRegisterCallback(x11,lw->wd.self);
- sfree(lw);
-}
-
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Gyas ROwers Mature At Cryogenic Speed
- */
-
-#ifndef _nload_h
-#define _nload_h
-
-#include "x11.h"
-#include "xutil.h"
-
-typedef struct {
- t_windata wd;
- int nnodes;
- int *load;
-} t_loadwin;
-
-extern t_loadwin *init_lw(t_x11 *x11,Window Parent,
- int x,int y,int width,int height,
- unsigned long fg,unsigned long bg);
-
-extern void map_lw(t_x11 *x11,t_loadwin *lw);
-
-extern void set_load(t_x11 *x11,t_loadwin *lw,int nnodes,int load[]);
-
-extern void done_lw(t_x11 *x11,t_loadwin *lw);
-
-#endif /* _nload_h */
#include <math.h>
#include "sysstuff.h"
-#include "string.h"
+#include <string.h>
#include "smalloc.h"
#include "macros.h"
#include "xutil.h"
#include <Xstuff.h>
#include <x11.h>
#include "sysstuff.h"
-#include "string.h"
+#include <string.h>
#include "smalloc.h"
#include "string2.h"
+++ /dev/null
-.deps
-.libs
eigio.c cmat.c
eigensolver.c nsc.c
hxprops.c fitahx.c
- geminate.c
+ geminate.c nsfactor.c
gmx_analyze.c gmx_anaeig.c gmx_angle.c gmx_bond.c
gmx_bundle.c gmx_chi.c gmx_cluster.c gmx_confrms.c
gmx_covar.c gmx_current.c
gmx_nmens.c gmx_order.c gmx_principal.c
gmx_polystat.c gmx_potential.c gmx_rama.c
gmx_rdf.c gmx_rms.c gmx_rmsf.c
- gmx_rotacf.c gmx_saltbr.c gmx_sas.c
+ gmx_rotacf.c gmx_saltbr.c gmx_sas.c gmx_sans.c
gmx_select.c gmx_rmsdist.c gmx_rotmat.c
gmx_sgangle.c gmx_sorient.c gmx_spol.c gmx_tcaf.c
gmx_traj.c gmx_velacc.c gmx_helixorient.c
addconf.c calcpot.c edittop.c gmx_bar.c
gmx_membed.c gmx_pme_error.c gmx_options.c gmx_dos.c
gmx_hydorder.c gmx_densorder.c powerspect.c dens_filter.c
- binsearch.c
+ binsearch.c gmx_dyecoupl.c
)
g_spol g_spatial g_tcaf g_traj g_tune_pme g_vanhove
g_velacc g_clustsize g_mdmat g_wham g_sigeps g_bar
g_membed g_pme_error g_rmsdist g_rotmat g_options
- g_dos g_hydorder g_densorder
+ g_dos g_hydorder g_densorder g_dyecoupl g_sans
)
set(GMX_TOOLS_PROGRAMS_NOT_FOR_INSTALLATION
+++ /dev/null
-## Process this file with automake to produce Makefile.in
-# Note: Makefile is automatically generated from Makefile.in by the configure
-# script, and Makefile.in is generated from Makefile.am by automake.
-
-AM_CPPFLAGS = -I$(top_srcdir)/include -DGMXLIBDIR=\"$(datadir)/top\"
-
-lib_LTLIBRARIES = libgmxana@LIBSUFFIX@.la
-
-pkgconfigdir = ${libdir}/pkgconfig
-pkgconfig_DATA = libgmxana@LIBSUFFIX@.pc
-
-libgmxana@LIBSUFFIX@_la_LIBADD = ../gmxlib/libgmx@LIBSUFFIX@.la ../mdlib/libmd@LIBSUFFIX@.la
-libgmxana@LIBSUFFIX@_la_DEPENDENCIES = ../gmxlib/libgmx@LIBSUFFIX@.la ../mdlib/libmd@LIBSUFFIX@.la
-libgmxana@LIBSUFFIX@_la_LDFLAGS = -no-undefined -version-info @SHARED_VERSION_INFO@ @GSL_LIBS@
-
-
-libgmxana@LIBSUFFIX@_la_SOURCES = \
- geminate.c geminate.h \
- autocorr.c expfit.c polynomials.c levenmar.c \
- anadih.c pp2shift.c pp2shift.h dlist.c \
- eigio.c cmat.c cmat.h \
- eigensolver.c eigensolver.h nsc.c nsc.h \
- hxprops.c hxprops.h fitahx.c fitahx.h \
- gmx_analyze.c gmx_anaeig.c gmx_bar.c \
- gmx_angle.c gmx_bond.c \
- gmx_bundle.c gmx_chi.c gmx_cluster.c gmx_confrms.c \
- gmx_covar.c gmx_current.c gmx_dos.c \
- gmx_density.c gmx_densmap.c gmx_dih.c \
- gmx_dielectric.c gmx_kinetics.c gmx_spatial.c \
- gmx_dipoles.c gmx_disre.c gmx_dist.c gmx_dyndom.c \
- gmx_enemat.c gmx_energy.c gmx_lie.c gmx_filter.c \
- gmx_gyrate.c gmx_h2order.c gmx_hbond.c gmx_helix.c \
- gmx_mindist.c gmx_msd.c gmx_morph.c gmx_nmeig.c \
- gmx_nmens.c gmx_order.c gmx_principal.c \
- gmx_polystat.c gmx_potential.c gmx_rama.c \
- gmx_rdf.c gmx_rms.c gmx_rmsdist.c gmx_rmsf.c \
- gmx_rotacf.c gmx_rotmat.c gmx_saltbr.c gmx_sas.c \
- gmx_select.c gmx_pme_error.c gmx_options.c\
- gmx_sgangle.c gmx_sorient.c gmx_spol.c gmx_tcaf.c \
- gmx_traj.c gmx_velacc.c gmx_helixorient.c \
- gmx_clustsize.c gmx_mdmat.c gmx_wham.c eigio.h \
- correl.c correl.h gmx_sham.c gmx_nmtraj.c \
- gmx_trjconv.c gmx_trjcat.c gmx_trjorder.c gmx_xpm2ps.c \
- gmx_editconf.c gmx_genbox.c gmx_genion.c gmx_genconf.c \
- gmx_genpr.c gmx_eneconv.c gmx_vanhove.c gmx_wheel.c \
- addconf.c addconf.h gmx_tune_pme.c gmx_membed.c \
- calcpot.c calcpot.h edittop.c \
- dens_filter.c dens_filter.h \
- powerspect.c powerspect.h interf.h \
- gmx_densorder.c gmx_hydorder.c \
- binsearch.h binsearch.c
-
-bin_PROGRAMS = \
- do_dssp editconf eneconv \
- genbox genconf genrestr g_nmtraj \
- make_ndx mk_angndx trjcat trjconv \
- trjorder g_wheel xpm2ps genion \
- g_anadock make_edi \
- g_analyze g_anaeig g_bar \
- g_angle g_bond \
- g_bundle g_chi g_cluster g_confrms \
- g_covar g_current g_dos \
- g_density g_densmap g_dih \
- g_dielectric g_helixorient g_principal \
- g_dipoles g_disre g_dist g_dyndom \
- g_enemat g_energy g_lie g_filter \
- g_gyrate g_h2order g_hbond g_helix \
- g_mindist g_msd g_morph g_nmeig \
- g_nmens g_order g_kinetics \
- g_polystat g_potential g_rama \
- g_rdf g_rms g_rmsdist g_rmsf \
- g_rotacf g_rotmat g_saltbr g_sas \
- g_select g_sgangle \
- g_sham g_sorient g_spol \
- g_spatial g_pme_error g_options \
- g_tcaf g_traj g_tune_pme \
- g_vanhove g_velacc g_membed \
- g_clustsize g_mdmat g_wham g_kinetics \
- g_sigeps g_densorder g_hydorder
-
-EXTRA_DIST = libgmxana.pc.cmakein
-
-LDADD = $(lib_LTLIBRARIES) ../mdlib/libmd@LIBSUFFIX@.la \
- ../gmxlib/libgmx@LIBSUFFIX@.la
-
-
-CLEANFILES = *.la *~ \\\#*
-
-
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <math.h>
-#include "typedefs.h"
-#include "xvgr.h"
-#include "gstat.h"
-#include "copyrite.h"
-#include "macros.h"
-#include "random.h"
-#include "smalloc.h"
-
-int main(int argc,char *argv[])
-{
- FILE *fp;
- const char *desc[] = {
- "testac tests the functioning of the GROMACS acf routines"
- };
- static int nframes = 1024;
- static int datatp = 0;
- static real a=0.02*M_PI;
- output_env_t oenv;
- t_pargs pa[] = {
- { "-np", FALSE, etINT, &nframes,
- "Number of data points" },
- { "-dtp",FALSE, etINT, &datatp,
- "Which data: 0=all 0.0, 1=all 1.0, 2=cos(a t), 3=random, 4=cos(a t)+random, 5=sin(a t)/(a t)" }
- };
- static char *str[] = {
- "all 0.0",
- "all 1.0",
- "cos(a t)",
- "random",
- "cos(a t)+random",
- "sin(a t)/(a t)"
- };
- t_filenm fnm[] = {
- { efXVG, "-d", "acf-data", ffWRITE },
- { efXVG, "-c", "acf-corr", ffWRITE },
- { efXVG, "-comb", "acf-comb.xvg", ffWRITE }
- };
-#define NFILE asize(fnm)
- int npargs,i,nlag;
- int seed=1993;
- real *data,*data2,x;
- t_pargs *ppa;
-
- CopyRight(stderr,argv[0]);
- npargs = asize(pa);
- ppa = add_acf_pargs(&npargs,pa);
- parse_common_args_r(&argc,argv,PCA_CAN_TIME | PCA_CAN_VIEW | PCA_BE_NICE,
- NFILE,fnm,npargs,ppa,asize(desc),desc,0,NULL,&oenv);
- snew(data,nframes);
- snew(data2,nframes);
-
- fp = xvgropen(opt2fn("-d",NFILE,fnm),"testac","x","y",oenv);
- for(i=0; (i<nframes); i++) {
- x = a*i;
- switch (datatp) {
- case 1:
- data[i] = 1;
- break;
- case 2:
- data[i] = cos(x);
- break;
- case 3:
- data[i] = 2*rando(&seed)-1.0;
- break;
- case 4:
- data[i] = cos(x)+2*rando(&seed)-1.0;
- break;
- case 5:
- if (i==0)
- data[i] = 1;
- else
- data[i] = sin(x)/(x);
- default:
- /* Data remains 0.0 */
- break;
- }
- fprintf(fp,"%10g %10g\n",x,data[i]);
- data2[i] = data[i];
- }
- ffclose(fp);
-
- do_autocorr(opt2fn("-c",NFILE,fnm),oenv,str[datatp],
- nframes,1,&data,a,eacNormal,FALSE);
-
- nlag = get_acfnout();
- fp = xvgropen(opt2fn("-comb",NFILE,fnm),"testac","x","y",oenv);
- for(i=0; (i<nlag); i++) {
- fprintf(fp,"%10g %10g %10g\n",a*i,data2[i],data[i]);
- }
- ffclose(fp);
-
- do_view(opt2fn("-c",NFILE,fnm),"-nxy");
-
- thanx(stderr);
-
- return 0;
-}
return 0.5*maxd;
}
-static void set_margin(t_atoms *atoms, rvec *x, real *r)
-{
- int i,d,start;
-
- box_margin=0;
-
- start=0;
- for(i=0; i < atoms->nr; i++) {
- if ( (i+1 == atoms->nr) ||
- (atoms->atom[i+1].resind != atoms->atom[i].resind) ) {
- d=max_dist(x,r,start,i+1);
- if (debug && d>box_margin)
- fprintf(debug,"getting margin from %s: %g\n",
- *(atoms->resinfo[atoms->atom[i].resind].name),box_margin);
- box_margin=max(box_margin,d);
- start=i+1;
- }
- }
- fprintf(stderr,"box_margin = %g\n",box_margin);
-}
-
static gmx_bool outside_box_minus_margin2(rvec x,matrix box)
{
return ( (x[XX]<2*box_margin) || (x[XX]>box[XX][XX]-2*box_margin) ||
/* ir->rlist = ir->rcoulomb = ir->rvdw = rlong;
printf("Neighborsearching with a cut-off of %g\n",rlong);
- init_forcerec(stdout,fr,ir,top,cr,md,box,FALSE,NULL,NULL,TRUE);*/
+ init_forcerec(stdout,fr,ir,top,cr,md,box,FALSE,NULL,NULL,NULL,TRUE);*/
fr->cg0 = 0;
fr->hcg = top->cgs.nr;
fr->nWatMol = 0;
/* Init things dependent on parameters */
ir->rlistlong = ir->rlist = ir->rcoulomb = ir->rvdw = rlong;
printf("Neighborsearching with a cut-off of %g\n",rlong);
- init_forcerec(stdout,oenv,fr,NULL,ir,mtop,cr,box,FALSE,NULL,NULL,NULL,
+ init_forcerec(stdout,oenv,fr,NULL,ir,mtop,cr,box,FALSE,NULL,NULL,NULL,NULL,
TRUE,-1);
if (debug)
pr_forcerec(debug,fr,cr);
/* just a wrapper; declare extra args, then chuck away at end. */
int maxchi = 0 ;
t_dlist *dlist ;
- int *xity;
+ int *multiplicity;
int nlist = nangles ;
int k ;
snew(dlist,nlist);
- snew(xity,nangles);
+ snew(multiplicity,nangles);
for(k=0; (k<nangles); k++) {
- xity[k]=3 ;
+ multiplicity[k]=3 ;
}
low_ana_dih_trans(TRUE, fn_trans,TRUE, fn_histo, maxchi,
dih, nlist, dlist, nframes,
- nangles, grpname, xity, time, bRb, 0.5,oenv);
+ nangles, grpname, multiplicity, time, bRb, 0.5,oenv);
sfree(dlist);
- sfree(xity);
+ sfree(multiplicity);
}
void low_ana_dih_trans(gmx_bool bTrans, const char *fn_trans,
gmx_bool bHisto, const char *fn_histo, int maxchi,
real **dih, int nlist, t_dlist dlist[], int nframes,
- int nangles, const char *grpname, int xity[],
+ int nangles, const char *grpname, int multiplicity[],
real *time, gmx_bool bRb, real core_frac,
const output_env_t oenv)
{
#ifdef OLDIE
mind = maxd = prev = dih[i][0];
#else
- cur_bin = calc_bin(dih[i][0],xity[i],core_frac);
+ cur_bin = calc_bin(dih[i][0],multiplicity[i],core_frac);
rot_occ[cur_bin][i]++ ;
#endif
for (j=1; (j<nframes); j++)
{
- new_bin = calc_bin(dih[i][j],xity[i],core_frac);
+ new_bin = calc_bin(dih[i][j],multiplicity[i],core_frac);
rot_occ[new_bin][i]++ ;
#ifndef OLDIE
if (cur_bin == 0)
}
-void mk_multiplicity_lookup (int *xity, int maxchi, real **dih,
+void mk_multiplicity_lookup (int *multiplicity, int maxchi, real **dih,
int nlist, t_dlist dlist[],int nangles)
{
/* new by grs - for dihedral j (as in dih[j]) get multiplicity from dlist
- * and store in xity[j]
+ * and store in multiplicity[j]
*/
int j, Dih, i ;
((Dih == edOmega) && (has_dihedral(edOmega,&(dlist[i])))) ||
((Dih > edOmega) && (dlist[i].atm.Cn[Dih-NONCHI+3] != -1))) {
/* default - we will correct the rest below */
- xity[j] = 3 ;
+ multiplicity[j] = 3 ;
/* make omegas 2fold, though doesn't make much more sense than 3 */
if (Dih == edOmega && (has_dihedral(edOmega,&(dlist[i])))) {
- xity[j] = 2 ;
+ multiplicity[j] = 2 ;
}
/* dihedrals to aromatic rings, COO, CONH2 or guanidinium are 2fold*/
((strstr(name,"GLN") != NULL) && (Dih == edChi3)) ||
((strstr(name,"ASN") != NULL) && (Dih == edChi2)) ||
((strstr(name,"ARG") != NULL) && (Dih == edChi4)) ) {
- xity[j] = 2;
+ multiplicity[j] = 2;
}
}
j++ ;
j,nangles);
/* Check for remaining dihedrals */
for(;(j < nangles); j++)
- xity[j] = 3;
+ multiplicity[j] = 3;
}
void get_chi_product_traj (real **dih,int nframes,int nangles, int nlist,
int maxchi, t_dlist dlist[], real time[],
- int **lookup, int *xity,gmx_bool bRb, gmx_bool bNormalize,
+ int **lookup, int *multiplicity,gmx_bool bRb, gmx_bool bNormalize,
real core_frac, gmx_bool bAll, const char *fnall,
const output_env_t oenv)
{
for (Xi = 0 ; Xi < maxchi ; Xi ++ ) {
index = lookup[i][Xi] ; /* chi_(Xi+1) of res i (-1 if off end) */
if ( index >= 0 ) {
- n = xity[index];
+ n = multiplicity[index];
nbin = n*nbin ;
}
}
bRotZero = TRUE ;
bHaveChi = FALSE ;
} else {
- b = calc_bin(dih[index][j],xity[index],core_frac) ;
+ b = calc_bin(dih[index][j],multiplicity[index],core_frac) ;
accum = b - 1 ;
if (b == 0 )
bRotZero = TRUE ;
for (Xi = 1 ; Xi < maxchi ; Xi ++ ) {
index = lookup[i][Xi] ; /* chi_(Xi+1) of res i (-1 if off end) */
if ( index >= 0 ) {
- n = xity[index];
+ n = multiplicity[index];
b = calc_bin(dih[index][j],n,core_frac);
accum = n * accum + b - 1 ;
if (b == 0 )
/* Initiate forcerecord */
*fr = mk_forcerec();
init_forcerec(fplog,oenv,*fr,NULL,inputrec,mtop,*cr,
- state->box,FALSE,table,table,NULL,TRUE,-1);
+ state->box,FALSE,table,NULL,table,NULL,TRUE,-1);
/* Remove periodicity */
for(m=0; (m<DIM); m++)
realft(ans,no2,-1);
sfree(fft);
}
-
-void complex_mult(int n,real buf1[],real buf2[],real ans[])
-{
- int i,no2,n_2,k;
- real no2_1;
-
- n_2 = (n+1)/2;
- no2_1 = 1.0/n;
- for(i=1; (i<n_2); i++) {
- k = n-i;
- ans[i] = (buf1[i]*buf2[i] + buf2[k]*buf1[k])*no2_1;
- ans[k] = (buf1[k]*buf2[i] - buf2[i]*buf1[k])*no2_1;
- }
- if ((n % 2) == 0)
- ans[n/2] = (buf1[n/2]*buf2[n/2])*no2_1;
- ans[0] = buf1[0]*buf2[0]*no2_1;
-}
"y = a2*ee(a1,x) + (1-a2)*ee(a2,x)"
};
-extern gmx_bool mrqmin(real x[],real y[],real sig[],int ndata,real a[],
- int ma,int lista[],int mfit,real **covar,real **alpha,
- real *chisq,
- void (*funcs)(real x,real a[],real *y,real dyda[]),
- real *alamda);
-
extern gmx_bool mrqmin_new(real x[],real y[],real sig[],int ndata,real a[],
int ia[],int ma,real **covar,real **alpha,real *chisq,
void (*funcs)(real, real [], real *, real []),
return A*exp(-x/tau);
}
-static real signum(real num){
- real sign;
- if(num<0){
- sign=-1.0;
- }
- else {
- sign=1.0;
- }
- return sign;
-}
-
void erffit (real x, real a[], real *y, real dyda[])
{
/* Fuction
fprintf(fp,"%10.5e %10.5e %10.5e\n",
ttt,c1[j],fit_function(eFitFn,parm,ttt));
}
- fclose(fp);
+ xvgrclose(fp);
}
}
for(i=0;(i<nparm);i++)
*
* GROningen MAchine for Chemical Simulations
*
- * VERSION 3.2.0
* Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
+ * Copyright (c) 2001-2008, The GROMACS development team,
* check out http://www.gromacs.org for more information.
-
+
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* For more info, check our website at http://www.gromacs.org
*
* And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
+ * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
*/
+
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#include <gmx_ana.h>
/* This is just a wrapper binary.
-* The code that used to be in g_relax.c is now in gmx_relax.c,
-* where the old main function is called gmx_relax().
*/
int
main(int argc, char *argv[])
{
- gmx_relax(argc,argv);
+ gmx_dyecoupl(argc,argv);
return 0;
}
-
-
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-
-/* This is just a wrapper binary.
-* The code that used to be in g_multipoles.c is now in gmx_multipoles.c,
-* where the old main function is called gmx_multipoles().
-*/
-int
-main(int argc, char *argv[])
-{
- gmx_multipoles(argc,argv);
- return 0;
-}
-
-
-
#include <config.h>
#endif
+#include <gmx_ana.h>
/* This is just a wrapper binary.
-* The code that used to be in g_com.c is now in gmx_com.c,
-* where the old main function is called gmx_com().
+* The code that used to be in gmx_sans.c is now in gmx_rdf.c,
+* where the old main function is called gmx_sans().
*/
int
main(int argc, char *argv[])
{
- gmx_com(argc,argv);
+ gmx_sans(argc,argv);
return 0;
}
return value;
}
-/* Real and Imaginary part of a complex number z -- Re (z) and Im (z) */
-static double gem_Re(gem_complex z) {return z.r;}
-static double gem_Im(gem_complex z) {return z.i;}
-
/* Magnitude of a complex number z */
static double gem_cx_abs(gem_complex z) { return (sqrt(z.r*z.r+z.i*z.i)); }
return value;
}
-/* Integer power of a complex number z -- z^x */
-static gem_complex gem_cxintpow(gem_complex z, int x)
-{
- int i;
- gem_complex value;
-
- value.r = 1.;
- value.i = 0.;
-
- if(x>0)
- {
- for(i=0; i < x; i++)
- value = gem_cxmul(value, z);
- return value;
- }
- else
- {
- if(x<0) {
- for(i=0; i > x; i--)
- value = gem_cxdiv(value, z);
- return value;
- }
- else {
- return value;
- }
- }
-}
-
/* Exponential of a complex number-- exp (z)=|exp(z.r)|*{cos(z.i)+I*sin(z.i)}*/
static gem_complex gem_cxdexp(gem_complex z)
{
return value;
}
-/* square root of a real number r */
-static gem_complex gem_cxrsqrt(double r) {
- if (r < 0)
- {
- return(gem_cmplx(0, sqrt(-r)));
- }
- else
- {
- return(gem_c(sqrt(r)));
- }
-}
-
/* Complex power of a complex number z1^z2 */
static gem_complex gem_cxdpow(gem_complex z1, gem_complex z2)
{
return value;
}
-/* Print out a complex number z as z: z.r, z.i */
-static void gem_cxprintf(gem_complex z) { fprintf(stdout, "z: %lg + %lg_i\n", z.r, z.i); }
/* ------------ end of complex.c ------------ */
/* This next part was derived from cubic.c, also received from Omer Markovitch.
return ans;
}
-/* W(x,y)=exp(-x^2)*omega(x+y)=exp(2xy+y^2)*erfc(x+y) */
-static double gem_W(double x, double y){ return(exp(-x*x)*gem_omega(x+y)); }
-
-/**************************************************************/
-/* Complex error function and related functions */
-/* x, y : real variables */
-/* z : complex variable */
-/* cerf(z) : error function */
-/* comega(z): exp(z*z)*cerfc(z) */
-/* W(x,z) : exp(-x*x)*comega(x+z)=exp(2*x*z+z^2)*cerfc(x+z) */
-/**************************************************************/
-static gem_complex gem_cerf(gem_complex z)
-{
- gem_complex value;
- double x,y;
- double sumr,sumi,n,n2,f,temp,temp1;
- double x2,cos_2xy,sin_2xy,cosh_2xy,sinh_2xy,cosh_ny,sinh_ny;
-
- x = z.r;
- y = z.i;
- x2 = x*x;
- sumr = 0.;
- sumi = 0.;
- cos_2xy = cos(2.*x*y);
- sin_2xy = sin(2.*x*y);
- cosh_2xy = cosh(2.*x*y);
- sinh_2xy = sinh(2.*x*y);
-
- for(n=1.0,temp=0.; n<=2000.; n+=1.0)
- {
- n2 = n*n;
- cosh_ny = cosh(n*y);
- sinh_ny = sinh(n*y);
- f = exp(-n2/4.)/(n2+4.*x2);
- sumr += (2.*x - 2.*x*cosh_ny*cos_2xy+n*sinh_ny*sin_2xy)*f;
- sumi += (2.*x*cosh_ny*sin_2xy + n*sinh_ny*cos_2xy)*f;
- temp1 = sqrt(sumr*sumr+sumi*sumi);
- if(fabs((temp1-temp)/temp1)<1.E-16) {
- break;
- }
- temp = temp1;
- }
-
- if(n==2000.) {
- fprintf(stderr, "iteration exceeds %lg\n",n);
- }
-
- sumr*=2./PI;
- sumi*=2./PI;
-
- if(x!=0.) {
- f = 1./2./PI/x;
- } else {
- f = 0.;
- }
- value.r = gem_erf(x) + (f*(1.-cos_2xy) + sumr)*exp(-x2);
- value.i = (f*sin_2xy+sumi)*exp(-x2);
- return value;
-}
-
/*---------------------------------------------------------------------------*/
/* Utilzed the series approximation of erf(z=x+iy) */
/* Relative error=|err(z)|/|erf(z)|<EPS */
return (value);
}
-/* W(x,z) exp(-x^2)*omega(x+z) */
-static gem_complex gem_cW(double x, gem_complex z){ return(gem_cxrmul(gem_comega(gem_cxradd(z,x)),exp(-x*x))); }
-
/* ------------ end of [cr]error.c ------------ */
/*_ REVERSIBLE GEMINATE RECOMBINATION
/* p->logMult = pow((float)len, 1.0/nLin);/\* pow(t[len-1]-t[0], 1.0/p->nLin); *\/ */
p->ballistic = ballistic;
- p->bDt;
return p;
}
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
-#include "string2.h"
-#include "strdb.h"
-#include "typedefs.h"
-#include "macros.h"
-#include "copyrite.h"
-#include "smalloc.h"
-#include "statutil.h"
-#include "confio.h"
-#include "calch.h"
-
-typedef struct {
- char *key;
- int nexp;
- char **exp;
-} t_expansion;
-
-t_expansion *read_expansion_map(char *fn,int *nexpand)
-{
- char ibuf[12],buf[12][10];
- char **ptr;
- t_expansion *exp;
- int i,k,nexp,nn;
-
- nexp=get_file(fn,&ptr);
-
- snew(exp,nexp);
- for(i=0; (i<nexp); i++) {
- /* Let scanf do the counting... */
- nn=sscanf(ptr[i],"%s%s%s%s%s%s%s%s%s%s%s",
- ibuf,buf[0],buf[1],buf[2],buf[3],buf[4],
- buf[5],buf[6],buf[7],buf[8],buf[9]);
- if (nn <= 1)
- break;
- exp[i].key=strdup(ibuf);
- exp[i].nexp=nn-1;
- snew(exp[i].exp,nn-1);
- for(k=0; (k<nn-1); k++)
- exp[i].exp[k]=strdup(buf[k]);
- }
- fprintf(stderr,"I found %d expansion mapping entries!\n",i);
-
- /* Clean up */
- for(i=0; (i<nexp); i++)
- sfree(ptr[i]);
- sfree(ptr);
-
- *nexpand=nexp;
- return exp;
-}
-
-char **get_exp(int NEXP,t_expansion expansion[],char **ai,int *nexp)
-{
- int i;
-
- for(i=0; (i<NEXP); i++)
- if (strcmp(*ai,expansion[i].key) == 0) {
- *nexp=expansion[i].nexp;
- return expansion[i].exp;
- }
- *nexp=1;
-
- return ai;
-}
-
-int find_atom(char *ai,char *ri,
- int resi,int r0,
- int natoms,char ***aname,t_atom atom[],
- int linec,gmx_bool bVerbose)
-{
- int i;
-
- /* Locate residue */
- for(i=0; (i<natoms) && (atom[i].resnr != resi); i++)
- ;
- if (i == natoms)
- return -1;
-
- /* Compare atom names */
- for( ; (i<natoms) && (atom[i].resnr == resi); i++)
- if (strcmp(*(aname[i]),ai) == 0)
- return i;
-
- /* Not found?! */
- if (bVerbose)
- fprintf(stderr,"Warning: atom %s not found in res %s%d (line %d)\n",
- ai,ri ? ri : "",resi+r0,linec);
-
- return -1;
-}
-
-void conv_dr(FILE *in,FILE *out,char *map,t_atoms *atoms,int r0,gmx_bool bXplor,
- gmx_bool bVerbose)
-{
- static char *format="%s%d%s%s%d%s%lf%lf";
- static char *xplorformat="%d%s%d%s";
- gmx_bool bOK;
- int i,j,nc,nindex,ni,nj,nunres;
- int atomi,atomj,resi,resj;
- char **aiexp,**ajexp;
- char *ai,*aj;
- char *ri,*rj;
- char buf[1024];
- double ub,lb;
- int linec;
- int NEXP;
- t_expansion *exp;
-
- exp=read_expansion_map(map,&NEXP);
-
- nc=0;
- nindex=0;
- nunres=0;
- snew(ai,10);
- snew(aj,10);
- fprintf(out,"[ distance_restraints ]\n");
- linec=1;
-
- if (bXplor) {
- ri = rj = NULL;
- }
- else {
- snew(ri,16);
- snew(rj,16);
- }
- while (fgets2(buf,1023,in) != NULL) {
- /* Parse the input string. If your file format is different,
- * modify it here...
- * If your file contains no spaces but colon (:) for separators
- * it may be easier to just replace those by a space using a
- * text editor.
- */
- if (bXplor) {
- bOK = (sscanf(buf,xplorformat,&resi,ai,&resj,aj) == 4);
- /* Cut atomnames at 4 characters */
- if (strlen(ai) >= 4)
- ai[4] = '\0';
- if (strlen(aj) >= 4)
- aj[4] = '\0';
- ub = 5.0;
- lb = 2.0;
- }
- else {
- bOK = (sscanf(buf,format,ri,&resi,ai,rj,&resj,aj,&lb,&ub) == 8);
- }
- if (bOK) {
- aiexp=get_exp(NEXP,exp,&ai,&ni);
- ajexp=get_exp(NEXP,exp,&aj,&nj);
-
- /* Turn bounds into nm */
- ub*=0.1;
- lb*=0.1;
-
- /* Subtract starting residue to match topology */
- resi-=r0;
- resj-=r0;
-
- /* Test whether residue names match
- * Again, if there is a mismatch between GROMACS names
- * and your file (eg. HIS vs. HISH) it may be easiest to
- * use your text editor...
- */
-
- if (!bXplor) {
- bOK = (strcmp(*atoms->resname[resi],ri) == 0);
- if (!bOK) {
- fprintf(stderr,"Warning resname in disres file %s%d, in tpx file %s%d\n",
- ri,resi+r0,*atoms->resname[resi],resi+r0);
- nunres++;
- }
- else {
- /* Residue j */
- bOK = (strcmp(*atoms->resname[resj],rj) != 0);
- if (!bOK) {
- fprintf(stderr,"Warning resname in disres file %s%d, in tpx file %s%d\n",
- rj,resj+r0,*atoms->resname[resj],resj+r0);
- nunres++;
- }
- }
- }
- if (bOK) {
- /* Here, both residue names match ! */
- for(i=0; (i<ni); i++) {
- if ((atomi=find_atom(aiexp[i],ri,resi,r0,atoms->nr,
- atoms->atomname,atoms->atom,linec,bVerbose)) == -1)
- nunres++;
- else {
- /* First atom is found now... */
- for(j=0; (j<nj); j++) {
- if ((atomj=find_atom(ajexp[j],rj,resj,r0,atoms->nr,
- atoms->atomname,atoms->atom,linec,bVerbose)) == -1)
- nunres++;
- else {
- /* BOTH atoms are found now! */
- fprintf(out,"%5d %5d 1 %5d 1 %8.3f %8.3f %8.3f %8.3f\n",
- 1+atomi,1+atomj,nindex,lb,ub,0.0,0.0);
- nc++;
- }
- }
- }
- }
- }
- nindex++;
- }
- linec++;
- }
- fprintf(stderr,"Total number of NOES: %d\n",nindex);
- fprintf(stderr,"Total number of restraints: %d\n",nc);
- fprintf(stderr,"Total number of unresolved atoms: %d\n",nunres);
- if (nunres+nc != nindex)
- fprintf(stderr,"Holy Cow! some lines have disappeared.\n");
-}
-
-int main (int argc,char *argv[])
-{
- const char *desc[] = {
- "gendr generates a distance restraint entry for a gromacs topology",
- "from another format. The format of the input file must be:[BR]",
- "resnr-i resname-i atomnm-i resnr-j resname-j atomnm-j lower upper[BR]" ,
- "where lower and upper are the distance bounds.",
- "The entries must be separated by spaces, but may be otherwise in",
- "free format. Some expansion of templates like MB -> HB1, HB2 is done",
- "but this is not really well tested."
- };
- const char *bugs[] = {
- "This program is not well tested. Use at your own risk."
- };
-
- static int r0 = 1;
- static gmx_bool bXplor = FALSE;
- static gmx_bool bVerbose = FALSE;
- t_pargs pa[] = {
- { "-r", FALSE, etINT, {&r0}, "starting residue number" },
- { "-xplor", FALSE, etBOOL, {&bXplor}, "Use xplor format for input" },
- { "-v", FALSE, etBOOL, {&bVerbose}, "Be loud and noisy" }
- };
-
- FILE *in,*out;
- t_topology *top;
-
- t_filenm fnm[] = {
- { efTPX, "-s", NULL, ffREAD },
- { efDAT, "-d", NULL, ffREAD },
- { efITP, "-o", NULL, ffWRITE },
- { efDAT, "-m", "expmap", ffREAD }
- };
-#define NFILE asize(fnm)
-
- CopyRight(stderr,argv[0]);
- parse_common_args(&argc,argv,0,NFILE,fnm,asize(pa),pa,asize(desc),desc,
- asize(bugs),bugs);
-
- fprintf(stderr,"******************* WARNING *****************************\n");
- fprintf(stderr,"*** Use at your own risk. When in doubt check the source.\n");
- fprintf(stderr,"*** Hang on: check the source anyway.\n");
- fprintf(stderr,"******************* WARNING *****************************\n");
-
- fprintf(stderr,"Will subtract %d from res numbers in %s\n",
- r0,ftp2fn(efDAT,NFILE,fnm));
-
- top=read_top(ftp2fn(efTPX,NFILE,fnm));
-
- in = opt2FILE("-d",NFILE,fnm,"r");
- out = ftp2FILE(efITP,NFILE,fnm,"w");
- conv_dr(in,out,opt2fn("-m",NFILE,fnm),&(top->atoms),r0,bXplor,bVerbose);
- ffclose(in);
- ffclose(out);
-
- thanx(stderr);
-
- return 0;
-}
-
-
"computed based on the Quasiharmonic approach and based on",
"Schlitter's formula."
};
- static int first=1,last=8,skip=1,nextr=2,nskip=6;
+ static int first=1,last=-1,skip=1,nextr=2,nskip=6;
static real max=0.0,temp=298.15;
static gmx_bool bSplit=FALSE,bEntropy=FALSE;
t_pargs pa[] = {
return sqrt(parm[1]*2*parm[0]/T+parm[3]*2*parm[2]/T);
}
-static real anal_ee(real *parm,real T,real t)
-{
- real e1,e2;
-
- if (parm[0])
- e1 = exp(-t/parm[0]);
- else
- e1 = 1;
- if (parm[2])
- e2 = exp(-t/parm[2]);
- else
- e2 = 1;
-
- return sqrt(parm[1]*2*parm[0]/T*((e1 - 1)*parm[0]/t + 1) +
- parm[3]*2*parm[2]/T*((e2 - 1)*parm[2]/t + 1));
-}
-
static void estimate_error(const char *eefile,int nb_min,int resol,int n,
int nset, double *av,double *sig,real **val,real dt,
gmx_bool bFitAc,gmx_bool bSingleExpFit,gmx_bool bAllowNegLTCorr,
s->filename=filename;
}
-/* destroy the data structures directly associated with the structure, not
- the data it points to */
-static void samples_destroy(samples_t *s)
-{
- if (s->du_alloc)
- {
- sfree(s->du_alloc);
- }
- if (s->t_alloc)
- {
- sfree(s->t_alloc);
- }
- if (s->hist_alloc)
- {
- hist_destroy(s->hist_alloc);
- sfree(s->hist_alloc);
- }
-}
-
static void sample_range_init(sample_range_t *r, samples_t *s)
{
r->start=0;
#include "smalloc.h"
#include "statutil.h"
#include "tpxio.h"
-#include "string.h"
+#include <string.h>
#include "sysstuff.h"
#include "txtdump.h"
#include "typedefs.h"
atom_id isize,*index;
int ndih,nactdih,nf;
real **dih,*trans_frac,*aver_angle,*time;
- int i,j,**chi_lookup,*xity;
+ int i,j,**chi_lookup,*multiplicity;
t_filenm fnm[] = {
{ efSTX, "-s", NULL, ffREAD },
*
* added multiplicity */
- snew(xity,ndih) ;
- mk_multiplicity_lookup(xity, maxchi, dih, nlist, dlist,ndih);
+ snew(multiplicity,ndih) ;
+ mk_multiplicity_lookup(multiplicity, maxchi, dih, nlist, dlist,ndih);
strcpy(grpname, "All residues, ");
if(bPhi)
low_ana_dih_trans(bDo_ot, opt2fn("-ot",NFILE,fnm),
bDo_oh, opt2fn("-oh",NFILE,fnm),maxchi,
- dih, nlist, dlist, nf, nactdih, grpname, xity,
+ dih, nlist, dlist, nf, nactdih, grpname, multiplicity,
time, FALSE, core_frac,oenv);
/* Order parameters */
mk_chi_lookup(chi_lookup, maxchi, dih, nlist, dlist);
get_chi_product_traj(dih,nf,nactdih,nlist,
- maxchi,dlist,time,chi_lookup,xity,
+ maxchi,dlist,time,chi_lookup,multiplicity,
FALSE,bNormHisto, core_frac,bAll,
opt2fn("-cp",NFILE,fnm),oenv);
#include "viewit.h"
#include "gmx_ana.h"
-/* macro's to print to two file pointers at once (i.e. stderr and log) */
-#define lo_ffprintf(fp1,fp2,buf) \
- fprintf(fp1,"%s",buf);\
- fprintf(fp2,"%s",buf);
+/* print to two file pointers at once (i.e. stderr and log) */
+static inline
+void lo_ffprintf(FILE *fp1, FILE *fp2, const char *buf)
+{
+ fprintf(fp1, "%s", buf);
+ fprintf(fp2, "%s", buf);
+}
+
/* just print a prepared buffer to fp1 and fp2 */
-#define ffprintf(fp1,fp2,buf) { lo_ffprintf(fp1,fp2,buf) }
+static inline
+void ffprintf(FILE *fp1, FILE *fp2, const char *buf)
+{
+ lo_ffprintf(fp1, fp2, buf);
+}
+
/* prepare buffer with one argument, then print to fp1 and fp2 */
-#define ffprintf1(fp1,fp2,buf,fmt,arg) {\
- sprintf(buf,fmt,arg);\
- lo_ffprintf(fp1,fp2,buf)\
+static inline
+void ffprintf_d(FILE *fp1, FILE *fp2, char *buf, const char *fmt, int arg)
+{
+ sprintf(buf, fmt, arg);
+ lo_ffprintf(fp1, fp2, buf);
}
+
+/* prepare buffer with one argument, then print to fp1 and fp2 */
+static inline
+void ffprintf_g(FILE *fp1, FILE *fp2, char *buf, const char *fmt, real arg)
+{
+ sprintf(buf, fmt, arg);
+ lo_ffprintf(fp1, fp2, buf);
+}
+
+/* prepare buffer with one argument, then print to fp1 and fp2 */
+static inline
+void ffprintf_s(FILE *fp1, FILE *fp2, char *buf, const char *fmt, const char *arg)
+{
+ sprintf(buf, fmt, arg);
+ lo_ffprintf(fp1, fp2, buf);
+}
+
+/* prepare buffer with two arguments, then print to fp1 and fp2 */
+static inline
+void ffprintf_dd(FILE *fp1, FILE *fp2, char *buf, const char *fmt, int arg1, int arg2)
+{
+ sprintf(buf, fmt, arg1, arg2);
+ lo_ffprintf(fp1, fp2, buf);
+}
+
+/* prepare buffer with two arguments, then print to fp1 and fp2 */
+static inline
+void ffprintf_gg(FILE *fp1, FILE *fp2, char *buf, const char *fmt, real arg1, real arg2)
+{
+ sprintf(buf, fmt, arg1, arg2);
+ lo_ffprintf(fp1, fp2, buf);
+}
+
/* prepare buffer with two arguments, then print to fp1 and fp2 */
-#define ffprintf2(fp1,fp2,buf,fmt,arg1,arg2) {\
- sprintf(buf,fmt,arg1,arg2);\
- lo_ffprintf(fp1,fp2,buf)\
+static inline
+void ffprintf_ss(FILE *fp1, FILE *fp2, char *buf, const char *fmt, const char *arg1, const char *arg2)
+{
+ sprintf(buf, fmt, arg1, arg2);
+ lo_ffprintf(fp1, fp2, buf);
}
typedef struct {
trans[clust->cl[i-1]-1][clust->cl[i]-1]++;
maxtrans = max(maxtrans, trans[clust->cl[i]-1][clust->cl[i-1]-1]);
}
- ffprintf2(stderr,log,buf,"Counted %d transitions in total, "
+ ffprintf_dd(stderr,log,buf,"Counted %d transitions in total, "
"max %d between two specific clusters\n",ntranst,maxtrans);
if (transfn) {
fp=ffopen(transfn,"w");
clear_mat(zerobox);
- ffprintf1(stderr,log,buf,"\nFound %d clusters\n\n",clust->ncl);
+ ffprintf_d(stderr,log,buf,"\nFound %d clusters\n\n",clust->ncl);
trxsfn=NULL;
if (trxfn) {
/* do we write all structures? */
trxsfn = parse_filename(trxfn, max(write_ncl,clust->ncl));
snew(bWrite,nf);
}
- ffprintf2(stderr,log,buf,"Writing %s structure for each cluster to %s\n",
+ ffprintf_ss(stderr,log,buf,"Writing %s structure for each cluster to %s\n",
bAverage ? "average" : "middle", trxfn);
if (write_ncl) {
/* find out what we want to tell the user:
} else
sprintf(buf1,"Will use P=%d, M=%d",P,M);
}
- ffprintf1(stderr,log,buf,"%s for determining the neighbors\n\n",buf1);
+ ffprintf_s(stderr,log,buf,"%s for determining the neighbors\n\n",buf1);
} else /* method != m_jarvis */
bUseRmsdCut = ( bBinary || method == m_linkage || method == m_gromos );
if (bUseRmsdCut && method != m_jarvis_patrick)
}
fprintf(stderr,"\n\n");
}
- ffprintf2(stderr,log,buf,"The RMSD ranges from %g to %g nm\n",
+ ffprintf_gg(stderr,log,buf,"The RMSD ranges from %g to %g nm\n",
rms->minrms,rms->maxrms);
- ffprintf1(stderr,log,buf,"Average RMSD is %g\n",2*rms->sumrms/(nf*(nf-1)));
- ffprintf1(stderr,log,buf,"Number of structures for matrix %d\n",nf);
- ffprintf1(stderr,log,buf,"Energy of the matrix is %g nm\n",mat_energy(rms));
+ ffprintf_g(stderr,log,buf,"Average RMSD is %g\n",2*rms->sumrms/(nf*(nf-1)));
+ ffprintf_d(stderr,log,buf,"Number of structures for matrix %d\n",nf);
+ ffprintf_g(stderr,log,buf,"Energy of the matrix is %g nm\n",mat_energy(rms));
if (bUseRmsdCut && (rmsdcut < rms->minrms || rmsdcut > rms->maxrms) )
fprintf(stderr,"WARNING: rmsd cutoff %g is outside range of rmsd values "
"%g to %g\n",rmsdcut,rms->minrms,rms->maxrms);
#include "filenm.h"
#include "smalloc.h"
#include "macros.h"
-#include "math.h"
+#include <math.h>
#include "typedefs.h"
#include "xvgr.h"
#include "copyrite.h"
real *mass2=NULL;
rvec *xtop,*vtop;
matrix box;
- atom_id *index0=NULL;
+ atom_id *index0;
int *indexm=NULL;
int isize;
t_trxstatus *status;
#include <ctype.h>
#include "sysstuff.h"
-#include "string.h"
+#include <string.h>
#include "string2.h"
#include "typedefs.h"
#include "smalloc.h"
#endif
#include <math.h>
#include "sysstuff.h"
-#include "string.h"
+#include <string.h>
#include "string2.h"
#include "typedefs.h"
#include "smalloc.h"
gmx_fatal(FARGS,"Invalid axes. Terminating\n");
}
- if( (natoms= read_first_x(oenv,&status,fn,&t,&x0,box)==0))
+ if( (natoms= read_first_x(oenv,&status,fn,&t,&x0,box))==0)
gmx_fatal(FARGS, "Could not read coordinates from file"); /* Open trajectory for read*/
}
-
-
-static void printdensavg(char *fldfn, real ****Densmap, int xslices, int yslices, int zslices, int tdim)
-{
-/*Debug-filename and filehandle*/
- FILE *fldH;
- int n,i,j,k;
- real totdens=0;
- fldH=ffopen(fldfn,"w");
- fprintf(fldH,"%i %i %i %i\n",tdim, xslices,yslices,zslices);
- for(n=0;n<tdim;n++)
- {
- for(i=0;i<xslices;i++)
- {
- for (j=0;j<yslices;j++)
- {
- for (k=0;k<zslices;k++)
- {
- fprintf(fldH,"%i %i %i %f\n",i,j,k,Densmap[n][i][j][k]);
- totdens+=(Densmap[n][i][j][k]);
- }
- }
- }
- }
- totdens/=(xslices*yslices*zslices*tdim);
- fprintf(stderr,"Total density [kg/m^3] %8f",totdens);
- ffclose(fldH);
-}
-
-
static void outputfield(const char *fldfn, real ****Densmap,
int xslices, int yslices, int zslices, int tdim)
{
ffclose(fldH);
}
-static void periodic_running_average(int npoints,real *x,int naver)
-{
- int i,j,nj;
- real *aver;
-
- snew(aver,npoints);
- for(i=0; (i<npoints); i++)
- {
- nj = 0;
- for(j=i-naver/2; (j<i+naver/2); j++)
- {
- aver[i] += x[(j+npoints) % npoints];
- nj++;
- }
- aver[i] /= nj;
- }
- for(i=0; (i<npoints); i++)
- x[i] = aver[i];
- sfree(aver);
-}
-
static void filterdensmap(real ****Densmap, int xslices, int yslices, int zslices,int tblocks,int ftsize)
{
real *kernel;
if(debug){
xvg=xvgropen("DensprofileonZ.xvg", "Averaged Densityprofile on Z","z[nm]","Density[kg/m^3]",oenv);
for(k=0;k<zslices;k++) fprintf(xvg, "%4f.3 %8f.4\n", k*binwidth,zDensavg[k]);
- fclose(xvg);
+ xvgrclose(xvg);
}
/*Fit average density in z over whole trajectory to obtain tentative fit-parameters in fit1 and fit2*/
static void writesurftoxpms(t_interf ***surf1,t_interf ***surf2, int tblocks,int xbins, int ybins, int zbins, real bw,real bwz, char **outfiles,int maplevels )
{
- char numbuf[12];
+ char numbuf[13];
int n, i, j;
real **profile1, **profile2;
real max1, max2, min1, min2, *xticks, *yticks;
#define NOMIN 'X'
-static void dump_dih(int nframes,char *title,real time[],real dih[])
-{
- FILE *out;
- char fname[256];
- int i;
-
- sprintf(fname,"dih.%s",title);
- printf("A dihedral transition occurred in %s\n",fname);
- printf("Do you want to plot it to %s ? (y/n) ",fname);
- fflush(stdout);
- out=ffopen(fname,"w");
- for(i=0; (i<nframes); i++)
- fprintf(out,"%10.3f %12.5e\n",time[i],dih[i]);
- ffclose(out);
-}
-
static void ana_dih(FILE *out,char *index,int nframes,real dih[],t_dih *dd)
{
int i;
update_mdatoms(mdatoms,ir.init_lambda);
fr = mk_forcerec();
fprintf(fplog,"Made forcerec\n");
- init_forcerec(fplog,oenv,fr,NULL,&ir,&mtop,cr,box,FALSE,NULL,NULL,NULL,
+ init_forcerec(fplog,oenv,fr,NULL,&ir,&mtop,cr,box,FALSE,NULL,NULL,NULL,NULL,
FALSE,-1);
init_nrnb(&nrnb);
if (ir.ePBC != epbcNONE)
#include "smalloc.h"
#include "macros.h"
-#include "math.h"
+#include <math.h>
#include "xvgr.h"
#include "copyrite.h"
#include "statutil.h"
"With options [TT]-lt[tt] and [TT]-dist[tt] the number of contacts",
"of all atoms in group 2 that are closer than a certain distance",
"to the center of mass of group 1 are plotted as a function of the time",
- "that the contact was continuously present.[PAR]",
+ "that the contact was continuously present. The [TT]-intra[tt] switch enables",
+ "calculations of intramolecular distances avoiding distance calculation to its",
+ "periodic images. For a proper function, the molecule in the input trajectory",
+ "should be whole (e.g. by preprocessing with [TT]trjconv -pbc[tt]) or a matching",
+ "topology should be provided. The [TT]-intra[tt] switch will only give",
+ "meaningful results for intramolecular and not intermolecular distances.[PAR]",
"Other programs that calculate distances are [TT]g_mindist[tt]",
"and [TT]g_bond[tt]."
};
rvec *com;
real *mass;
FILE *fp=NULL,*fplt=NULL;
- gmx_bool bCutoff,bPrintDist,bLifeTime;
+ gmx_bool bCutoff,bPrintDist,bLifeTime,bIntra=FALSE;
t_pbc *pbc;
int *contact_time=NULL,*ccount=NULL,ccount_nalloc=0,sum;
char buf[STRLEN];
static real cut=0;
- static t_pargs pa[] = {
+ t_pargs pa[] = {
+ { "-intra", FALSE, etBOOL, {&bIntra},
+ "Calculate distances without considering periodic boundaries, e.g. intramolecular." },
{ "-dist", FALSE, etREAL, {&cut},
"Print all atoms in group 2 closer than dist to the center of mass of group 1" }
};
/* write to output */
fprintf(fp,"%12.7f ",t);
for(g=0;(g<ngrps/2);g++) {
- if (pbc)
+ if (pbc && (!bIntra))
pbc_dx(pbc,com[2*g],com[2*g+1],dx);
else
rvec_sub(com[2*g],com[2*g+1],dx);
} else {
for(i=0;(i<isize[1]);i++) {
j=index[1][i];
- if (pbc)
+ if (pbc && (!bIntra))
pbc_dx(pbc,x[j],com[0],dx);
else
rvec_sub(x[j],com[0],dx);
#include "index.h"
#include "smalloc.h"
#include "statutil.h"
-#include "string.h"
+#include <string.h>
#include "sysstuff.h"
#include "txtdump.h"
#include "typedefs.h"
return BOLTZ*(log(calc_compress(fy)) + fy*(3*fy-4)/sqr(1-fy));
}
-static real old_calc_fluidicity(real Delta,real tol)
-{
- real fd0,fd,fd1,f,f0=0,f1=1;
- real tolmin = 1e-6;
-
- /* Since the fluidity is monotonous according to Fig. 2 in Lin2003a,
- J. Chem. Phys. 112 (2003) p. 11792 we can use a bisection method
- to get it. */
- if (tol < tolmin)
- {
- fprintf(stderr,"Unrealistic tolerance %g for calc_fluidity. Setting it to %g\n",tol,tolmin);
- tol=1e-6;
- }
-
- do {
- fd0 = FD(Delta,f0);
- fd1 = FD(Delta,f1);
- f = (f0+f1)*0.5;
- fd = FD(Delta,f);
- if (fd < 0)
- f0 = f;
- else if (fd > 0)
- f1 = f;
- else
- return f;
- } while ((f1-f0) > tol);
-
- return f;
-}
-
static real wCsolid(real nu,real beta)
{
real bhn = beta*PLANCK*nu;
y = calc_y(f,Delta,toler);
fprintf(fp,"%10g %10g %10g %10g\n",Delta,f,f*y,y);
}
- fclose(fp);
+ xvgrclose(fp);
}
static void dump_w(output_env_t oenv,real beta)
wCsolid(nu,beta),wSsolid(nu,beta),
wAsolid(nu,beta),wEsolid(nu,beta));
}
- fclose(fp);
+ xvgrclose(fp);
}
int gmx_dos(int argc,char *argv[])
tt[j] = j*dt;
fprintf(fp,"%10g %10g\n",tt[j],dos[VACF][j]);
}
- fclose(fp);
+ xvgrclose(fp);
fp = xvgropen(opt2fn("-mvacf",NFILE,fnm),"Mass-weighted velocity ACF",
"Time (ps)","C(t)",oenv);
for(j=0; (j<nframes/2); j++)
{
fprintf(fp,"%10g %10g\n",tt[j],dos[MVACF][j]);
}
- fclose(fp);
+ xvgrclose(fp);
if ((fftcode = gmx_fft_init_1d_real(&fft,nframes/2,
GMX_FFT_FLAG_NONE)) != 0)
dos[DOS_SOLID][j]/recip_fac,
dos[DOS_DIFF][j]/recip_fac);
}
- fclose(fp);
+ xvgrclose(fp);
/* Finally analyze the results! */
wCdiff = 0.5;
fprintf(fplog,"Internal energy %g kJ/mol\n",E/Nmol);
*/
fprintf(fplog,"\nArrivederci!\n");
- fclose(fplog);
+ gmx_fio_fclose(fplog);
do_view(oenv,ftp2fn(efXVG,NFILE,fnm),"-nxy");
--- /dev/null
+/*
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2009, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ */
+#include <copyrite.h>
+#include <filenm.h>
+#include <macros.h>
+#include <pbc.h>
+#include <smalloc.h>
+#include <statutil.h>
+#include <vec.h>
+#include <xvgr.h>
+#include <nbsearch.h>
+#include <trajana.h>
+#include <math.h>
+
+
+int gmx_dyecoupl(int argc, char *argv[])
+{
+ const char *desc[] =
+ {
+ "This tool extracts dye dynamics from trajectory files.",
+ "Currently, R and kappa^2 between dyes is extracted for (F)RET",
+ "simulations with assumed dipolar coupling as in the Foerster equation.",
+ "It further allows the calculation of R(t) and kappa^2(t), R and",
+ "kappa^2 histograms and averages, as well as the instantaneous FRET",
+ "efficiency E(t) for a specified Foerster radius R_0 (switch [TT]-R0[tt]).",
+ "The input dyes have to be whole (see res and mol pbc options",
+ "in [TT]trjconv[tt]).",
+ "The dye transition dipole moment has to be defined by at least",
+ "a single atom pair, however multiple atom pairs can be provided ",
+ "in the index file. The distance R is calculated on the basis of",
+ "the COMs of the given atom pairs.",
+ "The [TT]-pbcdist[tt] option calculates distances to the nearest periodic",
+ "image instead to the distance in the box. This works however only,"
+ "for periodic boundaries in all 3 dimensions.",
+ "The [TT]-norm[tt] option (area-) normalizes the histograms."
+ };
+
+ static gmx_bool bPBCdist = FALSE, bNormHist = FALSE;
+ int histbins = 50;
+ output_env_t oenv;
+ real R0=-1;
+
+ t_pargs pa[] =
+ {
+ { "-pbcdist", FALSE, etBOOL, { &bPBCdist },"Distance R based on PBC" },
+ { "-norm", FALSE, etBOOL, { &bNormHist },"Normalize histograms" },
+ { "-bins", FALSE, etINT, {&histbins},"# of histogram bins" },
+ { "-R0", FALSE, etREAL, {&R0},"Foerster radius including kappa^2=2/3 in nm" }
+ };
+#define NPA asize(pa)
+
+ t_filenm fnm[] =
+ {
+ { efTRX, "-f", NULL, ffREAD },
+ { efNDX, NULL, NULL, ffREAD },
+ { efXVG, "-ot", "rkappa",ffOPTWR },
+ { efXVG, "-oe", "insteff",ffOPTWR },
+ { efDAT, "-o", "rkappa",ffOPTWR },
+ { efXVG, "-rhist","rhist", ffOPTWR },
+ { efXVG, "-khist", "khist", ffOPTWR }
+ };
+#define NFILE asize(fnm)
+
+
+ const char *in_trajfile, *in_ndxfile, *out_xvgrkfile = NULL, *out_xvginstefffile = NULL, *out_xvgrhistfile = NULL, *out_xvgkhistfile = NULL,*out_datfile=NULL;
+ gmx_bool bHaveFirstFrame, bHaveNextFrame, indexOK = TRUE;
+ int ndon, nacc;
+ atom_id *donindex, *accindex;
+ char *grpnm;
+ t_atoms *atoms = NULL;
+ t_trxstatus *status;
+ t_trxframe fr;
+
+ int flags;
+ int allocblock = 1000;
+ real histexpand = 1e-6;
+ rvec donvec, accvec, donpos, accpos, dist, distnorm;
+ int natoms;
+
+ /*we rely on PBC autodetection (...currently)*/
+ int ePBC = -1;
+
+ real *rvalues=NULL, *kappa2values=NULL, *rhist=NULL, *khist=NULL;
+ t_pbc *pbc=NULL;
+ int i, bin;
+ FILE *rkfp = NULL, *rhfp = NULL, *khfp = NULL,*datfp=NULL,*iefp=NULL;
+ gmx_bool bRKout, bRhistout, bKhistout,bDatout,bInstEffout;
+
+ const char *rkleg[2] = { "R", "\\f{Symbol}k\\f{}\\S2\\N" };
+ const char *rhleg[1] = { "p(R)" };
+ const char *khleg[1] = { "p(\\f{Symbol}k\\f{}\\S2\\N)" };
+ const char *ieleg[1] = { "E\\sRET\\N(t)" };
+
+ real R, kappa2, insteff, Rs = 0., kappa2s = 0., insteffs=0., rmax, rmin, kmin = 0., kmax = 4.,
+ rrange, krange, rincr, kincr,Rfrac;
+ int rkcount = 0, rblocksallocated = 0, kblocksallocated = 0;
+
+ CopyRight(stderr, argv[0]);
+ parse_common_args(&argc,argv,PCA_CAN_BEGIN | PCA_CAN_END | PCA_CAN_VIEW | PCA_TIME_UNIT | PCA_BE_NICE, NFILE,fnm,NPA,pa,asize(desc),desc, 0,NULL,&oenv);
+
+
+ /* Check command line options for filenames and set bool flags when switch used*/
+ in_trajfile = opt2fn("-f", NFILE, fnm);
+ in_ndxfile = opt2fn("-n", NFILE, fnm);
+ out_xvgrkfile = opt2fn("-ot", NFILE, fnm);
+ out_xvgrhistfile = opt2fn("-rhist", NFILE, fnm);
+ out_xvgkhistfile = opt2fn("-khist", NFILE, fnm);
+ out_xvginstefffile = opt2fn("-oe", NFILE, fnm);
+ out_datfile = opt2fn("-o",NFILE,fnm);
+
+ bRKout = opt2bSet("-ot", NFILE, fnm);
+ bRhistout = opt2bSet("-rhist", NFILE, fnm);
+ bKhistout = opt2bSet("-khist", NFILE, fnm);
+ bDatout = opt2bSet("-o", NFILE, fnm);
+ bInstEffout = opt2bSet("-oe", NFILE, fnm);
+
+
+ /* PBC warning. */
+ if (bPBCdist)
+ {
+ printf("Calculating distances to periodic image.\n");
+ printf("Be careful! This produces only valid results for PBC in all three dimensions\n");
+ }
+
+
+ if (bInstEffout && R0<=0.)
+ {
+ gmx_fatal(FARGS,"You have to specify R0 and R0 has to be larger than 0 nm.\n\n");
+ }
+
+ printf("Select group with donor atom pairs defining the transition moment\n");
+ get_index(atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &ndon, &donindex,&grpnm);
+
+ printf("Select group with acceptor atom pairs defining the transition moment\n");
+ get_index(atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &nacc, &accindex,&grpnm);
+
+ printf("Reading first frame\n");
+ /* open trx file for reading */
+ flags=0;
+ flags = flags | TRX_READ_X;
+ bHaveFirstFrame = read_first_frame(oenv, &status, in_trajfile, &fr, flags);
+
+ if (bHaveFirstFrame)
+ {
+ printf("First frame is OK\n");
+ natoms = fr.natoms;
+ if ((ndon % 2 != 0) || (nacc % 2 != 0))
+ {
+ indexOK = FALSE;
+ }
+ else
+ {
+ for (i = 0; i < ndon;i++)
+ {
+ if (donindex[i] >= natoms)
+ indexOK = FALSE;
+ }
+ for (i = 0; i < nacc;i++)
+ {
+ if (accindex[i] >= natoms)
+ indexOK = FALSE;
+ }
+ }
+
+ if (indexOK)
+ {
+
+ if (bDatout)
+ {
+ datfp = fopen(out_datfile,"w");
+ }
+
+ if (bRKout)
+ {
+ rkfp = xvgropen(out_xvgrkfile,
+ "Distance and \\f{Symbol}k\\f{}\\S2\\N trajectory",
+ "Time (ps)", "Distance (nm) / \\f{Symbol}k\\f{}\\S2\\N",
+ oenv);
+ xvgr_legend(rkfp, 2, rkleg, oenv);
+ }
+
+ if (bInstEffout)
+ {
+ iefp = xvgropen(out_xvginstefffile,
+ "Instantaneous RET Efficiency",
+ "Time (ps)", "RET Efficiency",
+ oenv);
+ xvgr_legend(iefp, 1, ieleg, oenv);
+ }
+
+
+ if (bRhistout)
+ {
+ snew(rvalues, allocblock);
+ rblocksallocated += 1;
+ snew(rhist, histbins);
+ }
+
+ if (bKhistout)
+ {
+ snew(kappa2values, allocblock);
+ kblocksallocated += 1;
+ snew(khist, histbins);
+ }
+
+ do
+ {
+ clear_rvec(donvec);
+ clear_rvec(accvec);
+ clear_rvec(donpos);
+ clear_rvec(accpos);
+ for (i = 0; i < ndon / 2; i++)
+ {
+ rvec_sub(donvec, fr.x[donindex[2 * i]], donvec);
+ rvec_add(donvec, fr.x[donindex[2 * i + 1]], donvec);
+ rvec_add(donpos, fr.x[donindex[2 * i]], donpos);
+ rvec_add(donpos, fr.x[donindex[2 * i + 1]], donpos);
+ }
+
+ for (i = 0; i < nacc / 2; i++)
+ {
+ rvec_sub(accvec, fr.x[accindex[2 * i]], accvec);
+ rvec_add(accvec, fr.x[accindex[2 * i + 1]], accvec);
+ rvec_add(accpos, fr.x[accindex[2 * i]], accpos);
+ rvec_add(accpos, fr.x[accindex[2 * i + 1]], accpos);
+ }
+
+ unitv(donvec, donvec);
+ unitv(accvec, accvec);
+
+ svmul((real) 1. / ndon, donpos, donpos);
+ svmul((real) 1. / nacc, accpos, accpos);
+
+ if (bPBCdist)
+ {
+ set_pbc(pbc, ePBC, fr.box);
+ pbc_dx(pbc, donpos, accpos, dist);
+ }
+ else
+ {
+ rvec_sub(donpos, accpos, dist);
+ }
+
+ unitv(dist, distnorm);
+ R = norm(dist);
+ kappa2 = iprod(donvec, accvec)- 3.* (iprod(donvec, distnorm) * iprod(distnorm, accvec));
+ kappa2 *= kappa2;
+ if (R0>0)
+ {
+ Rfrac=R/R0;
+ insteff=1/(1+(Rfrac*Rfrac*Rfrac*Rfrac*Rfrac*Rfrac)*2/3/kappa2);
+ insteffs+=insteff;
+
+ if (bInstEffout)
+ {
+ fprintf(iefp, "%12.7f %12.7f\n", fr.time, insteff);
+ }
+ }
+
+
+ Rs += R;
+ kappa2s += kappa2;
+ rkcount++;
+
+ if (bRKout)
+ fprintf(rkfp, "%12.7f %12.7f %12.7f\n", fr.time, R, kappa2);
+
+ if (bDatout)
+ fprintf(datfp, "%12.7f %12.7f %12.7f\n", fr.time, R, kappa2);
+
+ if (bRhistout)
+ {
+ rvalues[rkcount-1] = R;
+ if (rkcount % allocblock == 0)
+ {
+ srenew(rvalues, allocblock*(rblocksallocated+1));
+ rblocksallocated += 1;
+ }
+ }
+
+ if (bKhistout)
+ {
+ kappa2values[rkcount-1] = kappa2;
+ if (rkcount % allocblock == 0)
+ {
+ srenew(kappa2values, allocblock*(kblocksallocated+1));
+ kblocksallocated += 1;
+ }
+ }
+
+ bHaveNextFrame = read_next_frame(oenv, status, &fr);
+ } while (bHaveNextFrame);
+
+ if (bRKout)
+ ffclose(rkfp);
+
+ if (bDatout)
+ ffclose(datfp);
+
+ if (bInstEffout)
+ ffclose(iefp);
+
+
+ if (bRhistout)
+ {
+ printf("Writing R-Histogram\n");
+ rmin = rvalues[0];
+ rmax = rvalues[0];
+ for (i = 1; i < rkcount; i++)
+ {
+ if (rvalues[i] < rmin)
+ rmin = rvalues[i];
+ else if (rvalues[i] > rmax)
+ rmax = rvalues[i];
+ }
+ rmin -= histexpand;
+ rmax += histexpand;
+
+ rrange = rmax - rmin;
+ rincr = rrange / histbins;
+
+ for (i = 1; i < rkcount; i++)
+ {
+ bin = (int) ((rvalues[i] - rmin) / rincr);
+ rhist[bin] += 1;
+ }
+ if (bNormHist)
+ {
+ for (i = 0; i < histbins; i++)
+ rhist[i] /= rkcount * rrange/histbins;
+ rhfp = xvgropen(out_xvgrhistfile, "Distance Distribution",
+ "R (nm)", "Normalized Probability", oenv);
+ } else
+ {
+ rhfp = xvgropen(out_xvgrhistfile, "Distance Distribution",
+ "R (nm)", "Probability", oenv);
+ }
+ xvgr_legend(rhfp, 1, rhleg, oenv);
+ for (i = 0; i < histbins; i++)
+ {
+ fprintf(rhfp, "%12.7f %12.7f\n", (i + 0.5) * rincr + rmin,
+ rhist[i]);
+ }
+ ffclose(rhfp);
+ }
+
+ if (bKhistout)
+ {
+ printf("Writing kappa^2-Histogram\n");
+ krange = kmax - kmin;
+ kincr = krange / histbins;
+
+ for (i = 1; i < rkcount; i++)
+ {
+ bin = (int) ((kappa2values[i] - kmin) / kincr);
+ khist[bin] += 1;
+ }
+ if (bNormHist)
+ {
+ for (i = 0; i < histbins; i++)
+ khist[i] /= rkcount * krange/histbins;
+ khfp = xvgropen(out_xvgkhistfile,
+ "\\f{Symbol}k\\f{}\\S2\\N Distribution",
+ "\\f{Symbol}k\\f{}\\S2\\N",
+ "Normalized Probability", oenv);
+ } else
+ {
+ khfp = xvgropen(out_xvgkhistfile,
+ "\\f{Symbol}k\\f{}\\S2\\N Distribution",
+ "\\f{Symbol}k\\f{}\\S2\\N", "Probability", oenv);
+ }
+ xvgr_legend(khfp, 1, khleg, oenv);
+ for (i = 0; i < histbins; i++)
+ {
+ fprintf(khfp, "%12.7f %12.7f\n", (i + 0.5) * kincr + kmin,
+ khist[i]);
+ }
+ ffclose(khfp);
+ }
+
+ printf("\nAverages:\n");
+ printf("R_avg = %8.4f nm\nKappa^2 = %8.4f\n", Rs / rkcount,
+ kappa2s / rkcount);
+ if (R0>0)
+ {
+ printf("E_RETavg = %8.4f\n", insteffs / rkcount);
+ }
+ please_cite(stdout,"Hoefling2011");
+ }
+ else
+ {
+ gmx_fatal(FARGS,"Index file invalid, check your index file for correct pairs.\n");
+ }
+ }
+ else
+ {
+ gmx_fatal(FARGS,"Could not read first frame of the trajectory.\n");
+ }
+
+ thanx(stderr);
+ return 0;
+}
+
int nsatm;
t_simat sat[3];
} t_simlist;
-static const char *pdbtp[epdbNR] =
- { "ATOM ", "HETATM" };
real calc_mass(t_atoms *atoms, gmx_bool bGetMass, gmx_atomprop_t aps)
{
return set;
}
-static gmx_bool same_time(real t1,real t2)
-{
- const real tol=1e-5;
-
- return (fabs(t1-t2) < tol);
-}
-
-
-gmx_bool bRgt(double a,double b)
-{
- double tol = 1e-6;
-
- if ( a > (b - tol*(a+b)) )
- return TRUE;
- else
- return FALSE;
-}
-
static void sort_files(char **fnms,real *settime,int nfile)
{
int i,j,minidx;
}
}
-
-static void remove_last_eeframe(t_energy *lastee, gmx_large_int_t laststep,
- t_energy *ee, int nre)
-{
- int i;
- gmx_large_int_t p=laststep+1;
- double sigmacorr;
-
- for(i=0;i<nre;i++) {
- lastee[i].esum-=ee[i].e;
- sigmacorr=lastee[i].esum-(p-1)*ee[i].e;
- lastee[i].eav-=(sigmacorr*sigmacorr)/((p-1)*p);
- }
-}
-
-
-
static void update_ee(t_energy *lastee,gmx_large_int_t laststep,
t_energy *startee,gmx_large_int_t startstep,
t_energy *ee, int step,
}
}
-
-static void update_last_ee(t_energy *lastee, gmx_large_int_t laststep,
- t_energy *ee,gmx_large_int_t step,int nre)
-{
- t_energy *tmp;
- snew(tmp,nre);
- update_ee(lastee,laststep,NULL,0,ee,step,tmp,nre);
- copy_ee(tmp,lastee,nre);
- sfree(tmp);
-}
-
static void update_ee_sum(int nre,
gmx_large_int_t *ee_sum_step,
gmx_large_int_t *ee_sum_nsteps,
}
emid = 0.0;/*(emin+emax)*0.5;*/
- for(m=0; (m<egNR); m++)
- egrp_nm[m]=egrp_nm[m];
egrp_nm[egTotal]="total";
for (m=0; (m<egNR+egSP); m++)
if (egrp_use[m]) {
return set;
}
-static int strcount(const char *s1,const char *s2)
-{
- int n=0;
- while (s1 && s2 && (toupper(s1[n]) == toupper(s2[n])))
- n++;
- return n;
-}
-
static void chomp(char *buf)
{
int len = strlen(buf);
#include "confio.h"
#include "copyrite.h"
#include "txtdump.h"
-#include "math.h"
+#include <math.h>
#include "macros.h"
#include "random.h"
#include "futil.h"
#include <math.h>
#include "sysstuff.h"
#include "statutil.h"
-#include "string.h"
+#include <string.h>
#include "copyrite.h"
#include "smalloc.h"
#include "typedefs.h"
#include <math.h>
#include "sysstuff.h"
-#include "string.h"
+#include <string.h>
#include "typedefs.h"
#include "smalloc.h"
#include "macros.h"
inc_nhbonds(&(hb->d),d,h);
}
-/* Now a redundant function. It might find use at some point though. */
-static gmx_bool in_list(atom_id selection,int isize,atom_id *index)
-{
- int i;
- gmx_bool bFound;
-
- bFound=FALSE;
- for(i=0; (i<isize) && !bFound; i++)
- if(selection == index[i])
- bFound=TRUE;
-
- return bFound;
-}
-
static char *mkatomname(t_atoms *atoms,int i)
{
static char buf[32];
return grid;
}
-static void control_pHist(t_hbdata *hb, int nframes)
-{
- int i,j,k;
- PSTYPE p;
- for (i=0;i<hb->d.nrd;i++)
- for (j=0;j<hb->a.nra;j++)
- if (hb->per->pHist[i][j].len != 0)
- for (k=hb->hbmap[i][j][0].n0; k<nframes; k++) {
- p = getPshift(hb->per->pHist[i][j], k);
- if (p>hb->per->nper)
- fprintf(stderr, "Weird stuff in pHist[%i][%i].p at frame %i: p=%i\n",
- i,j,k,p);
- }
-}
-
static void reset_nhbonds(t_donors *ddd)
{
int i,j;
* This could be implemented slightly more efficient, but the code
* would get much more complicated.
*/
-#define B(n,x,bTric,bEdge) ((n==1) ? x : bTric&&(bEdge) ? 0 : (x-1))
-#define E(n,x,bTric,bEdge) ((n==1) ? x : bTric&&(bEdge) ? n-1 : (x+1))
-#define GRIDMOD(j,n) (j+n)%(n)
-#define LOOPGRIDINNER(x,y,z,xx,yy,zz,xo,yo,zo,n,bTric) \
- for(zz=B(n[ZZ],zo,bTric,FALSE); zz<=E(n[ZZ],zo,bTric,FALSE); zz++) { \
- z=GRIDMOD(zz,n[ZZ]); \
- for(yy=B(n[YY],yo,bTric,z==0||z==n[ZZ]-1); \
- yy<=E(n[YY],yo,bTric,z==0||z==n[ZZ]-1); yy++) { \
- y=GRIDMOD(yy,n[YY]); \
- for(xx=B(n[XX],xo,bTric,y==0||y==n[YY]-1||z==0||z==n[ZZ]-1); \
- xx<=E(n[XX],xo,bTric,y==0||y==n[YY]-1||z==0||z==n[ZZ]-1); xx++) { \
- x=GRIDMOD(xx,n[XX]);
-#define ENDLOOPGRIDINNER \
- } \
- } \
- } \
- \
+static inline gmx_bool grid_loop_begin(int n, int x, gmx_bool bTric, gmx_bool bEdge)
+{
+ return ((n==1) ? x : bTric && bEdge ? 0 : (x-1));
+}
+static inline gmx_bool grid_loop_end(int n, int x, gmx_bool bTric, gmx_bool bEdge)
+{
+ return ((n==1) ? x : bTric && bEdge ? (n-1) : (x+1));
+}
+static inline int grid_mod(int j, int n)
+{
+ return (j+n) % (n);
+}
static void dump_grid(FILE *fp, ivec ngrid, t_gridcell ***grid)
{
g=NULL;
}
-static void pbc_correct(rvec dx,matrix box,rvec hbox)
-{
- int m;
- for(m=DIM-1; m>=0; m--) {
- if ( dx[m] < -hbox[m] )
- rvec_inc(dx,box[m]);
- else if ( dx[m] >= hbox[m] )
- rvec_dec(dx,box[m]);
- }
-}
-
void pbc_correct_gem(rvec dx,matrix box,rvec hbox)
{
int m;
if (bDA || (!bDA && (rha2 <= rc2))) {
rvec_sub(x[d],x[hh],r_dh);
if (bBox) {
- if (hb->bGem)
- pbc_correct_gem(r_dh,box,hbox);
- else
- pbc_correct_gem(r_dh,box,hbox);
+ pbc_correct_gem(r_dh,box,hbox);
}
if (!bDA)
hb->time[j]-hb->time[0],
ct[j],
ctdouble[j]);
- fclose(fp);
+ xvgrclose(fp);
sfree(ct);
sfree(ctdouble);
sfree(timedouble);
fprintf(fp," %10g", fittedct[j]);
fprintf(fp,"\n");
}
- fclose(fp);
+ xvgrclose(fp);
sfree(ctdouble);
sfree(timedouble);
fp = opt2FILE("-hbn",nfile,fnm,"w");
if (opt2bSet("-g",nfile,fnm)) {
fplog = ffopen(opt2fn("-g",nfile,fnm),"w");
- if (bContact)
- fprintf(fplog,"# %10s %12s %12s\n","Donor","Hydrogen","Acceptor");
- else
- fprintf(fplog,"# %10s %12s %12s\n","Donor","Hydrogen","Acceptor");
+ fprintf(fplog,"# %10s %12s %12s\n","Donor","Hydrogen","Acceptor");
}
else
fplog = NULL;
int threadNr=0;
gmx_bool bGem, bNN, bParallel;
t_gemParams *params=NULL;
+ gmx_bool bEdge_yjj, bEdge_xjj;
CopyRight(stdout,argv[0]);
i = icell->atoms[ai];
/* loop over all adjacent gridcells (xj,yj,zj) */
- /* This is a macro!!! */
- LOOPGRIDINNER(xj,yj,zj,xjj,yjj,zjj,xi,yi,zi,ngrid,bTric) {
- jcell=&(grid[zj][yj][xj].a[ogrp]);
- /* loop over acceptor atoms from other group (ogrp)
- * in this adjacent gridcell (jcell)
- */
- for (aj=0; (aj<jcell->nr); aj++) {
- j = jcell->atoms[aj];
-
- /* check if this once was a h-bond */
- peri = -1;
- ihb = is_hbond(__HBDATA,grp,ogrp,i,j,rcut,r2cut,ccut,x,bBox,box,
- hbox,&dist,&ang,bDA,&h,bContact,bMerge,&peri);
-
- if (ihb) {
- /* add to index if not already there */
- /* Add a hbond */
- add_hbond(__HBDATA,i,j,h,grp,ogrp,nframes,bMerge,ihb,bContact,peri);
-
- /* make angle and distance distributions */
- if (ihb == hbHB && !bContact) {
- if (dist>rcut)
- gmx_fatal(FARGS,"distance is higher than what is allowed for an hbond: %f",dist);
- ang*=RAD2DEG;
- __ADIST[(int)( ang/abin)]++;
- __RDIST[(int)(dist/rbin)]++;
- if (!bTwo) {
- int id,ia;
- if ((id = donor_index(&hb->d,grp,i)) == NOTSET)
- gmx_fatal(FARGS,"Invalid donor %d",i);
- if ((ia = acceptor_index(&hb->a,ogrp,j)) == NOTSET)
- gmx_fatal(FARGS,"Invalid acceptor %d",j);
- resdist=abs(top.atoms.atom[i].resind-
- top.atoms.atom[j].resind);
- if (resdist >= max_hx)
- resdist = max_hx-1;
- __HBDATA->nhx[nframes][resdist]++;
+ for(zjj = grid_loop_begin(ngrid[ZZ],zi,bTric,FALSE);
+ zjj <= grid_loop_end(ngrid[ZZ],zi,bTric,FALSE);
+ zjj++)
+ {
+ zj = grid_mod(zjj,ngrid[ZZ]);
+ bEdge_yjj = (zj == 0) || (zj == ngrid[ZZ] - 1);
+ for(yjj = grid_loop_begin(ngrid[YY],yi,bTric,bEdge_yjj);
+ yjj <= grid_loop_end(ngrid[YY],yi,bTric,bEdge_yjj);
+ yjj++)
+ {
+ yj = grid_mod(yjj,ngrid[YY]);
+ bEdge_xjj =
+ (yj == 0) || (yj == ngrid[YY] - 1) ||
+ (zj == 0) || (zj == ngrid[ZZ] - 1);
+ for(xjj = grid_loop_begin(ngrid[XX],xi,bTric,bEdge_xjj);
+ xjj <= grid_loop_end(ngrid[XX],xi,bTric,bEdge_xjj);
+ xjj++)
+ {
+ xj = grid_mod(xjj,ngrid[XX]);
+ jcell=&(grid[zj][yj][xj].a[ogrp]);
+ /* loop over acceptor atoms from other group (ogrp)
+ * in this adjacent gridcell (jcell)
+ */
+ for (aj=0; (aj<jcell->nr); aj++) {
+ j = jcell->atoms[aj];
+
+ /* check if this once was a h-bond */
+ peri = -1;
+ ihb = is_hbond(__HBDATA,grp,ogrp,i,j,rcut,r2cut,ccut,x,bBox,box,
+ hbox,&dist,&ang,bDA,&h,bContact,bMerge,&peri);
+
+ if (ihb) {
+ /* add to index if not already there */
+ /* Add a hbond */
+ add_hbond(__HBDATA,i,j,h,grp,ogrp,nframes,bMerge,ihb,bContact,peri);
+
+ /* make angle and distance distributions */
+ if (ihb == hbHB && !bContact) {
+ if (dist>rcut)
+ gmx_fatal(FARGS,"distance is higher than what is allowed for an hbond: %f",dist);
+ ang*=RAD2DEG;
+ __ADIST[(int)( ang/abin)]++;
+ __RDIST[(int)(dist/rbin)]++;
+ if (!bTwo) {
+ int id,ia;
+ if ((id = donor_index(&hb->d,grp,i)) == NOTSET)
+ gmx_fatal(FARGS,"Invalid donor %d",i);
+ if ((ia = acceptor_index(&hb->a,ogrp,j)) == NOTSET)
+ gmx_fatal(FARGS,"Invalid acceptor %d",j);
+ resdist=abs(top.atoms.atom[i].resind-
+ top.atoms.atom[j].resind);
+ if (resdist >= max_hx)
+ resdist = max_hx-1;
+ __HBDATA->nhx[nframes][resdist]++;
+ }
+ }
+
}
- }
-
- }
- } /* for aj */
- }
- ENDLOOPGRIDINNER;
+ } /* for aj */
+ } /* for xjj */
+ } /* for yjj */
+ } /* for zjj */
} /* for ai */
} /* for grp */
} /* for xi,yi,zi */
#include "index.h"
#include "smalloc.h"
#include "statutil.h"
-#include "string.h"
+#include <string.h>
#include "sysstuff.h"
#include "txtdump.h"
#include "typedefs.h"
#include "xvgr.h"
#include "gmx_ana.h"
-
-void dump_ahx(int nres,
- t_bb bb[],rvec x[],matrix box,int teller)
-{
- FILE *fp;
- char buf[256];
- int i;
-
- sprintf(buf,"dump%d.gro",teller);
- fp=ffopen(buf,"w");
- fprintf(fp,"Dumping fitted helix frame %d\n",teller);
- fprintf(fp,"%5d\n",nres*5);
- for(i=0; (i<nres); i++) {
-#define PR(AA) fprintf(fp,"%5d%5s%5s%5d%8.3f%8.3f%8.3f\n",i+1,"GLY",#AA,bb[i].AA,x[bb[i].AA][XX],x[bb[i].AA][YY],x[bb[i].AA][ZZ]); fflush(fp)
- if (bb[i].bHelix) {
- PR(N);
- PR(H);
- PR(CA);
- PR(C);
- PR(O);
- }
- }
- for(i=0; (i<DIM); i++)
- fprintf(fp,"%10.5f",box[i][i]);
- fprintf(fp,"\n");
- ffclose(fp);
-}
-
void dump_otrj(FILE *otrj,int natoms,atom_id all_index[],rvec x[],
real fac,rvec xav[])
{
#include "smalloc.h"
#include "macros.h"
-#include "math.h"
+#include <math.h>
#include "xvgr.h"
#include "copyrite.h"
#include "statutil.h"
#include <ctype.h>
#include "sysstuff.h"
-#include "string.h"
+#include <string.h>
#include "typedefs.h"
#include "statutil.h"
#include "smalloc.h"
}
}
}
- fclose(fpsg);
- fclose(fpsk);
+ xvgrclose(fpsg);
+ xvgrclose(fpsk);
}
#include <config.h>
#endif
+#ifdef __linux
+#define _GNU_SOURCE
+#include <sched.h>
+#include <sys/syscall.h>
+#endif
#include <signal.h>
#include <stdlib.h>
+
#include "typedefs.h"
#include "smalloc.h"
#include "sysstuff.h"
#ifdef GMX_LIB_MPI
#include <mpi.h>
#endif
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#include "tmpi.h"
#endif
+#ifdef GMX_OPENMP
+#include <omp.h>
+#endif
+
/* afm stuf */
#include "pull.h"
return fver;
}
-void set_inbox(int natom, rvec *x)
-{
- rvec tmp;
- int i;
-
- tmp[XX]=tmp[YY]=tmp[ZZ]=0.0;
- for(i=0;i<natom;i++)
- {
- if(x[i][XX]<tmp[XX]) tmp[XX]=x[i][XX];
- if(x[i][YY]<tmp[YY]) tmp[YY]=x[i][YY];
- if(x[i][ZZ]<tmp[ZZ]) tmp[ZZ]=x[i][ZZ];
- }
-
- for(i=0;i<natom;i++)
- rvec_inc(x[i],tmp);
-}
-
int get_mtype_list(t_block *at, gmx_mtop_t *mtop, t_block *tlist)
{
int i,j,nr,mol_id;
return area;
}
-void init_lip(matrix box, gmx_mtop_t *mtop, lip_t *lip)
-{
- int i;
- real mem_area;
- int mol1=0;
-
- mem_area = box[XX][XX]*box[YY][YY]-box[XX][YY]*box[YY][XX];
- for(i=0;i<mtop->nmolblock;i++)
- {
- if(mtop->molblock[i].type == lip->id)
- {
- lip->nr=mtop->molblock[i].nmol;
- lip->natoms=mtop->molblock[i].natoms_mol;
- }
- }
- lip->area=2.0*mem_area/(double)lip->nr;
-
- for (i=0;i<lip->id;i++)
- mol1+=mtop->molblock[i].nmol;
- lip->mol1=mol1;
-}
-
int init_mem_at(mem_t *mem_p, gmx_mtop_t *mtop, rvec *r, matrix box, pos_ins_t *pos_ins)
{
int i,j,at,mol,nmol,nmolbox,count;
}
}
- fclose(fpout);
+ ffclose(fpout);
+ ffclose(fpin);
/* use ffopen to generate backup of topinout */
fpout=ffopen(topfile,"w");
- fclose(fpout);
+ ffclose(fpout);
rename(TEMP_FILENM,topfile);
#undef TEMP_FILENM
}
/* if (DEFORM(*ir))
{
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_lock(&deform_init_box_mutex);
#endif
set_deform_reference_box(upd,
deform_init_init_step_tpx,
deform_init_box_tpx);
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
tMPI_Thread_mutex_unlock(&deform_init_box_mutex);
#endif
}*/
/* Check whether everything is still allright */
if (((int)gmx_get_stop_condition() > handled_stop_condition)
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
&& MASTER(cr)
#endif
)
gmx_edsam_t ed=NULL;
t_commrec *cr_old=cr;
int nthreads=1,nthreads_requested=1;
-
+ int omp_nthreads = 1;
char *ins;
int rm_bonded_at,fr_id,fr_i=0,tmp_id,warn=0;
read_tpx_state(ftp2fn(efTPX,nfile,fnm),inputrec,state,NULL,mtop);
/* NOW the threads will be started: */
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
#endif
}
/* END OF CAUTION: cr is now reliable */
gmx_setup_nodecomm(fplog,cr);
}
- wcycle = wallcycle_init(fplog,resetstep,cr);
+ /* get number of OpenMP/PME threads
+ * env variable should be read only on one node to make sure it is identical everywhere */
+#ifdef GMX_OPENMP
+ if (EEL_PME(inputrec->coulombtype))
+ {
+ if (MASTER(cr))
+ {
+ char *ptr;
+ omp_nthreads = omp_get_max_threads();
+ if ((ptr=getenv("GMX_PME_NTHREADS")) != NULL)
+ {
+ sscanf(ptr,"%d",&omp_nthreads);
+ }
+ if (fplog!=NULL)
+ {
+ fprintf(fplog,"Using %d threads for PME\n",omp_nthreads);
+ }
+ }
+ if (PAR(cr))
+ {
+ gmx_bcast_sim(sizeof(omp_nthreads),&omp_nthreads,cr);
+ }
+ }
+#endif
+
+ wcycle = wallcycle_init(fplog,resetstep,cr, omp_nthreads);
if (PAR(cr))
{
/* Master synchronizes its value of reset_counters with all nodes
fr = mk_forcerec();
init_forcerec(fplog,oenv,fr,fcd,inputrec,mtop,cr,box,FALSE,
opt2fn("-table",nfile,fnm),
+ opt2fn("-tabletf",nfile,fnm),
opt2fn("-tablep",nfile,fnm),
opt2fn("-tableb",nfile,fnm),FALSE,pforce);
/* version for PCA_NOT_READ_NODE (see md.c) */
/*init_forcerec(fplog,fr,fcd,inputrec,mtop,cr,box,FALSE,
- "nofile","nofile","nofile",FALSE,pforce);
+ "nofile","nofile","nofile","nofile",FALSE,pforce);
*/
fr->bSepDVDL = ((Flags & MD_SEPPOT) == MD_SEPPOT);
/* The PME only nodes need to know nChargePerturbed */
gmx_bcast_sim(sizeof(nChargePerturbed),&nChargePerturbed,cr);
}
+
+
+ /*set CPU affinity*/
+#ifdef GMX_OPENMP
+#ifdef __linux
+#ifdef GMX_LIB_MPI
+ {
+ int core;
+ MPI_Comm comm_intra; /*intra communicator (but different to nc.comm_intra includes PME nodes)*/
+ MPI_Comm_split(MPI_COMM_WORLD,gmx_hostname_num(),gmx_node_rank(),&comm_intra);
+ int local_omp_nthreads = (cr->duty & DUTY_PME) ? omp_nthreads : 1; /*threads on this node*/
+ MPI_Scan(&local_omp_nthreads,&core, 1, MPI_INT, MPI_SUM, comm_intra);
+ core-=local_omp_nthreads; /*make exclusive scan*/
+ #pragma omp parallel firstprivate(core) num_threads(local_omp_nthreads)
+ {
+ cpu_set_t mask;
+ CPU_ZERO(&mask);
+ core+=omp_get_thread_num();
+ CPU_SET(core,&mask);
+ sched_setaffinity((pid_t) syscall (SYS_gettid),sizeof(cpu_set_t),&mask);
+ }
+ }
+#endif /*GMX_MPI*/
+#endif /*__linux*/
+#endif /*GMX_OPENMP*/
+
if (cr->duty & DUTY_PME)
{
status = gmx_pme_init(pmedata,cr,npme_major,npme_minor,inputrec,
mtop ? mtop->natoms : 0,nChargePerturbed,
- (Flags & MD_REPRODUCIBLE));
+ (Flags & MD_REPRODUCIBLE),omp_nthreads);
if (status != 0)
{
gmx_fatal(FARGS,"Error %d initializing PME",status);
dd_node_order = nenum(ddno_opt);
cr->npmenodes = npme;
-#ifdef GMX_THREADS
+#ifdef GMX_THREAD_MPI
/* now determine the number of threads automatically. The threads are
only started at mdrunner_threads, though. */
if (nthreads<1)
gmx_fatal(FARGS,"Need at least two replicas for replica exchange (option -multi)");
if (nmultisim > 1) {
-#ifndef GMX_THREADS
+#ifndef GMX_THREAD_MPI
gmx_bool bParFn = (multidir == NULL);
init_multisystem(cr,nmultisim,multidir,NFILE,fnm,TRUE);
#else
#include <stdlib.h>
#include "sysstuff.h"
-#include "string.h"
+#include <string.h>
#include "typedefs.h"
#include "smalloc.h"
#include "macros.h"
return curr;
}
-static void done_corr(t_corr *curr)
-{
- int i;
-
- sfree(curr->n_offs);
- for(i=0; (i<curr->nrestart); i++)
- sfree(curr->x0[i]);
- sfree(curr->x0);
-}
-
static void corr_print(t_corr *curr,gmx_bool bTen,const char *fn,const char *title,
const char *yaxis,
real msdtime,real beginfit,real endfit,
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <math.h>
-
-#include "statutil.h"
-#include "macros.h"
-#include "tpxio.h"
-#include "smalloc.h"
-#include "physics.h"
-#include "vec.h"
-#include "gstat.h"
-#include "nrjac.h"
-#include "copyrite.h"
-#include "index.h"
-#include "gmx_ana.h"
-
-
-#define NM2ANG 10
-#define TOLERANCE 1.0E-8
-
-#define e2d(x) ENM2DEBYE*(x)
-#define delta(a,b) (( a == b ) ? 1.0 : 0.0)
-
-#define NDIM 3 /* We will be using a numerical recipes routine */
-
-static char dim[DIM+1] = "XYZ";
-
-typedef real tensor3[DIM][DIM][DIM]; /* 3 rank tensor */
-typedef real tensor4[DIM][DIM][DIM][DIM]; /* 4 rank tensor */
-
-
-void pr_coord(int k0,int k1,atom_id index[],rvec x[],char *msg)
-{
- int k,kk;
-
- fprintf(stdout,"Coordinates in nm (%s)\n",msg);
- for(k=k0; (k<k1); k++) {
- kk=index[k];
- fprintf(stdout,"Atom %d, %15.10f %15.10f %15.10f\n",
- kk,x[kk][XX],x[kk][YY],x[kk][ZZ]);
- }
- fprintf(stdout,"\n");
-}
-
-static void clear_tensor3(tensor3 a)
-{
- int i,j,k;
- const real nul=0.0;
-
- for(i=0; (i<DIM); i++)
- for(j=0; (j<DIM); j++)
- for(k=0; (k<DIM); k++)
- a[i][j][k]=nul;
-}
-
-static void clear_tensor4(tensor4 a)
-{
- int i,j,k,l;
- const real nul=0.0;
-
- for(i=0; (i<DIM); i++)
- for(j=0; (j<DIM); j++)
- for(k=0; (k<DIM); k++)
- for(l=0; (l<DIM); l++)
- a[i][j][k][l]=nul;
-}
-
-void rotate_mol(int k0,int k1,atom_id index[],rvec x[],matrix trans)
-{
- real xt,yt,zt;
- int k,kk;
-
- for(k=k0; (k<k1); k++) {
- kk=index[k];
- xt=x[kk][XX];
- yt=x[kk][YY];
- zt=x[kk][ZZ];
- x[kk][XX]=trans[XX][XX]*xt+trans[XX][YY]*yt+trans[XX][ZZ]*zt;
- x[kk][YY]=trans[YY][XX]*xt+trans[YY][YY]*yt+trans[YY][ZZ]*zt;
- x[kk][ZZ]=trans[ZZ][XX]*xt+trans[ZZ][YY]*yt+trans[ZZ][ZZ]*zt;
- }
-}
-
-/* the following routines are heavily inspired by the Gaussian 94 source
- * code
- */
-
-/*
- Make the rotation matrix for angle Theta counterclockwise about
- axis IXYZ.
-*/
-
-void make_rot_mat(int axis,real theta,matrix t_mat){
-
- ivec i;
- real s,c;
-
-
- i[XX]=axis + 1;
- i[YY]=1 + i[XX] % 3;
- i[ZZ]=1 + i[YY] % 3;
-
- i[XX]-=1;
- i[YY]-=1;
- i[ZZ]-=1;
-
- s=sin(theta);
- c=cos(theta);
- t_mat[i[XX]][i[XX]]=1.0;
- t_mat[i[XX]][i[YY]]=0.0;
- t_mat[i[XX]][i[ZZ]]=0.0;
- t_mat[i[YY]][i[XX]]=0.0;
- t_mat[i[YY]][i[YY]]=c;
- t_mat[i[YY]][i[ZZ]]=s;
- t_mat[i[ZZ]][i[XX]]=0.0;
- t_mat[i[ZZ]][i[YY]]=-s;
- t_mat[i[ZZ]][i[ZZ]]=c;
-}
-
-gmx_bool test_linear_mol(rvec d)
-{
- /* d is sorted in descending order */
- if ( (d[ZZ] < TOLERANCE) && (d[XX]-d[YY]) < TOLERANCE ) {
- return TRUE;
- } else
- return FALSE;
-}
-
-/* Returns the third moment of charge along an axis */
-real test_qmom3(int k0,int k1,atom_id index[],t_atom atom[],rvec x[],int axis){
-
- int k,kk;
- real xcq,q;
-
- xcq=0.0;
- for(k=k0; (k<k1); k++) {
- kk=index[k];
- q=fabs(atom[kk].q);
- xcq+=q*x[kk][axis]*x[kk][axis]*x[kk][axis];
- }
-
- return xcq;
-}
-
-/* Returns the second moment of mass along an axis */
-real test_mmom2(int k0,int k1,atom_id index[],t_atom atom[],rvec x[],int axis){
-
- int k,kk;
- real xcm,m;
-
- xcm=0.0;
- for(k=k0; (k<k1); k++) {
- kk=index[k];
- m=atom[kk].m;
- xcm+=m*x[kk][axis]*x[kk][axis];
- }
-
- return xcm;
-}
-
-real calc_xcm_mol(int k0,int k1,atom_id index[],t_atom atom[],rvec x[],
- rvec xcm)
-{
- int k,kk,m;
- real m0,tm;
-
- /* Compute the center of mass */
- clear_rvec(xcm);
- tm=0.0;
- for(k=k0; (k<k1); k++) {
- kk=index[k];
- m0=atom[kk].m;
- tm+=m0;
- for(m=0; (m<DIM); m++)
- xcm[m]+=m0*x[kk][m];
- }
- for(m=0; (m<DIM); m++)
- xcm[m]/=tm;
-
- /* And make it the origin */
- for(k=k0; (k<k1); k++) {
- kk=index[k];
- rvec_dec(x[kk],xcm);
- }
-
- return tm;
-}
-
-/* Retruns the center of charge */
-real calc_xcq_mol(int k0,int k1,atom_id index[],t_atom atom[],rvec x[],
- rvec xcq)
-{
- int k,kk,m;
- real q0,tq;
-
- clear_rvec(xcq);
- tq=0.0;
- for(k=k0; (k<k1); k++) {
- kk=index[k];
- q0=fabs(atom[kk].q);
- tq+=q0;
- fprintf(stdout,"tq: %f, q0: %f\n",tq,q0);
- for(m=0; (m<DIM); m++)
- xcq[m]+=q0*x[kk][m];
- }
-
- for(m=0; (m<DIM); m++)
- xcq[m]/=tq;
- /*
- for(k=k0; (k<k1); k++) {
- kk=index[k];
- rvec_dec(x[kk],xcq);
- }
- */
- return tq;
-}
-
-/* Returns in m1 the dipole moment */
-void mol_M1(int n0,int n1,atom_id ma[],rvec x[],t_atom atom[],rvec m1)
-{
- int m,n,nn;
- real q;
-
- clear_rvec(m1);
- for(n=n0; (n<n1); n++) {
- nn = ma[n];
- q = e2d(atom[nn].q);
- for(m=0; (m<DIM); m++)
- m1[m] += q*x[nn][m];
- }
-}
-
-/* returns in m2 the quadrupole moment */
-void mol_M2(int n0,int n1,atom_id ma[],rvec x[],t_atom atom[],tensor m2)
-{
- int n,nn,i,j;
- real q,r2;
-
- clear_mat(m2);
- for(n=n0; (n<n1); n++) {
- nn = ma[n];
- q = e2d(atom[nn].q);
- r2 = norm2(x[nn]);
- for(i=0; (i<DIM); i++)
- for(j=0; (j<DIM); j++)
- m2[i][j] += 0.5*q*(3.0*x[nn][i]*x[nn][j] - r2*delta(i,j))*NM2ANG;
- }
-}
-
-/* Returns in m3 the octopole moment */
-void mol_M3(int n0,int n1,atom_id ma[],rvec x[],t_atom atom[],tensor3 m3)
-{
- int i,j,k,n,nn;
- real q,r2;
-
- clear_tensor3(m3);
- for(n=n0; (n<n1); n++) {
- nn = ma[n];
- q = e2d(atom[nn].q);
- r2 = norm2(x[nn]);
- for(i=0; (i<DIM); i++)
- for(j=0; (j<DIM); j++)
- for(k=0; (k<DIM); k++)
- m3[i][j][k] +=
- 0.5*q*(5.0*x[nn][i]*x[nn][j]*x[nn][k]
- - r2*(x[nn][i]*delta(j,k) +
- x[nn][j]*delta(k,i) +
- x[nn][k]*delta(i,j)))*NM2ANG*NM2ANG;
- }
-}
-
-/* Returns in m4 the hexadecapole moment */
-void mol_M4(int n0,int n1,atom_id ma[],rvec x[],t_atom atom[],tensor4 m4)
-{
- int i,j,k,l,n,nn;
- real q,r2;
-
- clear_tensor4(m4);
- for(n=n0; (n<n1); n++) {
- nn = ma[n];
- q = e2d(atom[nn].q);
- r2 = norm2(x[nn]);
- for(i=0; (i<DIM); i++)
- for(j=0; (j<DIM); j++)
- for(k=0; (k<DIM); k++)
- for(l=0; (l<DIM); l++)
- m4[i][j][k][l] +=
- 0.125*q*(35.0*x[nn][i]*x[nn][j]*x[nn][k]*x[nn][l]
- - 5.0*r2*(x[nn][i]*x[nn][j]*delta(k,l) +
- x[nn][i]*x[nn][k]*delta(j,l) +
- x[nn][i]*x[nn][l]*delta(j,k) +
- x[nn][j]*x[nn][k]*delta(i,l) +
- x[nn][j]*x[nn][l]*delta(i,k) +
- x[nn][k]*x[nn][l]*delta(i,j))
- + r2*r2*(delta(i,j)*delta(k,l) +
- delta(i,k)*delta(j,l) +
- delta(i,l)*delta(j,k)))*NM2ANG*NM2ANG*NM2ANG;
- }
-}
-
-/* Print the dipole moment components and the total dipole moment */
-void pr_M1(FILE *fp,char *msg,int mol,rvec m1,real time)
-{
- int i;
- real m1_tot;
-
- fprintf(fp,"Molecule: %d @ t= %f ps\n",mol,time);
-
- m1_tot = sqrt(m1[XX]*m1[XX]+m1[YY]*m1[YY]+m1[ZZ]*m1[ZZ]);
-
- fprintf(stdout,"Dipole Moment %s(Debye):\n",msg);
- fprintf(stdout,"X= %10.5f Y= %10.5f Z= %10.5f Tot= %10.5f\n",
- m1[XX],m1[YY],m1[ZZ],m1_tot);
-}
-
-/* Print the quadrupole moment components */
-void pr_M2(FILE *fp,char *msg,tensor m2,gmx_bool bFull)
-{
- int i,j;
-
- fprintf(fp,"Quadrupole Moment %s(Debye-Ang):\n",msg);
- if (!bFull) {
- fprintf(fp,"XX= %10.5f YY= %10.5f ZZ= %10.5f\n",
- m2[XX][XX],m2[YY][YY],m2[ZZ][ZZ]);
- fprintf(fp,"XY= %10.5f XZ= %10.5f YZ= %10.5f\n",
- m2[XX][YY],m2[XX][ZZ],m2[YY][ZZ]);
- }
- else {
- for(i=0; (i<DIM); i++) {
- for(j=0; (j<DIM); j++)
- fprintf(fp," %c%c= %10.4f",dim[i],dim[j],m2[i][j]);
- fprintf(fp,"\n");
- }
- }
-}
-
-/* Print the octopole moment components */
-void pr_M3(FILE *fp,char *msg,tensor3 m3,gmx_bool bFull)
-{
- int i,j,k;
-
- fprintf(fp,"Octopole Moment %s(Debye-Ang^2):\n",msg);
- if (!bFull) {
- fprintf(fp,"XXX= %10.5f YYY= %10.5f ZZZ= %10.5f XYY= %10.5f\n",
- m3[XX][XX][XX],m3[YY][YY][YY],m3[ZZ][ZZ][ZZ],m3[XX][YY][YY]);
- fprintf(fp,"XXY= %10.5f XXZ= %10.5f XZZ= %10.5f YZZ= %10.5f\n",
- m3[XX][XX][YY],m3[XX][XX][ZZ],m3[XX][ZZ][ZZ],m3[YY][ZZ][ZZ]);
- fprintf(fp,"YYZ= %10.5f XYZ= %10.5f\n",
- m3[YY][YY][ZZ],m3[XX][YY][ZZ]);
- }
- else {
- for(i=0; (i<DIM); i++) {
- for(j=0; (j<DIM); j++) {
- for(k=0; (k<DIM); k++)
- fprintf(fp," %c%c%c= %10.4f",dim[i],dim[j],dim[k],m3[i][j][k]);
- fprintf(fp,"\n");
- }
- }
- }
-}
-
-/* Print the hexadecapole moment components */
-void pr_M4(FILE *fp,char *msg,tensor4 m4,gmx_bool bFull)
-{
- int i,j,k,l;
-
- fprintf(fp,"Hexadecapole Moment %s(Debye-Ang^3):\n",msg);
- if (!bFull) {
- fprintf(fp,"XXXX= %10.5f YYYY= %10.5f ZZZZ= %10.5f XXXY= %10.5f\n",
- m4[XX][XX][XX][XX],m4[YY][YY][YY][YY],
- m4[ZZ][ZZ][ZZ][ZZ],m4[XX][XX][XX][YY]);
- fprintf(fp,"XXXZ= %10.5f YYYX= %10.5f YYYZ= %10.5f ZZZX= %10.5f\n",
- m4[XX][XX][XX][ZZ],m4[YY][YY][YY][XX],
- m4[YY][YY][YY][ZZ],m4[ZZ][ZZ][ZZ][XX]);
- fprintf(fp,"ZZZY= %10.5f XXYY= %10.5f XXZZ= %10.5f YYZZ= %10.5f\n",
- m4[ZZ][ZZ][ZZ][YY],m4[XX][XX][YY][YY],
- m4[XX][XX][ZZ][ZZ],m4[YY][YY][ZZ][ZZ]);
- fprintf(fp,"XXYZ= %10.5f YYXZ= %10.5f ZZXY= %10.5f\n\n",
- m4[XX][XX][YY][ZZ],m4[YY][YY][XX][ZZ],m4[ZZ][ZZ][XX][YY]);
- }
- else {
- for(i=0; (i<DIM); i++) {
- for(j=0; (j<DIM); j++) {
- for(k=0; (k<DIM); k++) {
- for(l=0; (l<DIM); l++)
- fprintf(fp," %c%c%c%c = %10.4f",dim[i],dim[j],dim[k],dim[l],
- m4[i][j][k][l]);
- fprintf(fp,"\n");
- }
- }
- }
- }
-}
-
-/* Compute the inertia tensor and returns in trans a matrix which rotates
- * the molecules along the principal axes system */
-void principal_comp_mol(int k0,int k1,atom_id index[],t_atom atom[],rvec x[],
- matrix trans,rvec d)
-{
- int i,j,ai,m,nrot;
- real mm,rx,ry,rz;
- double **inten,dd[NDIM],tvec[NDIM],**ev;
- real temp;
-
- snew(inten,NDIM);
- snew(ev,NDIM);
- for(i=0; (i<NDIM); i++) {
- snew(inten[i],NDIM);
- snew(ev[i],NDIM);
- dd[i]=0.0;
- }
-
- for(i=0; (i<NDIM); i++)
- for(m=0; (m<NDIM); m++)
- inten[i][m]=0;
-
- for(i=k0; (i<k1); i++) {
- ai=index[i];
- mm=atom[ai].m;
- rx=x[ai][XX];
- ry=x[ai][YY];
- rz=x[ai][ZZ];
- inten[0][0]+=mm*(sqr(ry)+sqr(rz));
- inten[1][1]+=mm*(sqr(rx)+sqr(rz));
- inten[2][2]+=mm*(sqr(rx)+sqr(ry));
- inten[1][0]-=mm*(ry*rx);
- inten[2][0]-=mm*(rx*rz);
- inten[2][1]-=mm*(rz*ry);
- }
- inten[0][1]=inten[1][0];
- inten[0][2]=inten[2][0];
- inten[1][2]=inten[2][1];
-
- /* Call numerical recipe routines */
- jacobi(inten,3,dd,ev,&nrot);
-
- /* Sort eigenvalues in descending order */
-#define SWAPPER(i) \
- if (fabs(dd[i+1]) > fabs(dd[i])) { \
- temp=dd[i]; \
- for(j=0; (j<NDIM); j++) tvec[j]=ev[j][i];\
- dd[i]=dd[i+1]; \
- for(j=0; (j<NDIM); j++) ev[j][i]=ev[j][i+1]; \
- dd[i+1]=temp; \
- for(j=0; (j<NDIM); j++) ev[j][i+1]=tvec[j]; \
- }
- SWAPPER(0)
- SWAPPER(1)
- SWAPPER(0)
-
- for(i=0; (i<DIM); i++) {
- d[i]=dd[i];
- for(m=0; (m<DIM); m++)
- trans[i][m]=ev[m][i];
- }
-
- for(i=0; (i<NDIM); i++) {
- sfree(inten[i]);
- sfree(ev[i]);
- }
- sfree(inten);
- sfree(ev);
-}
-
-
-/* WARNING WARNING WARNING
- * This routine rotates a molecule (I have checked this for water, PvM)
- * in the standard orientation used for water by researchers in the field.
- * This is different from the orientation used by Gray and Gubbins,
- * so be careful, with molecules other than water */
-void rot_mol_to_std_orient(int k0,int k1,atom_id index[],t_atom atom[],
- rvec x[],matrix trans)
-{
- int i;
- rvec xcm,xcq,d;
- matrix r_mat;
-
- clear_rvec(xcm);
-
- /* Compute the center of mass of the molecule and make it the origin */
- calc_xcm_mol(k0,k1,index,atom,x,xcm);
-
- /* Compute the inertia moment tensor of a molecule */
- principal_comp_mol(k0,k1,index,atom,x,trans,d);
-
- /* Rotate molecule to align with principal axes */
- rotate_mol(k0,k1,index,x,trans);
-
-
- /* If one of the moments is zero and the other two are equal, the
- * molecule is linear
- */
-
- if (test_linear_mol(d)) {
- fprintf(stdout,"This molecule is linear\n");
- } else {
- fprintf(stdout,"This molecule is not linear\n");
-
-make_rot_mat(ZZ,-0.5*M_PI,r_mat);
-rotate_mol(k0,k1,index,x,r_mat);
-
-
-
- /* Now check if the center of charge now lies on the Z-axis
- * If not, rotate molecule so that it does.
- */
- for(i=0; (i<DIM); i++) {
- xcq[i]=test_qmom3(k0,k1,index,atom,x,i);
- }
-
- if ((fabs(xcq[ZZ]) - TOLERANCE) < 0.0) {
- xcq[ZZ]=0.0;
- } else {
-#ifdef DEBUG
- fprintf(stdout,"Center of charge on Z-axis: %f\n",xcq[ZZ]);
-#endif
- if (xcq[ZZ] > 0.0) {
- make_rot_mat(XX,M_PI,r_mat);
- rotate_mol(k0,k1,index,x,r_mat);
- }
- }
-
- if ((fabs(xcq[XX]) - TOLERANCE) < 0.0) {
- xcq[XX]=0.0;
- } else {
-#ifdef DEBUG
- fprintf(stdout,"Center of charge on X-axis: %f\n",xcq[XX]);
-#endif
- if (xcq[XX] < 0.0) {
- make_rot_mat(YY,0.5*M_PI,r_mat);
- rotate_mol(k0,k1,index,x,r_mat);
- } else {
- make_rot_mat(YY,-0.5*M_PI,r_mat);
- rotate_mol(k0,k1,index,x,r_mat);
- }
- }
-
- if ((fabs(xcq[YY]) - TOLERANCE) < 0.0) {
- xcq[YY]=0.0;
- } else {
-#ifdef DEBUG
- fprintf(stdout,"Center of charge on Y-axis: %f\n",xcq[YY]);
-#endif
- if (xcq[YY] < 0.0) {
- make_rot_mat(XX,-0.5*M_PI,r_mat);
- rotate_mol(k0,k1,index,x,r_mat);
- } else {
- make_rot_mat(XX,0.5*M_PI,r_mat);
- rotate_mol(k0,k1,index,x,r_mat);
- }
- }
-
- /* Now check the trace of the inertia tensor.
- * I want the water molecule in the YZ-plane */
- for(i=0; (i<DIM); i++) {
- xcm[i]=test_mmom2(k0,k1,index,atom,x,i);
- }
-#ifdef DEBUG
- fprintf(stdout,"xcm: %f %f %f\n",xcm[XX],xcm[YY],xcm[ZZ]);
-#endif
-
- /* Check if X-component of inertia tensor is zero, if not
- * rotate molecule
- * This probably only works for water!!! PvM
- */
- if ((xcm[XX] - TOLERANCE) > 0.0) {
- make_rot_mat(ZZ,-0.5*M_PI,r_mat);
- rotate_mol(k0,k1,index,x,r_mat);
- }
- }
-}
-
-/* Does the real work */
-void do_multipoles(char *trjfn,char *topfn,char *molndxfn,gmx_bool bFull)
-{
- int i;
- int gnx;
- atom_id *grpindex;
- char *grpname;
- t_topology *top;
- t_atom *atom;
- t_block *mols;
- int natoms,status;
- real t;
- matrix box;
- real t0,t1,tq;
- int teller;
- gmx_bool bCont;
-
- rvec *x,*m1;
- tensor *m2;
- tensor3 *m3;
- tensor4 *m4;
- matrix trans;
- gmx_rmpbc_t gpbc=NULL;
-
- top = read_top(topfn);
- rd_index(molndxfn,1,&gnx,&grpindex,&grpname);
- atom = top->atoms.atom;
- mols = &(top->blocks[ebMOLS]);
-
- natoms = read_first_x(&status,trjfn,&t,&x,box);
- snew(m1,gnx);
- snew(m2,gnx);
- snew(m3,gnx);
- snew(m4,gnx);
-
- gpbc = gmx_rmpbc_init(&top->idef,ePBC,top->atoms.nr,box);
-
- /* Start while loop over frames */
- do {
- /* PvM, bug in rm_pbc??? Does not work for virtual sites ...
- gmx_rmpbc(gpbc,box,x,x_s); */
-
- /* Begin loop of all molecules in index file */
- for(i=0; (i<gnx); i++) {
- int gi = grpindex[i];
-
- rot_mol_to_std_orient(mols->index[gi],mols->index[gi+1],mols->a,atom,x,
- trans);
-
- /* Rotate the molecule along the principal moments axes */
- /* rotate_mol(mols->index[gi],mols->index[gi+1],mols->a,x,trans); */
-
- /* Compute the multipole moments */
- mol_M1(mols->index[gi],mols->index[gi+1],mols->a,x,atom,m1[i]);
- mol_M2(mols->index[gi],mols->index[gi+1],mols->a,x,atom,m2[i]);
- mol_M3(mols->index[gi],mols->index[gi+1],mols->a,x,atom,m3[i]);
- mol_M4(mols->index[gi],mols->index[gi+1],mols->a,x,atom,m4[i]);
-
- /* Spit it out */
- pr_M1(stdout,"",i,m1[i],t);
- pr_M2(stdout,"",m2[i],bFull);
- pr_M3(stdout,"",m3[i],bFull);
- pr_M4(stdout,"",m4[i],bFull);
-
-
- } /* End loop of all molecules in index file */
-
- bCont = read_next_x(status,&t,natoms,x,box);
- } while(bCont);
- gmx_rmpbc_done(gpbc);
-
-
-
-}
-
-int gmx_multipoles(int argc,char *argv[])
-{
- const char *desc[] = {
- "g_multipoles computes the electric multipole moments of",
- "molecules selected by a molecular index file.",
- "The center of mass of the molecule is used as the origin"
- };
-
- static gmx_bool bFull = FALSE;
- static int ntb=0;
- t_pargs pa[] = {
- { "-boxtype",FALSE,etINT,&ntb, "HIDDENbox type 0=rectangular; 1=truncated octahedron (only rectangular boxes are fully implemented)"},
- { "-full", FALSE, etBOOL, &bFull,
- "Print all compononents of all multipoles instead of just the interesting ones" }
- };
- int gnx;
- atom_id *index;
- char *grpname;
- t_filenm fnm[] = {
- { efTPX, NULL, NULL, ffREAD },
- { efTRX, "-f", NULL, ffREAD },
- { efNDX, NULL, NULL, ffREAD }
- };
-#define NFILE asize(fnm)
- int npargs;
- t_pargs *ppa;
-
- int i,j,k;
- int natoms;
- int step;
- real t,lambda;
-
- t_tpxheader tpx;
- t_topology top;
- rvec *x,*xnew;
- matrix box;
- t_atom *atom;
- rvec dipole,dipole2;
- real mtot,alfa,beta,gamma;
- rvec CoM,*xCoM,angle;
- real *xSqrCoM;
-
- CopyRight(stderr,argv[0]);
-
- parse_common_args(&argc,argv,PCA_CAN_TIME | PCA_BE_NICE,
- NFILE,fnm,asize(pa),pa,asize(desc),desc,0,NULL);
-
- do_multipoles(ftp2fn(efTRX,NFILE,fnm),ftp2fn(efTPX,NFILE,fnm),
- ftp2fn(efNDX,NFILE,fnm),bFull);
-
- return 0;
-}
-/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
+/*
*
* This source code is part of
*
};
static gmx_bool bM=TRUE,bCons=FALSE;
- static int begin=1,end=50;
- static real T=298.15;
+ static int begin=1,end=50,maxspec=4000;
+ static real T=298.15,width=1;
t_pargs pa[] =
{
{ "-m", FALSE, etBOOL, {&bM},
"First eigenvector to write away" },
{ "-last", FALSE, etINT, {&end},
"Last eigenvector to write away" },
+ { "-maxspec", FALSE, etINT, {&maxspec},
+ "Highest frequency (1/cm) to consider in the spectrum" },
{ "-T", FALSE, etREAL, {&T},
"Temperature for computing quantum heat capacity and enthalpy when using normal mode calculations to correct classical simulations" },
{ "-constr", FALSE, etBOOL, {&bCons},
"If constraints were used in the simulation but not in the normal mode analysis (this is the recommended way of doing it) you will need to set this for computing the quantum corrections." },
+ { "-width", FALSE, etREAL, {&width},
+ "Width (sigma) of the gaussian peaks (1/cm) when generating a spectrum" }
};
- FILE *out,*qc;
+ FILE *out,*qc,*spec;
int status,trjout;
t_topology top;
gmx_mtop_t mtop;
real value,omega,nu;
real factor_gmx_to_omega2;
real factor_omega_to_wavenumber;
+ real *spectrum=NULL;
+ real wfac;
t_commrec *cr;
output_env_t oenv;
const char *qcleg[] = { "Heat Capacity cV (J/mol K)",
- "Enthalpy H (kJ/mol)" };
+ "Enthalpy H (kJ/mol)" };
real * full_hessian = NULL;
gmx_sparsematrix_t * sparse_hessian = NULL;
{ efTPX, NULL, NULL, ffREAD },
{ efXVG, "-of", "eigenfreq", ffWRITE },
{ efXVG, "-ol", "eigenval", ffWRITE },
+ { efXVG, "-os", "spectrum", ffOPTWR },
{ efXVG, "-qc", "quant_corr", ffOPTWR },
{ efTRN, "-v", "eigenvec", ffWRITE }
- };
+ };
#define NFILE asize(fnm)
cr = init_par(&argc,&argv);
/* now write the output */
fprintf (stderr,"Writing eigenvalues...\n");
- out=xvgropen(opt2fn("-ol",NFILE,fnm),
+ out=xvgropen(opt2fn("-ol",NFILE,fnm),
"Eigenvalues","Eigenvalue index","Eigenvalue [Gromacs units]",
oenv);
if (output_env_get_print_xvgr_codes(oenv)) {
for (i=0; i<=(end-begin); i++)
fprintf (out,"%6d %15g\n",begin+i,eigenvalues[i]);
ffclose(out);
-
+
if (opt2bSet("-qc",NFILE,fnm)) {
qc = xvgropen(opt2fn("-qc",NFILE,fnm),"Quantum Corrections","Eigenvector index","",oenv);
else
fprintf(out,"@ subtitle \"not mass weighted\"\n");
}
-
+ /* Spectrum ? */
+ spec = NULL;
+ if (opt2bSet("-os",NFILE,fnm) && (maxspec > 0))
+ {
+ snew(spectrum,maxspec);
+ spec=xvgropen(opt2fn("-os",NFILE,fnm),
+ "Vibrational spectrum based on harmonic approximation",
+ "\\f{12}w\\f{4} (cm\\S-1\\N)",
+ "Intensity [Gromacs units]",
+ oenv);
+ for(i=0; (i<maxspec); i++)
+ {
+ spectrum[i] = 0;
+ }
+ }
+
/* Gromacs units are kJ/(mol*nm*nm*amu),
* where amu is the atomic mass unit.
*
nu = 1e-12*omega/(2*M_PI);
value = omega*factor_omega_to_wavenumber;
fprintf (out,"%6d %15g\n",i,value);
+ if (NULL != spec)
+ {
+ wfac = eigenvalues[i-begin]/(width*sqrt(2*M_PI));
+ for(j=0; (j<maxspec); j++)
+ {
+ spectrum[j] += wfac*exp(-sqr(j-value)/(2*sqr(width)));
+ }
+ }
if (NULL != qc) {
qcv = cv_corr(nu,T);
qu = u_corr(nu,T);
}
}
ffclose(out);
+ if (NULL != spec)
+ {
+ for(j=0; (j<maxspec); j++)
+ {
+ fprintf(spec,"%10g %10g\n",1.0*j,spectrum[j]);
+ }
+ ffclose(spec);
+ }
if (NULL != qc) {
printf("Quantum corrections for harmonic degrees of freedom\n");
printf("Use appropriate -first and -last options to get reliable results.\n");
#include <ctype.h>
#include "sysstuff.h"
-#include "string.h"
+#include <string.h>
#include "typedefs.h"
#include "smalloc.h"
#include "macros.h"
#include <ctype.h>
#include "sysstuff.h"
-#include "string.h"
+#include <string.h>
#include "typedefs.h"
#include "smalloc.h"
#include "macros.h"
#include <math.h>
#include "sysstuff.h"
-#include "string.h"
+#include <string.h>
#include "typedefs.h"
#include "smalloc.h"
#include "macros.h"
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <math.h>
-#include <stdlib.h>
-#include "sysstuff.h"
-#include "string.h"
-#include "typedefs.h"
-#include "smalloc.h"
-#include "macros.h"
-#include "vec.h"
-#include "xvgr.h"
-#include "pbc.h"
-#include "copyrite.h"
-#include "futil.h"
-#include "statutil.h"
-#include "index.h"
-#include "gstat.h"
-#include "tpxio.h"
-#include "gmx_ana.h"
-
-
-typedef struct {
- real re,im;
-} complex;
-
-typedef struct {
- int ai,aj;
-} t_pair;
-
-typedef struct {
- real rij_3;
- real rij_6;
- gmx_bool bNOE;
- real tauc,dtauc,S2,dS2;
- complex y2;
- complex Ylm[5];
-} t_sij;
-
-void read_shifts(FILE *fp,int nx,real shiftx[],int ny,real shifty[])
-{
- int i;
- double d;
-
- for(i=0; (i<nx); i++) {
- fscanf(fp,"%lf",&d);
- shiftx[i]=d;
- shifty[i]=d;
- }
- /*for(i=0; (i<ny); i++) {
- fscanf(fp,"%lf",&d);
- shifty[i]=d;
- }
- */
-}
-
-complex c_sqr(complex c)
-{
- complex cs;
-
- cs.re = c.re*c.re-c.im*c.im;
- cs.im = 2.0*c.re*c.im;
-
- return cs;
-}
-
-complex c_add(complex c,complex d)
-{
- complex cs;
-
- cs.re = c.re+d.re;
- cs.im = c.im+d.im;
-
- return cs;
-}
-
-complex calc_ylm(int m,rvec rij,real r2,real r_3,real r_6)
-{
- static gmx_bool bFirst=TRUE;
- static real y0,y1,y2;
- real x,y,z,xsq,ysq,rxy,r1,cphi,sphi,cth,sth,fac;
- complex cs;
-
- if (bFirst) {
- y0 = sqrt(5/(4*M_PI));
- y1 = sqrt(45/(24*M_PI));
- y2 = sqrt(45/(96*M_PI));
- bFirst = FALSE;
- }
- r1 = sqrt(r2);
- x = rij[XX];
- y = rij[YY];
- z = rij[ZZ];
- xsq = x*x;
- ysq = y*y;
- rxy = sqrt(xsq+ysq);
- cphi= x/rxy;
- sphi= y/rxy;
- cth = z/r1;
- if (cphi != 0.0)
- sth = x/(r1*cphi);
- else
- sth = y/(r1*sphi);
-
- /* Now calculate the spherical harmonics */
- switch(m) {
- case -2:
- case 2:
- fac = y2*sth*sth;
- cs.re = fac*(cphi*cphi-sphi*sphi);
- /* Use the index as a prefactor... check your formulas */
- cs.im = m*fac*cphi*sphi;
- break;
- case -1:
- case 1:
- fac = y1*cth*sth;
- cs.re = -m*fac*cphi;
- cs.im = -fac*sphi;
- break;
- case 0:
- cs.re = y0*(3*cth*cth-1);
- cs.im = 0;
- break;
- }
- cs.re *= r_3;
- cs.im *= r_3;
-
- return cs;
-}
-
-void myfunc(real x,real a[],real *y,real dyda[],int na)
-{
- /* Fit to function
- *
- * y = a1 + (1-a1) exp(-a2 x)
- *
- * where in real life a1 is S^2 and a2 = 1/tauc
- *
- */
-
- real eee,S2,tau1;
-
- S2 = a[1];
- tau1 = 1.0/a[2];
- eee = exp(-x*tau1);
- *y = S2 + (1-S2)*eee;
- dyda[1] = 1 - eee;
- dyda[2] = x*tau1*tau1*(1-a[1])*eee;
-}
-
-void fit_one(gmx_bool bVerbose,
- int nframes,real x[],real y[],real dy[],real ftol,
- real *S2,real *dS2,real *tauc,real *dtauc)
-{
- void mrqmin(real x[],real y[],real sig[],int ndata,real a[],
- int ma,int lista[],int mfit,real **covar,real **alpha,
- real *chisq,
- void (*funcs)(real x,real a[],real *y,real dyda[],int na),
- real *alamda);
-
- real *a,**covar,**alpha;
- real chisq,ochisq,alamda;
- gmx_bool bCont;
- int i,j,ma,mfit,*lista;
-
- ma=mfit=2;
- snew(a,ma+1);
- snew(covar,ma+1);
- snew(alpha,ma+1);
- snew(lista,ma+1);
- for(i=0; (i<ma+1); i++) {
- lista[i] = i;
- snew(covar[i],ma+1);
- snew(alpha[i],ma+1);
- }
-
- a[1] = 0.99; /* S^2 */
- a[2] = 0.1; /* tauc */
- alamda = -1; /* Starting value */
- chisq = 1e12;
- j = 0;
- do {
- ochisq = chisq;
- mrqmin(x-1,y-1,dy-1,nframes,a,ma,lista,mfit,covar,alpha,
- &chisq,myfunc,&alamda);
- if (bVerbose)
- fprintf(stderr,"\rFitting %d chisq=%g, alamda=%g, tau=%g, S^2=%g\t\t\n",
- j,chisq,alamda,1.0/a[2],a[1]);
- j++;
- bCont = (((ochisq - chisq) > ftol*chisq) ||
- ((ochisq == chisq)));
- } while (bCont && (alamda != 0.0) && (j < 50));
- if (bVerbose)
- fprintf(stderr,"\n");
-
- /* Now get the covariance matrix out */
- alamda = 0;
- mrqmin(x-1,y-1,dy-1,nframes,a,ma,lista,mfit,covar,alpha,
- &chisq,myfunc,&alamda);
-
- *S2 = a[1];
- *dS2 = sqrt(covar[1][1]);
- *tauc = a[2];
- *dtauc = sqrt(covar[2][2]);
-
- for(i=0; (i<ma+1); i++) {
- sfree(covar[i]);
- sfree(alpha[i]);
- }
- sfree(a);
- sfree(covar);
- sfree(alpha);
- sfree(lista);
-}
-
-void calc_tauc(gmx_bool bVerbose,int npair,t_pair pair[],real dt,
- int nframes,t_sij spec[],real **corr)
-{
- FILE *fp;
- char buf[32];
- int i,j,k,n;
- real S2,S22,tauc,fac;
- real *x,*dy;
- real ftol = 1e-3;
-
- snew(x,nframes);
- snew(dy,nframes);
- for(i=0; (i<nframes); i++)
- x[i] = i*dt;
-
- fprintf(stderr,"Fitting correlation function to Lipari&Szabo function\n");
- fac=1.0/((real)nframes);
- for(i=0; (i<npair); i++) {
- if (spec[i].bNOE) {
- /* Use Levenberg-Marquardt method to fit */
- for(j=0; (j<nframes); j++)
- dy[j] = fac;
- fit_one(bVerbose,
- nframes,x,corr[i],dy,ftol,
- &(spec[i].S2),&(spec[i].dS2),
- &(spec[i].tauc),&(spec[i].dtauc));
- if (bVerbose) {
- sprintf(buf,"test%d.xvg",i);
- fp = ffopen(buf,"w");
- for(j=0; (j<nframes); j++) {
- fprintf(fp,"%10g %10g %10g\n",j*dt,corr[i][j],
- spec[i].S2 + (1-spec[i].S2)*exp(-j*dt/spec[i].tauc));
- }
- ffclose(fp);
- }
- }
- }
-}
-
-void calc_aver(FILE *fp,int nframes,int npair,t_pair pair[],t_sij *spec,
- real maxdist)
-{
- int i,j,m;
- real nf_1,fac,md_6;
- complex c1,c2,dc2;
-
- md_6 = pow(maxdist,-6.0);
- fac = 4*M_PI/5;
- nf_1 = 1.0/nframes;
- for(i=0; (i<npair); i++) {
- c2.re = 0;
- c2.im = 0;
- fprintf(fp,"%5d %5d",pair[i].ai,pair[i].aj);
- for(m=0; (m<5); m++) {
- c1.re = spec[i].Ylm[m].re*nf_1;
- c1.im = spec[i].Ylm[m].im*nf_1;
- dc2 = c_sqr(c1);
- c2 = c_add(dc2,c2);
-
- if (c1.im > 0)
- fprintf(fp," %8.3f+i%8.3f",c1.re,c1.im);
- else
- fprintf(fp," %8.3f-i%8.3f",c1.re,-c1.im);
- }
- fprintf(fp,"\n");
- spec[i].rij_3 *= nf_1;
- spec[i].rij_6 *= nf_1;
- spec[i].y2.re = fac*c2.re;
- spec[i].y2.im = fac*c2.im;
- spec[i].bNOE = (spec[i].rij_6 > md_6);
- }
-}
-
-void plot_spectrum(char *noefn,int npair,t_pair pair[],t_sij *spec,real taum)
-{
- FILE *fp,*out;
- int i,j,m;
- t_rgb rlo = { 1,0,0 },rhi = {1,1,1};
- real Sijmax,Sijmin,pow6,pow3,pp3,pp6,ppy,tauc;
- real *Sij;
- complex sij;
-
- snew(Sij,npair);
- Sijmax = -1000.0;
- Sijmin = 1000.0;
- fp=xvgropen(noefn,"Cross Relaxation","Pair Index","\\8s\\4\\sij\\N");
- for(i=0; (i<npair); i++) {
- tauc = spec[i].tauc;
- sij.re = -0.4*((taum-tauc)*spec[i].y2.re + tauc*spec[i].rij_6);
- sij.im = -0.4* (taum-tauc)*spec[i].y2.im;
- Sij[i]=sij.re;
- Sijmax=max(Sijmax,sij.re);
- Sijmin=min(Sijmin,sij.re);
- fprintf(fp,"%5d %10g\n",i,sij.re);
- }
- ffclose(fp);
- fprintf(stderr,"Sijmin: %g, Sijmax: %g\n",Sijmin,Sijmax);
- out=ffopen("spec.out","w");
- pow6 = -1.0/6.0;
- pow3 = -1.0/3.0;
- fprintf(out,"%5s %5s %8s %8s %8s %8s %8s %8s %8s %8s %8s\n",
- "at i","at j","S^2","Sig S^2","tauc","Sig tauc",
- "<rij6>","<rij3>","<ylm>","rij3-6","ylm-rij6");
- for(i=0; (i<npair); i++) {
- if (spec[i].bNOE) {
- pp6 = pow(spec[i].rij_6,pow6);
- pp3 = pow(spec[i].rij_3,pow3);
- if (spec[i].y2.re < 0)
- ppy = -pow(-spec[i].y2.re,pow6);
- else
- ppy = pow(spec[i].y2.re,pow6);
- fprintf(out,"%5d %5d %8.4f %8.4f %8.4f %8.4f %8.4f %8.4f %8.4f %8.4f %8.4f\n",
- pair[i].ai,pair[i].aj,
- spec[i].S2,spec[i].dS2,spec[i].tauc,spec[i].dtauc,
- pp6,pp3,ppy,pp3-pp6,ppy-pp6);
- }
- }
- ffclose(out);
-
- sfree(Sij);
-
- do_view(noefn,NULL);
-}
-
-void spectrum(gmx_bool bVerbose,
- char *trj,char *shifts,gmx_bool bAbInitio,
- char *corrfn,char *noefn,
- int maxframes,gmx_bool bFour,gmx_bool bFit,int nrestart,
- int npair,t_pair pair[],int nat,real chem_shifts[],
- real taum,real maxdist,
- real w_rls[],rvec xp[],t_idef *idef)
-{
- FILE *fp;
- int i,j,m,ii,jj,natoms,status,nframes;
- rvec *x,dx;
- matrix box;
- real t0,t1,t,dt;
- real r2,r6,r_3,r_6,tauc;
- rvec **corr;
- real **Corr;
- t_sij *spec;
- gmx_rmpbc_t gpbc=NULL;
-
- snew(spec,npair);
-
- fprintf(stderr,"There is no kill like overkill! Going to malloc %d bytes\n",
- npair*maxframes*sizeof(corr[0][0]));
- snew(corr,npair);
- for(i=0; (i<npair); i++)
- snew(corr[i],maxframes);
- nframes = 0;
- natoms = read_first_x(&status,trj,&t0,&x,box);
- if (natoms > nat)
- gmx_fatal(FARGS,"Not enough atoms in trajectory");
- gpbc = gmx_rmpbc_init(idef,ePBC,natoms,box);
-
- do {
- if (nframes >= maxframes) {
- fprintf(stderr,"\nThere are more than the %d frames you told me!",
- maxframes);
- break;
- }
- t1 = t;
- if (bVerbose)
- fprintf(stderr,"\rframe: %d",nframes);
- gmx_rmpbc(gpbc,box,x,x);
- if (bFit)
- do_fit(natoms,w_rls,xp,x);
-
- for(i=0; (i<npair); i++) {
- ii = pair[i].ai;
- jj = pair[i].aj;
- rvec_sub(x[ii],x[jj],dx);
- copy_rvec(dx,corr[i][nframes]);
-
- r2 = iprod(dx,dx);
- r6 = r2*r2*r2;
- r_3 = gmx_invsqrt(r6);
- r_6 = r_3*r_3;
- spec[i].rij_3 += r_3;
- spec[i].rij_6 += r_6;
- for(m=0; (m<5); m++) {
- spec[i].Ylm[m] = c_add(spec[i].Ylm[m],
- calc_ylm(m-2,dx,r2,r_3,r_6));
- }
- }
- nframes++;
- } while (read_next_x(status,&t,natoms,x,box));
- close_trj(status);
- if (bVerbose)
- fprintf(stderr,"\n");
-
- gmx_rmpbc_done(gpbc);
-
- fp=ffopen("ylm.out","w");
- calc_aver(fp,nframes,npair,pair,spec,maxdist);
- ffclose(fp);
-
- /* Select out the pairs that have to be correlated */
- snew(Corr,npair);
- for(i=j=0; (i<npair); i++) {
- if (spec[i].bNOE) {
- Corr[j] = &(corr[i][0][0]);
- j++;
- }
- }
- fprintf(stderr,"There are %d NOEs in your simulation\n",j);
- if (nframes > 1)
- dt = (t1-t0)/(nframes-1);
- else
- dt = 1;
- do_autocorr(corrfn,"Correlation Function for Interproton Vectors",
- nframes,j,Corr,dt,eacP2,nrestart,FALSE,FALSE,bFour,TRUE);
-
- calc_tauc(bVerbose,npair,pair,dt,nframes/2,spec,(real **)corr);
-
- plot_spectrum(noefn,npair,pair,spec,taum);
-}
-
-int gmx_relax(int argc,char *argv[])
-{
- const char *desc[] = {
- "g_noe calculates a NOE spectrum"
- };
-
- int status;
- t_topology *top;
- int i,j,k,natoms,nprot,*prot_ind;
- int ifit;
- char *gn_fit;
- atom_id *ind_fit,*all_at;
- real *w_rls;
- rvec *xp;
- t_pair *pair;
- matrix box;
- int step,nre;
- real t,lambda;
- real *shifts=NULL;
- t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPX, "-s", NULL, ffREAD },
- { efNDX, NULL, NULL, ffREAD },
- { efDAT, "-d", "shifts", ffREAD },
- { efOUT, "-o","spec", ffWRITE },
- { efXVG, "-corr", "rij-corr", ffWRITE },
- { efXVG, "-noe", "noesy", ffWRITE }
- };
-#define NFILE asize(fnm)
- static real taum = 0.0, maxdist = 0.6;
- static int nlevels = 15;
- static int nrestart = 1;
- static int maxframes = 100;
- static gmx_bool bFFT = TRUE,bFit = TRUE, bVerbose = TRUE;
- t_pargs pa[] = {
- { "-taum", FALSE, etREAL, &taum,
- "Rotational correlation time for your molecule. It is obligatory to pass this option" },
- { "-maxdist", FALSE, etREAL, &maxdist,
- "Maximum distance to be plotted" },
- { "-nlevels", FALSE, etINT, &nlevels,
- "Number of levels for plotting" },
- { "-nframes", FALSE, etINT, &maxframes,
- "Number of frames in your trajectory. Will stop analysis after this" },
- { "-fft", FALSE, etBOOL, &bFFT,
- "Use FFT for correlation function" },
- { "-nrestart", FALSE, etINT, &nrestart,
- "Number of frames between starting point for computation of ACF without FFT" },
- { "-fit", FALSE, etBOOL, &bFit,
- "Do an optimal superposition on reference structure in [TT].tpx[tt] file" },
- { "-v", FALSE, etBOOL, &bVerbose,
- "Tell you what I am about to do" }
- };
-
- CopyRight(stderr,argv[0]);
- parse_common_args(&argc,argv,PCA_CAN_VIEW | PCA_CAN_TIME | PCA_BE_NICE,
- NFILE,fnm,asize(pa),pa,asize(desc),desc,0,NULL);
- if (taum <= 0)
- gmx_fatal(FARGS,"Please give me a sensible taum!\n");
- if (nlevels > 50) {
- nlevels = 50;
- fprintf(stderr,"Warning: too many levels, setting to %d\n",nlevels);
- }
-
- top = read_top(ftp2fn(efTPX,NFILE,fnm));
- natoms = top->atoms.nr;
- snew(xp,natoms);
- read_tpx(ftp2fn(efTPX,NFILE,fnm),&step,&t,&lambda,NULL,box,
- &natoms,xp,NULL,NULL,NULL);
-
- /* Determine the number of protons, and their index numbers
- * by checking the mass
- */
- nprot = 0;
- snew(prot_ind,natoms);
- for(i=0; (i<natoms); i++)
- if (top->atoms.atom[i].m < 2) {
- prot_ind[nprot++] = i;
- }
- fprintf(stderr,"There %d protons in your topology\n",nprot);
- snew(pair,(nprot*(nprot-1)/2));
- for(i=k=0; (i<nprot); i++) {
- for(j=i+1; (j<nprot); j++,k++) {
- pair[k].ai = prot_ind[i];
- pair[k].aj = prot_ind[j];
- }
- }
- sfree(prot_ind);
-
- fprintf(stderr,"Select group for root least squares fit\n");
- rd_index(ftp2fn(efNDX,NFILE,fnm),1,&ifit,&ind_fit,&gn_fit);
-
- if (ifit < 3)
- gmx_fatal(FARGS,"Need >= 3 points to fit!\n");
-
- /* Make an array with weights for fitting */
- snew(w_rls,natoms);
- for(i=0; (i<ifit); i++)
- w_rls[ind_fit[i]]=top->atoms.atom[ind_fit[i]].m;
-
- /* Prepare reference frame */
- snew(all_at,natoms);
- for(j=0; (j<natoms); j++)
- all_at[j]=j;
- rm_pbc(&(top->idef),natoms,box,xp,xp);
- reset_x(ifit,ind_fit,natoms,all_at,xp,w_rls);
- sfree(all_at);
-
- spectrum(bVerbose,
- ftp2fn(efTRX,NFILE,fnm),ftp2fn(efDAT,NFILE,fnm),
- ftp2bSet(efDAT,NFILE,fnm),opt2fn("-corr",NFILE,fnm),
- opt2fn("-noe",NFILE,fnm),
- maxframes,bFFT,bFit,nrestart,
- k,pair,natoms,shifts,
- taum,maxdist,w_rls,xp,&(top->idef));
-
- thanx(stderr);
-
- return 0;
-}
-
#endif
#include "smalloc.h"
-#include "math.h"
+#include <math.h>
#include "macros.h"
#include "typedefs.h"
#include "xvgr.h"
#endif
#include "smalloc.h"
-#include "math.h"
+#include <math.h>
#include "macros.h"
#include "typedefs.h"
#include "xvgr.h"
--- /dev/null
+/*
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * VERSION 3.2.0
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2004, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ *
+ * And Hey:
+ * Green Red Orange Magenta Azure Cyan Skyblue
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <ctype.h>
+#include "smalloc.h"
+#include "sysstuff.h"
+#include "typedefs.h"
+#include "macros.h"
+#include "vec.h"
+#include "pbc.h"
+#include "xvgr.h"
+#include "copyrite.h"
+#include "futil.h"
+#include "statutil.h"
+#include "tpxio.h"
+#include "index.h"
+#include "gstat.h"
+#include "matio.h"
+#include "gmx_ana.h"
+#include "nsfactor.h"
+
+
+int gmx_sans(int argc,char *argv[])
+{
+ const char *desc[] = {
+ "This is simple tool to compute SANS spectra using Debye formula",
+ "It currently uses topology file (since it need to assigne element for each atom)",
+ "[PAR]",
+ "[TT]-pr[TT] Computes normalized g(r) function",
+ "[PAR]",
+ "[TT]-sq[TT] Computes SANS intensity curve for needed q diapason",
+ "[PAR]",
+ "[TT]-startq[TT] Starting q value in nm",
+ "[PAR]",
+ "[TT]-endq[TT] Ending q value in nm",
+ "[PAR]",
+ "[TT]-qstep[TT] Stepping in q space",
+ "[PAR]",
+ "Note: When using Debye direct method computational cost increases as",
+ "1/2 * N * (N - 1) where N is atom number in group of interest"
+ };
+ static gmx_bool bPBC=TRUE;
+ static real binwidth=0.2,grid=0.05; /* bins shouldnt be smaller then bond (~0.1nm) length */
+ static real start_q=0.0, end_q=2.0, q_step=0.01;
+ static gmx_large_int_t nmc=1048576;
+ static unsigned int seed=0;
+
+ static const char *emode[]= { NULL, "direct", "mc", NULL };
+ static const char *emethod[]={ NULL, "debye", "fft", NULL };
+
+ gmx_nentron_atomic_structurefactors_t *gnsf;
+ gmx_sans_t *gsans;
+
+#define NPA asize(pa)
+
+ t_pargs pa[] = {
+ { "-bin", FALSE, etREAL, {&binwidth},
+ "[HIDDEN]Binwidth (nm)" },
+ { "-mode", FALSE, etENUM, {emode},
+ "Mode for sans spectra calculation" },
+ { "-nmc", FALSE, etINT, {&nmc},
+ "Number of iterations for Monte-Carlo run"},
+ { "-method", FALSE, etENUM, {emethod},
+ "[HIDDEN]Method for sans spectra calculation" },
+ { "-pbc", FALSE, etBOOL, {&bPBC},
+ "Use periodic boundary conditions for computing distances" },
+ { "-grid", FALSE, etREAL, {&grid},
+ "[HIDDEN]Grid spacing (in nm) for FFTs" },
+ {"-startq", FALSE, etREAL, {&start_q},
+ "Starting q (1/nm) "},
+ {"-endq", FALSE, etREAL, {&end_q},
+ "Ending q (1/nm)"},
+ { "-qstep", FALSE, etREAL, {&q_step},
+ "Stepping in q (1/nm)"},
+ { "-seed", FALSE, etINT, {&seed},
+ "Random seed for Monte-Carlo"},
+ };
+ FILE *fp;
+ const char *fnTPX,*fnNDX,*fnDAT=NULL;
+ t_trxstatus *status;
+ t_topology *top=NULL;
+ t_atom *atom=NULL;
+ gmx_rmpbc_t gpbc=NULL;
+ gmx_bool bTPX;
+ gmx_bool bFFT=FALSE, bDEBYE=FALSE;
+ gmx_bool bMC=FALSE, bDIRECT=FALSE;
+ int ePBC=-1;
+ matrix box;
+ char title[STRLEN];
+ rvec *x;
+ int natoms;
+ real t;
+ char **grpname=NULL;
+ atom_id *index=NULL;
+ int isize;
+ int i,j;
+ gmx_radial_distribution_histogram_t *pr=NULL;
+ gmx_static_structurefator_t *sq=NULL;
+ output_env_t oenv;
+
+#define NFILE asize(fnm)
+
+ t_filenm fnm[] = {
+ { efTPX, "-s", NULL, ffREAD },
+ { efNDX, NULL, NULL, ffOPTRD },
+ { efDAT, "-d", "nsfactor", ffOPTRD },
+ { efXVG, "-sq", "sq", ffWRITE },
+ { efXVG, "-pr", "pr", ffWRITE }
+ };
+
+ CopyRight(stderr,argv[0]);
+ parse_common_args(&argc,argv,PCA_BE_NICE,
+ NFILE,fnm,asize(pa),pa,asize(desc),desc,0,NULL,&oenv);
+
+ /* Now try to parse opts for modes */
+ switch(emethod[0][0]) {
+ case 'd':
+ bDEBYE=TRUE;
+ switch(emode[0][0]) {
+ case 'd':
+ bDIRECT=TRUE;
+ fprintf(stderr,"Using direct Debye method to calculate spectrum\n");
+ break;
+ case 'm':
+ bMC=TRUE;
+ fprintf(stderr,"Using Monte Carlo Debye method to calculate spectrum\n");
+ break;
+ default:
+ break;
+ }
+ break;
+ case 'f':
+ bFFT=TRUE;
+ fprintf(stderr,"Using FFT method\n");
+ break;
+ default:
+ break;
+ }
+
+ if (!bDEBYE && !bFFT)
+ gmx_fatal(FARGS,"Unknown method. Set pr or fft!\n");
+ if (!bDIRECT && !bMC)
+ gmx_fatal(FARGS,"Unknown mode for g(r) method set to direct or mc!");
+ /* Try to read files */
+ fnDAT = ftp2fn(efDAT,NFILE,fnm);
+ fnTPX = ftp2fn(efTPX,NFILE,fnm);
+
+ gnsf = gmx_neutronstructurefactors_init(fnDAT);
+ fprintf(stderr,"Read %d atom names from %s with neutron scattering parameters\n\n",gnsf->nratoms,fnDAT);
+
+ snew(top,1);
+ snew(grpname,1);
+ snew(index,1);
+
+ bTPX=read_tps_conf(fnTPX,title,top,&ePBC,&x,NULL,box,TRUE);
+
+ printf("\nPlease select group for SANS spectra calculation:\n");
+ get_index(&(top->atoms),ftp2fn_null(efNDX,NFILE,fnm),1,&isize,&index,grpname);
+
+ gsans = gmx_sans_init(top,gnsf);
+
+ /* Prepare reference frame */
+ if (bPBC) {
+ gpbc = gmx_rmpbc_init(&top->idef,ePBC,top->atoms.nr,box);
+ gmx_rmpbc(gpbc,top->atoms.nr,box,x);
+ }
+
+ natoms=top->atoms.nr;
+ if (bDEBYE) {
+ if (bDIRECT) {
+ /* calc pr */
+ pr = calc_radial_distribution_histogram(gsans,x,index,isize,binwidth,bMC,nmc,seed);
+ } else if (bMC) {
+ if (nmc>(gmx_large_int_t)floor(0.5*isize*(isize-1))) {
+ fprintf(stderr,"Number of mc iteration larger then number of pairs in index group. Switching to direct method!\n");
+ bMC=FALSE;
+ bDIRECT=TRUE;
+ pr = calc_radial_distribution_histogram(gsans,x,index,isize,binwidth,bMC,nmc,seed);
+ } else {
+ pr = calc_radial_distribution_histogram(gsans,x,index,isize,binwidth,bMC,nmc,seed);
+ }
+ } else {
+ gmx_fatal(FARGS,"Unknown method!\n");
+ }
+ } else if (bFFT) {
+ gmx_fatal(FARGS,"Not implented!\n");
+ } else {
+ gmx_fatal(FARGS,"Whats this!?\n");
+ }
+
+ /* prepare pr.xvg */
+ fp = xvgropen(opt2fn_null("-pr",NFILE,fnm),"G(r)","Distance (nm)","Probability",oenv);
+ for(i=0;i<pr->grn;i++)
+ fprintf(fp,"%10.6lf%10.6lf\n",pr->r[i],pr->gr[i]);
+ xvgrclose(fp);
+
+ /* prepare sq.xvg */
+ sq = convert_histogram_to_intensity_curve(pr,start_q,end_q,q_step);
+ fp = xvgropen(opt2fn_null("-sq",NFILE,fnm),"I(q)","q (nm^-1)","s(q)/s(0)",oenv);
+ for(i=0;i<sq->qn;i++) {
+ fprintf(fp,"%10.6lf%10.6lf\n",sq->q[i],sq->s[i]);
+ }
+ xvgrclose(fp);
+
+ sfree(pr);
+
+ thanx(stderr);
+
+ return 0;
+}
#include <stdlib.h>
#include "sysstuff.h"
-#include "string.h"
+#include <string.h>
#include "typedefs.h"
#include "smalloc.h"
#include "macros.h"
#include <math.h>
#include "sysstuff.h"
-#include "string.h"
+#include <string.h>
#include "typedefs.h"
#include "smalloc.h"
#include "macros.h"
#include "copyrite.h"
#include "statutil.h"
#include "tpxio.h"
-#include "math.h"
+#include <math.h>
#include "index.h"
#include "pbc.h"
#include "rmpbc.h"
#include "index.h"
#include "smalloc.h"
#include "statutil.h"
-#include "string.h"
+#include <string.h>
#include "sysstuff.h"
#include "txtdump.h"
#include "typedefs.h"
int i,m,in,nnn;
real vn,vnmax;
- if (histo == NULL)
+ if (*histo == NULL)
{
vnmax = 0;
for(i=0; (i<gnx); i++)
snew(fnms_out[i],strlen(buf)+32);
sprintf(fnms_out[i],"%d_%s",i,buf);
}
+ sfree(buf);
}
do_demux(nfile_in,fnms,fnms_out,n,val,t,dt_remd,isize,index,dt,oenv);
}
enum { euSel,euRect, euTric, euCompact, euNR};
-static int
-sort_comdist2(void *thunk, const void *a, const void *b)
-{
- /* Thunk should point to a real array with the distance to the cluster COM for each molecule,
- * a/b point to integers that refer to the molecule number.
- */
- real *pcomdist2 = thunk;
- int ia = * (int *)a;
- int ib = * (int *)b;
- int rc;
-
- if(pcomdist2[ia]<pcomdist2[ib])
- {
- rc=-1;
- }
- else if (pcomdist2[ia]>pcomdist2[ib])
- {
- rc=1;
- }
- else
- {
- rc=0;
- }
- return rc;
-}
-
-
static void calc_pbc_cluster(int ecenter,int nrefat,t_topology *top,int ePBC,
rvec x[],atom_id index[],
rvec clust_com,matrix box, rvec clustercenter)
fprintf(stderr,"\n");
close_trj(status);
+ sfree(outf_base);
+
if (bRmPBC)
gmx_rmpbc_done(gpbc);
if (0 == repeats)
{
fprintf(fp, "\nNo benchmarks done since number of repeats (-r) is 0.\n");
- fclose(fp);
+ ffclose(fp);
finalize(opt2fn("-p", nfile, fnm));
exit(0);
}
{ efXVG, "-dhdl", "dhdl", ffOPTWR },
{ efXVG, "-field", "field", ffOPTWR },
{ efXVG, "-table", "table", ffOPTRD },
+ { efXVG, "-tabletf", "tabletf", ffOPTRD },
{ efXVG, "-tablep", "tablep", ffOPTRD },
{ efXVG, "-tableb", "table", ffOPTRD },
{ efTRX, "-rerun", "rerun", ffOPTRD },
{ efXVG, "-runav", "runaver", ffOPTWR },
{ efXVG, "-px", "pullx", ffOPTWR },
{ efXVG, "-pf", "pullf", ffOPTWR },
+ { efXVG, "-ro", "rotation", ffOPTWR },
+ { efLOG, "-ra", "rotangles",ffOPTWR },
+ { efLOG, "-rs", "rotslabs", ffOPTWR },
+ { efLOG, "-rt", "rottorque",ffOPTWR },
{ efMTX, "-mtx", "nm", ffOPTWR },
{ efNDX, "-dn", "dipole", ffOPTWR },
/* Output files that are deleted after each benchmark run */
{ efXVG, "-brunav", "benchrnav",ffOPTWR },
{ efXVG, "-bpx", "benchpx", ffOPTWR },
{ efXVG, "-bpf", "benchpf", ffOPTWR },
+ { efXVG, "-bro", "benchrot", ffOPTWR },
+ { efLOG, "-bra", "benchrota",ffOPTWR },
+ { efLOG, "-brs", "benchrots",ffOPTWR },
+ { efLOG, "-brt", "benchrott",ffOPTWR },
{ efMTX, "-bmtx", "benchn", ffOPTWR },
{ efNDX, "-bdn", "bench", ffOPTWR }
};
#include "index.h"
#include "smalloc.h"
#include "statutil.h"
-#include "string.h"
+#include <string.h>
#include "sysstuff.h"
#include "txtdump.h"
#include "typedefs.h"
#include "strdb.h"
#include "xvgr.h"
#include "gmx_ana.h"
-
+#include "gmx_fft.h"
static void index_atom2mol(int *n,atom_id *index,t_block *mols)
{
- int nat,i,nmol,mol,j;
-
- nat = *n;
- i = 0;
- nmol = 0;
- mol = 0;
- while (i < nat) {
- while (index[i] > mols->index[mol]) {
- mol++;
- if (mol >= mols->nr)
- gmx_fatal(FARGS,"Atom index out of range: %d",index[i]+1);
- }
- for(j=mols->index[mol]; j<mols->index[mol+1]; j++) {
- if (i >= nat || index[i] != j)
- gmx_fatal(FARGS,"The index group does not consist of whole molecules");
- i++;
+ int nat,i,nmol,mol,j;
+
+ nat = *n;
+ i = 0;
+ nmol = 0;
+ mol = 0;
+ while (i < nat) {
+ while (index[i] > mols->index[mol]) {
+ mol++;
+ if (mol >= mols->nr)
+ gmx_fatal(FARGS,"Atom index out of range: %d",index[i]+1);
+ }
+ for(j=mols->index[mol]; j<mols->index[mol+1]; j++) {
+ if (i >= nat || index[i] != j)
+ gmx_fatal(FARGS,"The index group does not consist of whole molecules");
+ i++;
+ }
+ index[nmol++] = mol;
}
- index[nmol++] = mol;
- }
- fprintf(stderr,"\nSplit group of %d atoms into %d molecules\n",nat,nmol);
+ fprintf(stderr,"\nSplit group of %d atoms into %d molecules\n",nat,nmol);
- *n = nmol;
+ *n = nmol;
}
static void precalc(t_topology top,real normm[]){
- real mtot;
- int i,j,k,l;
+ real mtot;
+ int i,j,k,l;
- for(i=0;i<top.mols.nr;i++){
- k=top.mols.index[i];
- l=top.mols.index[i+1];
- mtot=0.0;
+ for(i=0;i<top.mols.nr;i++){
+ k=top.mols.index[i];
+ l=top.mols.index[i+1];
+ mtot=0.0;
- for(j=k;j<l;j++)
- mtot+=top.atoms.atom[j].m;
+ for(j=k;j<l;j++)
+ mtot+=top.atoms.atom[j].m;
- for(j=k;j<l;j++)
- normm[j]=top.atoms.atom[j].m/mtot;
+ for(j=k;j<l;j++)
+ normm[j]=top.atoms.atom[j].m/mtot;
- }
+ }
}
+static void calc_spectrum(int n,real c[],real dt,const char *fn,
+ output_env_t oenv,gmx_bool bRecip)
+{
+ FILE *fp;
+ gmx_fft_t fft;
+ int i,status;
+ real *data;
+ real nu,omega,recip_fac;
+ snew(data,n*2);
+ for(i=0; (i<n); i++)
+ data[i] = c[i];
+
+ if ((status = gmx_fft_init_1d_real(&fft,n,GMX_FFT_FLAG_NONE)) != 0)
+ {
+ gmx_fatal(FARGS,"Invalid fft return status %d",status);
+ }
+ if ((status = gmx_fft_1d_real(fft, GMX_FFT_REAL_TO_COMPLEX,data,data)) != 0)
+ {
+ gmx_fatal(FARGS,"Invalid fft return status %d",status);
+ }
+ fp = xvgropen(fn,"Vibrational Power Spectrum",
+ bRecip ? "\\f{12}w\\f{4} (cm\\S-1\\N)" :
+ "\\f{12}n\\f{4} (ps\\S-1\\N)",
+ "a.u.",oenv);
+ /* This is difficult.
+ * The length of the ACF is dt (as passed to this routine).
+ * We pass the vacf with N time steps from 0 to dt.
+ * That means that after FFT we have lowest frequency = 1/dt
+ * then 1/(2 dt) etc. (this is the X-axis of the data after FFT).
+ * To convert to 1/cm we need to have to realize that
+ * E = hbar w = h nu = h c/lambda. We want to have reciprokal cm
+ * on the x-axis, that is 1/lambda, so we then have
+ * 1/lambda = nu/c. Since nu has units of 1/ps and c has gromacs units
+ * of nm/ps, we need to multiply by 1e7.
+ * The timestep between saving the trajectory is
+ * 1e7 is to convert nanometer to cm
+ */
+ recip_fac = bRecip ? (1e7/SPEED_OF_LIGHT) : 1.0;
+ for(i=0; (i<n); i+=2)
+ {
+ nu = i/(2*dt);
+ omega = nu*recip_fac;
+ /* Computing the square magnitude of a complex number, since this is a power
+ * spectrum.
+ */
+ fprintf(fp,"%10g %10g\n",omega,sqr(data[i])+sqr(data[i+1]));
+ }
+ xvgrclose(fp);
+ gmx_fft_destroy(fft);
+ sfree(data);
+}
int gmx_velacc(int argc,char *argv[])
{
- const char *desc[] = {
- "[TT]g_velacc[tt] computes the velocity autocorrelation function.",
- "When the [TT]-m[tt] option is used, the momentum autocorrelation",
- "function is calculated.[PAR]",
- "With option [TT]-mol[tt] the velocity autocorrelation function of",
- "molecules is calculated. In this case the index group should consist",
- "of molecule numbers instead of atom numbers.[PAR]",
- "Be sure that your trajectory contains frames with velocity information",
- "(i.e. [TT]nstvout[tt] was set in your original [TT].mdp[tt] file),",
- "and that the time interval between data collection points is",
- "much shorter than the time scale of the autocorrelation."
- };
+ const char *desc[] = {
+ "[TT]g_velacc[tt] computes the velocity autocorrelation function.",
+ "When the [TT]-m[tt] option is used, the momentum autocorrelation",
+ "function is calculated.[PAR]",
+ "With option [TT]-mol[tt] the velocity autocorrelation function of",
+ "molecules is calculated. In this case the index group should consist",
+ "of molecule numbers instead of atom numbers.[PAR]",
+ "Be sure that your trajectory contains frames with velocity information",
+ "(i.e. [TT]nstvout[tt] was set in your original [TT].mdp[tt] file),",
+ "and that the time interval between data collection points is",
+ "much shorter than the time scale of the autocorrelation."
+ };
- static gmx_bool bM=FALSE,bMol=FALSE;
- t_pargs pa[] = {
- { "-m", FALSE, etBOOL, {&bM},
- "Calculate the momentum autocorrelation function" },
- { "-mol", FALSE, etBOOL, {&bMol},
- "Calculate the velocity acf of molecules" }
- };
-
- t_topology top;
- int ePBC=-1;
- t_trxframe fr;
- matrix box;
- gmx_bool bTPS=FALSE,bTop=FALSE;
- int gnx;
- atom_id *index;
- char *grpname;
- char title[256];
- real t0,t1,m;
- t_trxstatus *status;
- int teller,n_alloc,i,j,tel3,k,l;
- rvec mv_mol;
- real **c1;
- real *normm=NULL;
- output_env_t oenv;
+ static gmx_bool bMass=FALSE,bMol=FALSE,bRecip=TRUE;
+ t_pargs pa[] = {
+ { "-m", FALSE, etBOOL, {&bMass},
+ "Calculate the momentum autocorrelation function" },
+ { "-recip", FALSE, etBOOL, {&bRecip},
+ "Use cm^-1 on X-axis instead of 1/ps for spectra." },
+ { "-mol", FALSE, etBOOL, {&bMol},
+ "Calculate the velocity acf of molecules" }
+ };
+
+ t_topology top;
+ int ePBC=-1;
+ t_trxframe fr;
+ matrix box;
+ gmx_bool bTPS=FALSE,bTop=FALSE;
+ int gnx;
+ atom_id *index;
+ char *grpname;
+ char title[256];
+ /* t0, t1 are the beginning and end time respectively.
+ * dt is the time step, mass is temp variable for atomic mass.
+ */
+ real t0,t1,dt,mass;
+ t_trxstatus *status;
+ int counter,n_alloc,i,j,counter_dim,k,l;
+ rvec mv_mol;
+ /* Array for the correlation function */
+ real **c1;
+ real *normm=NULL;
+ output_env_t oenv;
#define NHISTO 360
- t_filenm fnm[] = {
- { efTRN, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffOPTRD },
- { efNDX, NULL, NULL, ffOPTRD },
- { efXVG, "-o", "vac", ffWRITE }
- };
+ t_filenm fnm[] = {
+ { efTRN, "-f", NULL, ffREAD },
+ { efTPS, NULL, NULL, ffOPTRD },
+ { efNDX, NULL, NULL, ffOPTRD },
+ { efXVG, "-o", "vac", ffWRITE },
+ { efXVG, "-os", "spectrum", ffOPTWR }
+ };
#define NFILE asize(fnm)
- int npargs;
- t_pargs *ppa;
-
- CopyRight(stderr,argv[0]);
- npargs = asize(pa);
- ppa = add_acf_pargs(&npargs,pa);
- parse_common_args(&argc,argv,PCA_CAN_VIEW | PCA_CAN_TIME | PCA_BE_NICE,
- NFILE,fnm,npargs,ppa,asize(desc),desc,0,NULL,&oenv);
-
- if (bMol || bM) {
- bTPS = ftp2bSet(efTPS,NFILE,fnm) || !ftp2bSet(efNDX,NFILE,fnm);
- }
-
- if (bTPS) {
- bTop=read_tps_conf(ftp2fn(efTPS,NFILE,fnm),title,&top,&ePBC,NULL,NULL,box,
- TRUE);
- get_index(&top.atoms,ftp2fn_null(efNDX,NFILE,fnm),1,&gnx,&index,&grpname);
- } else
- rd_index(ftp2fn(efNDX,NFILE,fnm),1,&gnx,&index,&grpname);
-
- if (bMol) {
- if (!bTop)
- gmx_fatal(FARGS,"Need a topology to determine the molecules");
- snew(normm,top.atoms.nr);
- precalc(top,normm);
- index_atom2mol(&gnx,index,&top.mols);
- }
+ int npargs;
+ t_pargs *ppa;
+
+ CopyRight(stderr,argv[0]);
+ npargs = asize(pa);
+ ppa = add_acf_pargs(&npargs,pa);
+ parse_common_args(&argc,argv,PCA_CAN_VIEW | PCA_CAN_TIME | PCA_BE_NICE,
+ NFILE,fnm,npargs,ppa,asize(desc),desc,0,NULL,&oenv);
+
+ if (bMol || bMass) {
+ bTPS = ftp2bSet(efTPS,NFILE,fnm) || !ftp2bSet(efNDX,NFILE,fnm);
+ }
+
+ if (bTPS) {
+ bTop=read_tps_conf(ftp2fn(efTPS,NFILE,fnm),title,&top,&ePBC,NULL,NULL,box,
+ TRUE);
+ get_index(&top.atoms,ftp2fn_null(efNDX,NFILE,fnm),1,&gnx,&index,&grpname);
+ } else
+ rd_index(ftp2fn(efNDX,NFILE,fnm),1,&gnx,&index,&grpname);
+
+ if (bMol) {
+ if (!bTop)
+ gmx_fatal(FARGS,"Need a topology to determine the molecules");
+ snew(normm,top.atoms.nr);
+ precalc(top,normm);
+ index_atom2mol(&gnx,index,&top.mols);
+ }
- /* Correlation stuff */
- snew(c1,gnx);
- for(i=0; (i<gnx); i++)
- c1[i]=NULL;
+ /* Correlation stuff */
+ snew(c1,gnx);
+ for(i=0; (i<gnx); i++)
+ c1[i]=NULL;
- read_first_frame(oenv,&status,ftp2fn(efTRN,NFILE,fnm),&fr,TRX_NEED_V);
- t0=fr.time;
+ read_first_frame(oenv,&status,ftp2fn(efTRN,NFILE,fnm),&fr,TRX_NEED_V);
+ t0=fr.time;
- n_alloc=0;
- teller=0;
- do {
- if (teller >= n_alloc) {
- n_alloc+=100;
- for(i=0; i<gnx; i++)
- srenew(c1[i],DIM*n_alloc);
- }
- tel3=3*teller;
- if (bMol)
- for(i=0; i<gnx; i++) {
- clear_rvec(mv_mol);
- k=top.mols.index[index[i]];
- l=top.mols.index[index[i]+1];
- for(j=k; j<l; j++) {
- if (bM)
- m = top.atoms.atom[j].m;
- else
- m = normm[j];
- mv_mol[XX] += m*fr.v[j][XX];
- mv_mol[YY] += m*fr.v[j][YY];
- mv_mol[ZZ] += m*fr.v[j][ZZ];
- }
- c1[i][tel3+XX]=mv_mol[XX];
- c1[i][tel3+YY]=mv_mol[YY];
- c1[i][tel3+ZZ]=mv_mol[ZZ];
- }
- else
- for(i=0; i<gnx; i++) {
- if (bM)
- m = top.atoms.atom[index[i]].m;
- else
- m = 1;
- c1[i][tel3+XX]=m*fr.v[index[i]][XX];
- c1[i][tel3+YY]=m*fr.v[index[i]][YY];
- c1[i][tel3+ZZ]=m*fr.v[index[i]][ZZ];
- }
+ n_alloc=0;
+ counter=0;
+ do {
+ if (counter >= n_alloc) {
+ n_alloc+=100;
+ for(i=0; i<gnx; i++)
+ srenew(c1[i],DIM*n_alloc);
+ }
+ counter_dim=DIM*counter;
+ if (bMol)
+ for(i=0; i<gnx; i++) {
+ clear_rvec(mv_mol);
+ k=top.mols.index[index[i]];
+ l=top.mols.index[index[i]+1];
+ for(j=k; j<l; j++) {
+ if (bMass)
+ mass = top.atoms.atom[j].m;
+ else
+ mass = normm[j];
+ mv_mol[XX] += mass*fr.v[j][XX];
+ mv_mol[YY] += mass*fr.v[j][YY];
+ mv_mol[ZZ] += mass*fr.v[j][ZZ];
+ }
+ c1[i][counter_dim+XX]=mv_mol[XX];
+ c1[i][counter_dim+YY]=mv_mol[YY];
+ c1[i][counter_dim+ZZ]=mv_mol[ZZ];
+ }
+ else
+ for(i=0; i<gnx; i++) {
+ if (bMass)
+ mass = top.atoms.atom[index[i]].m;
+ else
+ mass = 1;
+ c1[i][counter_dim+XX]=mass*fr.v[index[i]][XX];
+ c1[i][counter_dim+YY]=mass*fr.v[index[i]][YY];
+ c1[i][counter_dim+ZZ]=mass*fr.v[index[i]][ZZ];
+ }
- t1=fr.time;
+ t1=fr.time;
- teller ++;
- } while (read_next_frame(oenv,status,&fr));
+ counter ++;
+ } while (read_next_frame(oenv,status,&fr));
- close_trj(status);
+ close_trj(status);
- do_autocorr(ftp2fn(efXVG,NFILE,fnm), oenv,
- bM ?
- "Momentum Autocorrelation Function" :
- "Velocity Autocorrelation Function",
- teller,gnx,c1,(t1-t0)/(teller-1),eacVector,TRUE);
-
- do_view(oenv,ftp2fn(efXVG,NFILE,fnm),"-nxy");
-
- thanx(stderr);
-
- return 0;
+ if (counter >= 4)
+ {
+ /* Compute time step between frames */
+ dt = (t1-t0)/(counter-1);
+ do_autocorr(opt2fn("-o",NFILE,fnm), oenv,
+ bMass ?
+ "Momentum Autocorrelation Function" :
+ "Velocity Autocorrelation Function",
+ counter,gnx,c1,dt,eacVector,TRUE);
+
+ do_view(oenv,opt2fn("-o",NFILE,fnm),"-nxy");
+
+ if (opt2bSet("-os",NFILE,fnm)) {
+ calc_spectrum(counter/2,(real *) (c1[0]),(t1-t0)/2,opt2fn("-os",NFILE,fnm),
+ oenv,bRecip);
+ do_view(oenv,opt2fn("-os",NFILE,fnm),"-nxy");
+ }
+ }
+ else {
+ fprintf(stderr,"Not enough frames in trajectory - no output generated.\n");
+ }
+
+ thanx(stderr);
+
+ return 0;
}
sfree(win);
}
-/* Return j such that xx[j] <= x < xx[j+1] */
-void searchOrderedTable(double xx[], int n, double x, int *j)
-{
- int ju,jm,jl;
- int ascending;
-
- jl=-1;
- ju=n;
- ascending=(xx[n-1] > xx[0]);
- while (ju-jl > 1)
- {
- jm=(ju+jl) >> 1;
- if ((x >= xx[jm]) == ascending)
- jl=jm;
- else
- ju=jm;
- }
- if (x==xx[0]) *j=0;
- else if (x==xx[n-1]) *j=n-2;
- else *j=jl;
-}
-
/* Read and setup tabulated umbrella potential */
void setup_tab(const char *fn,t_UmbrellaOptions *opt)
{
return pipe;
}
-
-FILE *open_pdo_pipe_gmx(const char *fn)
-{
- char *fnNoGz=0;
- FILE *pipe;
-
- /* gzipped pdo file? */
- if (strcmp(fn+strlen(fn)-3,".gz")==0)
- {
- snew(fnNoGz,strlen(fn));
- strncpy(fnNoGz,fn,strlen(fn)-3);
- fnNoGz[strlen(fn)-3]='\0';
- if (gmx_fexist(fnNoGz) && gmx_fexist(fn))
- gmx_fatal(FARGS,"Found file %s and %s. That confuses me. Please remove one of them\n",
- fnNoGz,fn);
- pipe=ffopen(fnNoGz,"r");
- sfree(fnNoGz);
- }
- else
- {
- pipe=ffopen(fn,"r");
- }
-
- return pipe;
-}
-
void pdo_close_file(FILE *fp)
{
#ifdef HAVE_PIPES
#endif
}
-
/* Reading pdo files */
void read_pdo_files(char **fn, int nfiles, t_UmbrellaHeader* header,
t_UmbrellaWindow *window, t_UmbrellaOptions *opt)
#include "smalloc.h"
#include "bondf.h"
-int nhelix(int nres,t_bb bb[])
-{
- int i,n;
-
- for(i=n=0; (i<nres); i++)
- if (bb[i].bHelix)
- n++;
- return n;
-}
-
real ellipticity(int nres,t_bb bb[])
{
typedef struct {
return v-nl;
}
-static double *dvector(int nl, int nh)
-{
- double *v;
-
- v=(double *)malloc((unsigned) (nh-nl+1)*sizeof(double));
- if (!v) nrerror("allocation failure in dvector()", TRUE);
- return v-nl;
-}
-
-
static real **matrix1(int nrl, int nrh, int ncl, int nch)
{
free((char*) (m+nrl));
}
-static void free_dmatrix(double **m, int nrl, int nrh, int ncl)
-{
- int i;
-
- for(i=nrh;i>=nrl;i--) free((char*) (m[i]+ncl));
- free((char*) (m+nrl));
-}
-
-static void free_imatrix(int **m, int nrl, int nrh, int ncl)
-{
- int i;
-
- for(i=nrh;i>=nrl;i--) free((char*) (m[i]+ncl));
- free((char*) (m+nrl));
-}
-
-
-
-static void free_submatrix(real **b, int nrl)
-{
- free((char*) (b+nrl));
-}
-
-
-
static real **convert_matrix(real *a, int nrl, int nrh, int ncl, int nch)
{
int i,j,nrow,ncol;
+++ /dev/null
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: libgmxana
-Description: Gromacs analysis lib
-URL: http://www.gromacs.org
-Version: @VERSION@
-Requires: @PKG_GSL@ libgmx@LIBSUFFIX@ libmd@LIBSUFFIX@
-Libs: -L${libdir} -lgmxana@LIBSUFFIX@ @PTHREAD_CFLAGS@ @PTHREAD_LIBS@ -lm
-Cflags: -I${includedir} @PTHREAD_CFLAGS@ @PKG_CFLAGS@
-
/* format error occured */
case sError:
- gmx_fatal(FARGS,"Error in the list of eigenvectors for %s at pos %d with char %c",listname,pos-startpos,*(pos-1));
-
+ gmx_fatal(FARGS,"Error in the list of eigenvectors for %s at pos %d with char %c",listname,pos-startpos,*(pos-1));
+ break;
/* logical error occured */
case sZero:
- gmx_fatal(FARGS,"Error in the list of eigenvectors for %s at pos %d: eigenvector 0 is not valid",listname,pos-startpos);
+ gmx_fatal(FARGS,"Error in the list of eigenvectors for %s at pos %d: eigenvector 0 is not valid",listname,pos-startpos);
+ break;
case sSmaller:
- gmx_fatal(FARGS,"Error in the list of eigenvectors for %s at pos %d: second index %d is not bigger than %d",listname,pos-startpos,end_number,number);
-
+ gmx_fatal(FARGS,"Error in the list of eigenvectors for %s at pos %d: second index %d is not bigger than %d",listname,pos-startpos,end_number,number);
+ break;
}
++pos; /* read next character */
} /*scanner has finished */
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <math.h>
-#include "typedefs.h"
-#include "random.h"
-#include "mcprop.h"
-#include "smalloc.h"
-#include "vec.h"
-#include "futil.h"
-
-void normalise_vec(int nx,real x[])
-{
- real fac,nnorm;
- int j;
-
- /* Normalise vector */
- nnorm=0.0;
- for(j=0; (j<nx); j++)
- nnorm+=x[j]*x[j];
- fac=1.0/sqrt(nnorm);
- for(j=0; (j<nx); j++)
- x[j]*=fac;
-}
-
-static real do_step(int nx,real x[],int i,int *ig,real step,gmx_bool bPlus)
-{
- static real r=0;
-
- /* Modify a coordinate */
- if (bPlus)
- r = rando(ig)*step;
- else
- r = -r;
- x[i] += r;
-
- normalise_vec(nx,x);
-
- return r;
-}
-
-real find_min(real x0,real x1,real x2,real y0,real y1,real y2)
-{
- matrix X,X_1;
- rvec y;
- rvec abc;
- real a2_1,wortel,xx0,yy0,XXX;
-
- X[0][0]=x0*x0, X[0][1]=x0, X[0][2]=1;
- X[1][0]=x1*x1, X[1][1]=x1, X[1][2]=1;
- X[2][2]=x2*x2, X[2][1]=x2, X[2][2]=1;
- y[0]=y0, y[1]=y1, y[2]=y2;
-
- m_inv(X,X_1);
- mvmul(X_1,y,abc);
-
- if (abc[0] > 0) {
- /* There IS a minimum */
- xx0 = -abc[1]/(2.0*abc[0]);
- if ((x0 < xx0) && (xx0 < x1))
- XXX = xx0;
- else {
- /* The minimum is not on our interval */
- if (xx0 < x0)
- XXX = x0;
- else
- XXX = x2;
- }
- }
- else if (abc[0] < 0) {
- if (y0 < y2)
- XXX = x0;
- else
- XXX = x2;
- }
- else
- XXX = x1;
-
- return XXX;
-}
-
-void do_mc(FILE *fp,int nx,real x[],real step,real v0,real tol,
- int maxsteps,t_propfunc *func)
-{
- FILE *ffp[2];
- FILE *ftrj;
- int i,j,k,m,f,n,ig,cur=0;
- gmx_bool bConv,bUp;
- real vtol,r,bmf,*rx[2],valmin,vplusmin[2],stepsize;
- double dv,val[2];
-#define next (1-cur)
-
- snew(rx[cur], nx);
- snew(rx[next],nx);
- ffp[0]=fp;
- ffp[1]=stderr;
-
- ftrj=ffopen("ftrj.out","w");
-
- for(j=0; (j<nx); j++)
- rx[cur][j]=x[j];
-
- /* Random seed */
- ig = 1993;
-
- /* Initial value */
- val[cur] = func(nx,x);
- vtol = tol*v0;
-
- for(f=0; (f<2); f++) {
- fprintf(ffp[f],"Starting MC in property space, YES!\n\n");
- fprintf(ffp[f],"Initial value: %10.3e\n",val[cur]);
- fprintf(ffp[f],"Going to do %d steps in %dD space\n",maxsteps,nx);
- }
- bConv=FALSE;
- valmin=val[cur];
- for(n=0; (n<maxsteps) && !bConv; ) {
- for(i=0; (i<nx) && !bConv; i++,n++) {
-
- for(m=0; (m<2); m++) {
- for(j=0; (j<nx); j++)
- rx[next][j]=rx[cur][j];
- stepsize=do_step(nx,rx[next],i,&ig,step,1-m);
- vplusmin[m]=func(nx,rx[next]);
- }
- for(j=0; (j<nx); j++)
- rx[next][j]=rx[cur][j];
- rx[next][i]=find_min(rx[cur][i]+stepsize,rx[cur][i],rx[cur][i]-stepsize,
- vplusmin[0],val[cur],vplusmin[1]);
- normalise_vec(nx,rx[next]);
- val[next]=func(nx,rx[next]);
-
- bmf=0;
- bUp=FALSE;
- dv=val[next]-val[cur];
- if (dv < 0) {
- cur=next;
- if (val[cur] < valmin)
- valmin=val[cur];
- for(k=0; (k<nx); k++) {
- x[k]=rx[cur][k];
- fprintf(ftrj,"%6.3f ",x[k]);
- }
- fprintf(ftrj,"\n");
- }
- if ((fabs(dv) < vtol) && (val[cur]<=valmin))
- bConv=TRUE;
- else if ((dv >= 0) && (v0 > 0)) {
- r=rando(&ig);
- bmf=exp(-dv/v0);
- if (bmf < r) {
- cur=next;
- bUp=TRUE;
- }
- }
- for(f=0; (f<2); f++)
- fprintf(ffp[f],"Step %5d, Min: %10.3e, Cur: %10.3e, BMF %6.3f %s\n",
- n,valmin,val[cur],bmf,bUp ? "+" : "");
- }
- }
- if (bConv) {
- fprintf(fp,"Converged !\n");
- fprintf(stderr,"Converged !\n");
- }
- ffclose(ftrj);
-}
-
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-#include "typedefs.h"
-
-typedef real t_propfunc(int nx,real x[]);
-
-extern void do_mc(FILE *fp,int nx,real x[],real step,real v0,real tol,
- int maxsteps,t_propfunc *f);
-
if (opt[0] == 'a') {
*mult = 3;
for(ftype=0; ftype<F_NRE; ftype++) {
- if (interaction_function[ftype].flags & IF_ATYPE ||
+ if ((interaction_function[ftype].flags & IF_ATYPE) ||
ftype == F_TABANGLES) {
(*nft)++;
srenew(ft,*nft);
--- /dev/null
+/*
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * VERSION 3.2.0
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2004, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ *
+ * And Hey:
+ * GROningen Mixture of Alchemy and Childrens' Stories
+ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <ctype.h>
+#include <string.h>
+#include "futil.h"
+#include "gmx_random.h"
+#include "smalloc.h"
+#include "sysstuff.h"
+#include "strdb.h"
+#include "vec.h"
+#include "nsfactor.h"
+
+void normalize_probability(int n,double *a){
+ int i;
+ double norm=0.0;
+ for (i=0;i<n;i++) norm +=a[i];
+ for (i=0;i<n;i++) a[i]/=norm;
+}
+
+gmx_nentron_atomic_structurefactors_t *gmx_neutronstructurefactors_init(const char *datfn) {
+ /* read nsfactor.dat */
+ FILE *fp;
+ char line[STRLEN];
+ int nralloc=10;
+ int n,p;
+ int i, line_no;
+ char atomnm[8];
+ double slength;
+ gmx_nentron_atomic_structurefactors_t *gnsf;
+
+ fp=libopen(datfn);
+ line_no = 0;
+ /* allocate memory for structure */
+ snew(gnsf,nralloc);
+ snew(gnsf->atomnm,nralloc);
+ snew(gnsf->p,nralloc);
+ snew(gnsf->n,nralloc);
+ snew(gnsf->slength,nralloc);
+
+ gnsf->nratoms=line_no;
+
+ while(get_a_line(fp,line,STRLEN)) {
+ i=line_no;
+ if (sscanf(line,"%s %d %d %lf",atomnm,&p,&n,&slength) == 4) {
+ gnsf->atomnm[i]=strdup(atomnm);
+ gnsf->n[i]=n;
+ gnsf->p[i]=p;
+ gnsf->slength[i]=slength;
+ line_no++;
+ gnsf->nratoms=line_no;
+ if (line_no==nralloc){
+ nralloc++;
+ srenew(gnsf->atomnm,nralloc);
+ srenew(gnsf->p,nralloc);
+ srenew(gnsf->n,nralloc);
+ srenew(gnsf->slength,nralloc);
+ }
+ } else
+ fprintf(stderr,"WARNING: Error in file %s at line %d ignored\n",
+ datfn,line_no);
+ }
+ srenew(gnsf->atomnm,gnsf->nratoms);
+ srenew(gnsf->p,gnsf->nratoms);
+ srenew(gnsf->n,gnsf->nratoms);
+ srenew(gnsf->slength,gnsf->nratoms);
+
+ fclose(fp);
+
+ return (gmx_nentron_atomic_structurefactors_t *) gnsf;
+}
+
+gmx_sans_t *gmx_sans_init (t_topology *top, gmx_nentron_atomic_structurefactors_t *gnsf) {
+ gmx_sans_t *gsans=NULL;
+ int i,j;
+ /* Try to assing scattering length from nsfactor.dat */
+ snew(gsans,1);
+ snew(gsans->slength,top->atoms.nr);
+ /* copy topology data */
+ gsans->top = top;
+ for(i=0;i<top->atoms.nr;i++) {
+ for(j=0;j<gnsf->nratoms;j++) {
+ if(top->atoms.atom[i].atomnumber == gnsf->p[j]) {
+ /* we need special case for H and D */
+ if(top->atoms.atom[i].atomnumber == 1) {
+ if(top->atoms.atom[i].m == 1.008000) {
+ gsans->slength[i] = gnsf->slength[0];
+ } else
+ gsans->slength[i] = gnsf->slength[1];
+ } else
+ gsans->slength[i] = gnsf->slength[j];
+ }
+ }
+ }
+
+ return (gmx_sans_t *) gsans;
+}
+
+gmx_radial_distribution_histogram_t *calc_radial_distribution_histogram (gmx_sans_t *gsans, rvec *x, atom_id *index, int isize, double binwidth, gmx_bool bMC, gmx_large_int_t nmc, unsigned int seed) {
+ gmx_radial_distribution_histogram_t *pr=NULL;
+ rvec xmin, xmax;
+ double rmax;
+ int i,j,d;
+ int mc;
+ gmx_rng_t rng=NULL;
+
+ /* allocate memory for pr */
+ snew(pr,1);
+ /* set some fields */
+ pr->binwidth=binwidth;
+
+ /* Lets try to find min and max distance */
+ for(d=0;d<3;d++) {
+ xmax[d]=x[index[0]][d];
+ xmin[d]=x[index[0]][d];
+ }
+
+ for(i=1;i<isize;i++)
+ for(d=0;d<3;d++)
+ if (xmax[d]<x[index[i]][d]) xmax[d]=x[index[i]][d]; else
+ if (xmin[d]>x[index[i]][d]) xmin[d]=x[index[i]][d];
+
+ rmax=sqrt(distance2(xmax,xmin));
+
+ pr->grn=(int)floor(rmax/pr->binwidth)+1;
+ rmax=pr->grn*pr->binwidth;
+
+ snew(pr->gr,pr->grn);
+
+ if(bMC) {
+ /* Use several independent mc runs to collect better statistics */
+ for(d=0;d<(int)floor(nmc/524288);d++) {
+ rng=gmx_rng_init(seed);
+ for(mc=0;mc<524288;mc++) {
+ i=(int)floor(gmx_rng_uniform_real(rng)*isize);
+ j=(int)floor(gmx_rng_uniform_real(rng)*isize);
+ if(i!=j)
+ pr->gr[(int)floor(sqrt(distance2(x[index[i]],x[index[j]]))/binwidth)]+=gsans->slength[index[i]]*gsans->slength[index[j]];
+ }
+ gmx_rng_destroy(rng);
+ }
+ } else {
+ for(i=0;i<isize;i++)
+ for(j=0;j<i;j++)
+ pr->gr[(int)floor(sqrt(distance2(x[index[i]],x[index[j]]))/binwidth)]+=gsans->slength[index[i]]*gsans->slength[index[j]];
+ }
+
+ /* normalize */
+ normalize_probability(pr->grn,pr->gr);
+ snew(pr->r,pr->grn);
+ for(i=0;i<pr->grn;i++)
+ pr->r[i]=(pr->binwidth*i+pr->binwidth*0.5);
+
+ return (gmx_radial_distribution_histogram_t *) pr;
+}
+
+gmx_static_structurefator_t *convert_histogram_to_intensity_curve (gmx_radial_distribution_histogram_t *pr, double start_q, double end_q, double q_step) {
+ gmx_static_structurefator_t *sq=NULL;
+ int i,j;
+ /* init data */
+ snew(sq,1);
+ sq->qn=(int)floor((end_q-start_q)/q_step);
+ snew(sq->q,sq->qn);
+ snew(sq->s,sq->qn);
+ for(i=0;i<sq->qn;i++)
+ sq->q[i]=start_q+i*q_step;
+
+ if(start_q==0.0) {
+ sq->s[0]=1.0;
+ for(i=1;i<sq->qn;i++) {
+ for(j=0;j<pr->grn;j++)
+ sq->s[i]+=(pr->gr[j]/pr->r[j])*sin(sq->q[i]*pr->r[j]);
+ sq->s[i] /= sq->q[i];
+ }
+ } else {
+ for(i=0;i<sq->qn;i++) {
+ for(j=0;j<pr->grn;j++)
+ sq->s[i]+=(pr->gr[j]/pr->r[j])*sin(sq->q[i]*pr->r[j]);
+ sq->s[i] /= sq->q[i];
+ }
+ }
+
+ return (gmx_static_structurefator_t *) sq;
+}
--- /dev/null
+/*
+ *
+ * This source code is part of
+ *
+ * G R O M A C S
+ *
+ * GROningen MAchine for Chemical Simulations
+ *
+ * VERSION 3.2.0
+ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2004, The GROMACS development team,
+ * check out http://www.gromacs.org for more information.
+
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ *
+ * For more info, check our website at http://www.gromacs.org
+ *
+ * And Hey:
+ * Gromacs Runs On Most of All Computer Systems
+ */
+
+#ifndef _nsfactor_h
+#define _nsfactor_h
+
+#include "index.h"
+#include "types/simple.h"
+#include "gmxcomplex.h"
+#include "oenv.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct gmx_nentron_atomic_structurefactors_t {
+ int nratoms;
+ int *p; /* proton number */
+ int *n; /* neuton number */
+ double *slength; /* scattering length in fm */
+ char **atomnm; /* atom symbol */
+} gmx_nentron_atomic_structurefactors_t;
+
+typedef struct gmx_sans_t {
+ t_topology *top; /* topology */
+ double *slength; /* scattering length for this topology */
+} gmx_sans_t;
+
+typedef struct gmx_radial_distribution_histogram_t {
+ int grn; /* number of bins */
+ double binwidth; /* bin size */
+ double *r; /* Distances */
+ double *gr; /* Probability */
+} gmx_radial_distribution_histogram_t;
+
+typedef struct gmx_static_structurefator_t {
+ int qn; /* number of items */
+ double *s; /* scattering */
+ double *q; /* q vectors */
+ double qstep; /* q increment */
+} gmx_static_structurefator_t;
+
+void normalize_probability(int n, double *a);
+
+gmx_nentron_atomic_structurefactors_t *gmx_neutronstructurefactors_init(const char *datfn);
+
+gmx_sans_t *gmx_sans_init(t_topology *top, gmx_nentron_atomic_structurefactors_t *gnsf);
+
+gmx_radial_distribution_histogram_t *calc_radial_distribution_histogram ( gmx_sans_t *gsans,
+ rvec *x, atom_id *index,
+ int isize,
+ double binwidth,
+ gmx_bool bMC,
+ gmx_large_int_t nmc,
+ unsigned int seed);
+
+gmx_static_structurefator_t *convert_histogram_to_intensity_curve (gmx_radial_distribution_histogram_t *pr, double start_q, double end_q, double q_step);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include "typedefs.h"
-#include "maths.h"
-#include "string2.h"
-#include "hxprops.h"
-#include "gmx_fatal.h"
-#include "futil.h"
-#include "smalloc.h"
-#include "readev.h"
-#include "macros.h"
-#include "confio.h"
-#include "copyrite.h"
-#include "statutil.h"
-#include "mcprop.h"
-#include "orise.h"
-
-void optimize(FILE *fp,int nx,t_propfunc *f,t_pinp *p)
-{
- real *fact,sf;
- int i;
-
- snew(fact,nx);
- sf=0.0;
- for(i=0; (i<nx); i++) {
- fact[i]=1.0/(i+2.0);
- sf+=fact[i]*fact[i];
- }
- for(i=0; (i<nx); i++)
- fact[i]/=sqrt(sf);
-
- do_mc(fp,nx,fact,p->step,p->v0,p->tol,p->nsteps,f);
-
- fprintf(fp,"MC Done\n");
- fprintf(fp,"Components are:\n");
- sf=0.0;
- for(i=0; (i<nx); i++) {
- fprintf(fp,"EV %5d: Fac: %8.3f\n",i,fact[i]);
- sf+=fact[i]*fact[i];
- }
- fprintf(fp,"Norm of vector: %8.3f\n",sqrt(sf));
-}
-
-static rvec *xav;
-static rvec **EV;
-static real **evprj;
-static int nca,natoms,nframes;
-static atom_id *ca_index;
-
-real risefunc(int nx,real x[])
-{
- static rvec *xxx=NULL;
- real cx,cy,cz;
- double rrr,rav2,rav;
- int i,j,m,n,ai;
-
- if (xxx == NULL)
- snew(xxx,natoms);
-
- rav2=0,rav=0;
-
- for(j=0; (j<nframes); j++) {
- /* Make a structure, we only have to do Z */
- for(i=0; (i<nca); i++) {
- ai=ca_index[i];
- /*cx=xav[ai][XX];
- cy=xav[ai][YY];*/
- cz=xav[ai][ZZ];
- for(n=0; (n<nx); n++) {
- /*cx+=EV[n][ai][XX]*x[n]*evprj[n][j];
- cy+=EV[n][ai][YY]*x[n]*evprj[n][j];*/
- cz+=EV[n][ai][ZZ]*x[n]*evprj[n][j];
- }
- /*xxx[ai][XX]=cx;
- xxx[ai][YY]=cy;*/
- xxx[ai][ZZ]=cz;
- }
- rrr = rise(nca,ca_index,xxx);
- rav += rrr;
- rav2 += rrr*rrr;
- }
- rav/=nframes;
- rrr=sqrt(rav2/nframes-rav*rav);
-
- return -rrr;
-}
-
-real radfunc(int nx,real x[])
-{
- static rvec *xxx=NULL;
- real cx,cy,cz;
- double rrr,rav2,rav;
- int i,j,m,n,ai;
-
- if (xxx == NULL)
- snew(xxx,natoms);
-
- rav2=0,rav=0;
-
- for(j=0; (j<nframes); j++) {
- /* Make a structure, we only have to do X & Y */
- for(i=0; (i<nca); i++) {
- ai=ca_index[i];
- cx=xav[ai][XX];
- cy=xav[ai][YY];
- cz=xav[ai][ZZ];
- for(n=0; (n<nx); n++) {
- cx+=EV[n][ai][XX]*x[n]*evprj[n][j];
- cy+=EV[n][ai][YY]*x[n]*evprj[n][j];
- cz+=EV[n][ai][ZZ]*x[n]*evprj[n][j];
- }
- xxx[ai][XX]=cx;
- xxx[ai][YY]=cy;
- xxx[ai][ZZ]=cz;
- }
- rrr = radius(NULL,nca,ca_index,xxx);
- rav += rrr;
- rav2 += rrr*rrr;
- }
- rav/=nframes;
- rrr=sqrt(rav2/nframes-rav*rav);
-
- return -rrr;
-}
-
-void init_optim(int nx,rvec *xxav,rvec **EEV,
- real **eevprj,int nnatoms,
- int nnca,atom_id *cca_index,
- t_pinp *p)
-{
- xav = xxav;
- EV = EEV;
- evprj = eevprj;
- natoms = nnatoms;
- nframes = p->nframes;
- nca = nnca;
- ca_index = cca_index;
-}
-
-void optim_rise(int nx,rvec *xxav,rvec **EEV,
- real **eevprj,int nnatoms,
- int nnca,atom_id *cca_index,
- t_pinp *p)
-{
- FILE *fp;
-
- fp = ffopen("rise.log","w");
- init_optim(nx,xxav,EEV,eevprj,nnatoms,nnca,cca_index,p);
- optimize(fp,nx,risefunc,p);
- ffclose(fp);
-}
-
-void optim_radius(int nx,rvec *xxav,rvec **EEV,
- real **eevprj,int nnatoms,
- int nnca,atom_id *cca_index,
- t_pinp *p)
-{
- FILE *fp;
-
- fp = ffopen("radius.log","w");
-
- init_optim(nx,xxav,EEV,eevprj,nnatoms,nnca,cca_index,p);
- optimize(fp,nx,radfunc,p);
- ffclose(fp);
-}
-
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-#include "typedefs.h"
-#include "pinput.h"
-
-extern void optim_rise(int nx,rvec *xxav,rvec **EEV,
- real **eevprj,int nnatoms,
- int nnca,atom_id *cca_index,
- t_pinp *p);
-
-extern void optim_radius(int nx,rvec *xxav,rvec **EEV,
- real **eevprj,int nnatoms,
- int nnca,atom_id *cca_index,
- t_pinp *p);
-
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "paramio.h"
-#include "pinput.h"
-
-#define PPIN \
- ITYPE("nframes", p->nframes, 1) \
- ETYPE("optimize", p->nSel) \
- "radius", "twist", "rise", "len", "nhx", "dipole", "rms", "cphi", NULL, \
- ETYPE("funct", p->funct) \
- "MC", "RECOMB", "PROPTRJ", NULL, \
- ITYPE("nsteps", p->nsteps, 100) \
- ITYPE("nev", p->nev, 10) \
- ITYPE("nskip", p->nskip, 0) \
- STYPE("projection", p->base, "WEDPRJVEC10.DAT") \
- STYPE("recomb", p->recomb, "WEDRECOMB10.DAT") \
- STYPE("gamma", p->gamma, "WEDGAMMA10.DAT") \
- RTYPE("stepsize", p->step, 0.1) \
- RTYPE("tolerance", p->tol, 1e-6) \
- RTYPE("ref-fluc", p->v0, 1e-3) \
- NULL
-
-void read_inp(char *fnin,char *fnout,t_pinp *p)
-{
- read_params(fnin,PPIN);
- write_params(fnout,PPIN);
-}
extern void get_chi_product_traj (real **dih,int nframes,int nangles,
int nlist,int maxchi, t_dlist dlist[], real time[],
- int **lookup,int *xity,gmx_bool bRb,gmx_bool bNormalize,
+ int **lookup,int *multiplicity,gmx_bool bRb,gmx_bool bNormalize,
real core_frac);
#endif
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "typedefs.h"
-#include "maths.h"
-#include "string2.h"
-#include "hxprops.h"
-#include "gmx_fatal.h"
-#include "futil.h"
-#include "smalloc.h"
-#include "readev.h"
-#include "macros.h"
-#include "confio.h"
-#include "copyrite.h"
-#include "statutil.h"
-#include "orise.h"
-#include "pinput.h"
-#include "recomb.h"
-
-void calc_prj(int natoms,rvec xav[],rvec x[],rvec ev[],real eprj)
-{
- int i,m;
-
- for(i=0; (i<natoms); i++) {
- for(m=0; (m<DIM); m++)
- x[i][m]=xav[i][m]+ev[i][m]*eprj;
- }
-}
-
-void mkptrj(char *prop,int nSel,
- int natoms,rvec xav[],int nframes,
- int nev,rvec **EV,real **evprj,
- int nca,atom_id ca_index[],atom_id bb_index[],
- t_atom atom[],matrix box)
-{
- FILE *out;
- char buf[256];
- double propje,*pav,*pav2;
- int i,j;
- rvec *xxx;
-
- snew(pav,nev);
- snew(pav2,nev);
- snew(xxx,natoms);
-
- sprintf(buf,"%s.trj1",prop);
- out=ffopen(buf,"w");
- fprintf(out,"Projection of %s on EigenVectors\n",prop);
- for(j=0; (j<nframes); j++) {
- if ((j % 10) == 0)
- fprintf(stderr,"\rFrame %d",j);
- for(i=0; (i<nev); i++) {
- calc_prj(natoms,xav,xxx,EV[i],evprj[i][j]);
- switch (nSel) {
- case efhRAD:
- propje=radius(NULL,nca,ca_index,xxx);
- break;
- case efhLEN:
- propje=ahx_len(nca,ca_index,xxx,box);
- break;
- case efhTWIST:
- propje=twist(NULL,nca,ca_index,xxx);
- break;
- case efhCPHI:
- propje=ca_phi(nca,ca_index,xxx);
- break;
- case efhDIP:
- propje=dip(natoms,bb_index,xxx,atom);
- break;
- default:
- gmx_fatal(FARGS,"Not implemented");
- }
- pav[i]+=propje;
- pav2[i]+=propje*propje;
- fprintf(out,"%8.3f",propje);
- }
- fprintf(out,"\n");
- }
- ffclose(out);
- fprintf(stderr,"\n");
- for(i=0; (i<nev); i++) {
- printf("ev %2d, average: %8.3f rms: %8.3f\n",
- i+1,pav[i]/nframes,sqrt(pav2[i]/nframes-sqr(pav[i]/nframes)));
- }
- sfree(pav);
- sfree(pav2);
- sfree(xxx);
-}
-
-void proptrj(char *fngro,char *fndat,t_topology *top,t_pinp *p)
-{
- static char *ppp[efhNR] = {
- "RAD", "TWIST", "RISE", "LEN", "NHX", "DIP", "RMS", "CPHI",
- "RMSA", "PHI", "PSI", "HB3", "HB4", "HB5"
- };
- FILE *out;
- rvec **EV;
- real **evprj;
- atom_id *index;
- int natoms,nca,nSel,nframes,nev;
- rvec *xav,*vav;
- atom_id *ca_index,*bb_index;
- matrix box;
- char buf[256],*prop;
- double x;
- int i,j,d;
-
- nframes = p->nframes;
- nSel = p->nSel;
- nev = p->nev;
-
- prop=ppp[nSel];
- evprj=read_proj(nev,nframes,p->base);
-
- get_coordnum(fngro,&natoms);
- snew(xav,natoms);
- snew(vav,natoms);
- read_conf(fngro,buf,&natoms,xav,vav,box);
- fprintf(stderr,"Successfully read average positions (%s)\n",buf);
-
- EV=read_ev(fndat,natoms);
-
- fprintf(stderr,"Successfully read eigenvectors\n");
-
- snew(index,nev);
- for(i=0; (i<nev); i++)
- index[i]=i;
- snew(bb_index,natoms);
- for(i=0; (i<natoms); i++)
- bb_index[i]=i;
- snew(ca_index,natoms);
- for(i=nca=0; (i<natoms); i++)
- if ((strcmp("CA",*(top->atoms.atomname[i])) == 0))
- ca_index[nca++]=i;
-
- switch (p->funct) {
- case ptMC:
- switch(nSel) {
- case efhRAD:
- optim_radius(nev,xav,EV,evprj,natoms,nca,ca_index,p);
- break;
- case efhRISE:
- optim_rise(nev,xav,EV,evprj,natoms,nca,ca_index,p);
- break;
- default:
- break;
- }
- break;
- case ptREC:
- recombine(p->recomb,p->gamma,p->nskip,nframes,nev,natoms,
- EV,evprj,xav,bb_index);
- break;
- case ptPTRJ:
- mkptrj(prop,nSel,natoms,xav,nframes,
- nev,EV,evprj,nca,ca_index,bb_index,
- top->atoms.atom,box);
- break;
- default:
- gmx_fatal(FARGS,"I Don't Know What to Do");
- }
-}
-
-int main(int argc,char *argv[])
-{
- const char *desc[] = {
- "proptrj"
- };
- t_manual man = { asize(desc),desc,0,NULL,NULL,0,NULL};
-
- t_filenm fnm[] = {
- { efGRO, "-c", "aver",FALSE },
- { efDAT, "-d", "eigenvec", FALSE },
- { efTPX, NULL, NULL, FALSE },
- { efDAT, "-pi","pinp", FALSE },
- { efDAT, "-po","poutp", FALSE }
- };
-#define NFILE asize(fnm)
- t_topology *top;
- t_pinp *p;
-
- CopyRight(stderr,argv[0]);
- parse_common_args(&argc,argv,PCA_CAN_VIEW | PCA_CAN_TIME,
- NFILE,fnm,TRUE,&man);
-
- top=read_top(ftp2fn(efTPX,NFILE,fnm));
- init_debug("proptim.dbg",0);
- snew(p,1);
- read_inp(opt2fn("-pi",NFILE,fnm),opt2fn("-po",NFILE,fnm),p);
-
- proptrj(ftp2fn(efGRO,NFILE,fnm),ftp2fn(efDAT,NFILE,fnm),top,p);
-
- thanx(stderr);
-
- return 0;
-}
-
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "readev.h"
-#include "futil.h"
-#include "smalloc.h"
-
-rvec **read_ev(char *fn,int natoms)
-{
- FILE *in;
- rvec **ev;
- double xx,yy,zz;
- int i,j,k,ei,ai;
-
- snew(ev,DIM*natoms);
- for(i=0; (i<DIM*natoms); i++)
- snew(ev[i],natoms);
- in=ffopen(fn,"r");
- for(i=0; (i<DIM*natoms); i++) {
- for(j=k=0; (j<natoms); j++) {
- fscanf(in,"%d%d%lf%lf%lf",&ei,&ai,&xx,&yy,&zz);
- ev[i][j][XX]=xx;
- ev[i][j][YY]=yy;
- ev[i][j][ZZ]=zz;
- }
- }
- ffclose(in);
-
- return ev;
-}
-
-real **read_proj(int nev,int nframes,char *base)
-{
- FILE *in;
- real **evprj;
- char buf[256];
- int i,j,d;
- double x;
-
- snew(evprj,nev);
- for(i=0; (i<nev); i++) {
- fprintf(stderr,"\rEV %d",i);
- snew(evprj[i],nframes);
- sprintf(buf,"%s%d",base,i+1);
- in=ffopen(buf,"r");
- for(j=0; (j<nframes); j++) {
- fscanf(in,"%d%lf",&d,&x);
- evprj[i][j]=x;
- }
- ffclose(in);
- }
- fprintf(stderr,"\rSuccessfully read eigenvector projections\n");
-
- return evprj;
-}
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-#include "typedefs.h"
-
-#ifndef _readev_h
-#define _readev_h
-
-extern rvec **read_ev(char *fn,int natoms);
-/* Read eigenvectors from file fn */
-
-extern real **read_proj(int nev,int nframes,char *base);
-/* Read the projections of a traj onto ev from files base1 thru basenev */
-
-#endif
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "recomb.h"
-#include "futil.h"
-#include "wgms.h"
-#include "smalloc.h"
-
-real *read_gammaf(char *fn,int nframes)
-{
- FILE *in;
- real *gf;
- double y;
- int i;
-
- snew(gf,nframes);
- in=ffopen(fn,"r");
- for(i=0; (i<nframes); i++) {
- fscanf(in,"%lf",&y);
- gf[i]=y;
- }
- ffclose(in);
- fprintf(stderr,"Successfully read gamma\n");
- return gf;
-}
-
-void recombine(char *base,char *gammaf,int nskip,
- int nframes,int nev,int natoms,
- rvec *ev[],real *evprj[],
- rvec yav[],atom_id all_index[])
-{
- static char *format=
- "Recombined projection of Gamma trj (EV %d) in Cartesian Space\n";
- FILE *out;
- rvec *xxx,*evptr;
- real *gamma;
- real prj;
- char buf[256];
- int i,j,n;
- real gt;
-
- gamma=read_gammaf(gammaf,nframes);
- snew(xxx,natoms);
- for(n=0; (n<nev); n++) {
- sprintf(buf,"%s%d",base,n+1);
- out=ffopen(buf,"w");
- fprintf(out,format,n+1);
- fprintf(stderr,format,n+1);
- evptr=ev[n];
-
- for(j=0; (j<nframes); j++) {
- if ((j % 50) == 0)
- fprintf(stderr,"\r frame %d",j);
- if ((nskip == 0) || ((j % nskip) == 0)) {
- gt=1.0/gamma[j];
- prj=evprj[n][j];
- for(i=0; (i<natoms); i++) {
- xxx[i][XX]=(yav[i][XX]+prj*evptr[i][XX])*gt;
- xxx[i][YY]=(yav[i][YY]+prj*evptr[i][YY])*gt;
- xxx[i][ZZ]=(yav[i][ZZ]+prj*evptr[i][ZZ])*gt;
- }
- write_gms_ndx(out,natoms,all_index,xxx,NULL);
- }
- }
- ffclose(out);
- fprintf(stderr,"\r");
- }
- fprintf(stderr,"\n");
- sfree(xxx);
- sfree(gamma);
-}
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-
-#ifndef _recomb_h
-#define _recomb_h
-
-
-#include "typedefs.h"
-
-extern void recombine(char *base,char *gammaf,int nskip,
- int nframes,int nev,int natoms,
- rvec *ev[],real *evprj[],
- rvec yav[],atom_id all_index[]);
-
-#endif
+++ /dev/null
-/*
- *
- * This source code is part of
- *
- * G R O M A C S
- *
- * GROningen MAchine for Chemical Simulations
- *
- * VERSION 3.2.0
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2004, The GROMACS development team,
- * check out http://www.gromacs.org for more information.
-
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- *
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- *
- * For more info, check our website at http://www.gromacs.org
- *
- * And Hey:
- * Green Red Orange Magenta Azure Cyan Skyblue
- */
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include "sysstuff.h"
-#include "matio.h"
-#include "copyrite.h"
-#include "macros.h"
-#include "statutil.h"
-#include "smalloc.h"
-
-int main(int argc,char *argv[])
-{
- const char *desc[] = {
- "sas2mat converts matrix data in [IT]raw[it] format to X PixMap format,",
- "which can be digested by [TT]xpm2ps[tt] to make nice plots.",
- "These [IT]raw[it] data may be generated by [TT]g_rms[tt], [TT]do_dssp[tt] or your",
- "own program.[PAR]",
- "The program prompts the user for some parameters:[PAR]",
- "[TT]Enter nres, res0, nframes, dt, t0, nlevels:[tt][PAR]",
- "In this context nres is the number of residues, res0 the starting residue",
- "dt is the time step, t0 is the starting time, nlevels is the number",
- "of levels for coloring. By default a greyscale colormap is generated."
- };
- static gmx_bool bCol=FALSE;
- static char *title="Area (nm^2)";
- static real ssmin=-1,ssmax=-1,t0=0,dt=1;
- static int nres=1,nframes=1,r0=0,nlevels=20,nskip=0;
- t_pargs pa[] = {
- { "-col", FALSE, etBOOL, &bCol,
- "The user is prompted for rgb lower and upper values" },
- { "-min", FALSE, etREAL, &ssmin,
- "Lower values for the data, calculated from the data by default" },
- { "-max", FALSE, etREAL, &ssmax,
- "Upper values for the data, see above" },
- { "-title", FALSE, etSTR, &title,
- "Title for the graph" },
- { "-nlevel", FALSE, etINT, &nlevels,
- "Number of levels in graph" },
- { "-nres", FALSE, etINT, &nres,
- "Number of residues (Y-axis)" },
- { "-nframes", FALSE, etINT, &nframes,
- "Number of frames (Y-axis)" },
- { "-res0", FALSE, etINT, &r0,
- "Number of first residue" },
- { "-nskip", FALSE, etINT, &nskip,
- "Number of frames to skip after every frame" },
- { "-dt", FALSE, etREAL, &dt,
- "Time between time frames" },
- { "-t0", FALSE, etREAL, &t0,
- "Time of first time frame" }
- };
-
- FILE *in,*out;
- int i,j,k,ihi;
- double s;
- real **ss,lo,hi,s1min,s1max;
- real *resnr,*t;
- gmx_bool bCheck=TRUE;
- t_rgb rlo,rhi;
- t_filenm fnm[] = {
- { efOUT, "-f", "area", ffREAD },
- { efXPM, "-o", "sas", ffWRITE }
- };
-#define NFILE asize(fnm)
-
- /* If we want to read all frames nskip must be greater than zero */
- nskip += 1;
-
- CopyRight(stderr,argv[0]);
-
- parse_common_args(&argc,argv,PCA_BE_NICE,NFILE,fnm,asize(pa),pa,asize(desc),desc,
- 0,NULL);
-
- snew(ss,nres);
- snew(resnr,nres);
- snew(t,nframes);
- for(i=0; (i<nframes); i++)
- t[i]=t0+i*dt;
- for(i=0; (i<nres); i++) {
- snew(ss[i],nframes);
- }
- in=ftp2FILE(efOUT,NFILE,fnm,"r");
- for(i=k=0; (i<nframes); i++) {
- for(j=0; (j<nres); j++) {
- fscanf(in,"%lf",&s);
- ss[j][k]=s;
- }
- if (!nskip || ((i % nskip) == 0))
- k++;
- }
- ffclose(in);
- nframes=k;
-
- lo=10000;
- hi=0;
- for(j=0; (j<nres); j++) {
- /* Find lowest SAS value and subtract that from all occurrences */
- s1min=10000;
- s1max=0;
- for(i=0; (i<nframes); i++) {
- s1min=min(s1min,ss[j][i]);
- s1max=max(s1max,ss[j][i]);
- }
- printf("res %d: ssmin=%g, ssmax=%g, diff=%g\n",j,s1min,s1max,s1max-s1min);
- hi=max(hi,s1max);
- lo=min(lo,s1min);
- }
- printf("Lowest and Highest SAS value: %g %g\n",lo,hi);
-
- if (ssmin == -1)
- ssmin=lo;
- if (ssmax == -1)
- ssmax=hi;
-
- /*
- hi=ssmax-ssmin;
- for(j=0; (j<nres); j++) {
- for(i=0; (i<nframes); i++)
- ss[j][i]-=ssmin;
- }
- */
-
- /* ihi=hi; */
- rhi.r=0,rhi.g=0,rhi.b=0;
- rlo.r=1,rlo.g=1,rlo.b=1;
- if (bCol) {
- printf("Color entries:\n""drlo glo blo rhi ghi bhi\n");
- scanf("%f%f%f%f%f%f",&rlo.r,&rlo.g,&rlo.b,&rhi.r,&rhi.g,&rhi.b);
- }
- /*
- write_mapfile(ftp2fn(efMAP,NFILE,fnm),&nlevels,rlo,rhi,ssmin,ssmax);
- */
-
- for(i=0;i<nres;i++)
- resnr[i]=i+1;
- out=ftp2FILE(efXPM,NFILE,fnm,"w");
- /*
- write_matrix(out,nres,nframes,resnr,t,ss,NULL,title,0,hi,nlevels);
- */
- write_xpm(out,0,"????","????","Time (ps)","Residue",
- nres,nframes,resnr,t,ss,ssmin,ssmax,rlo,rhi,&nlevels);
-
- thanx(stderr);
-
- return 0;
-}