Merge release-5-0 into master
authorRoland Schulz <roland@utk.edu>
Sat, 28 Jun 2014 05:12:35 +0000 (01:12 -0400)
committerRoland Schulz <roland@utk.edu>
Sat, 28 Jun 2014 06:06:41 +0000 (02:06 -0400)
Conflicts:
src/contrib/pmetest.c
src/gromacs/gmxpreprocess/pdb2top.cpp
src/programs/mdrun/repl_ex.cpp

Fixed minor issues in:
src/gromacs/gmxana/gmx_principal.c
src/gromacs/gmxlib/checkpoint.cpp
src/gromacs/gmxlib/nonbonded/nb_free_energy.c
src/gromacs/mdlib/shellfc.c

Change-Id: Idbd2ef28223f8a868ca313f9702c8e6890e6ddc1

135 files changed:
CMakeLists.txt
cmake/Platform/XeonPhi.cmake
cmake/TestInlineASM_gcc_x86.c
cmake/gmxBuildTypeReference.cmake
cmake/gmxBuildTypeReleaseWithAssert.cmake
cmake/gmxCFlags.cmake
cmake/gmxFindFlagsForSource.cmake
cmake/gmxManageGPU.cmake
cmake/gmxManageNvccConfig.cmake
cmake/gmxTestSimd.cmake
manual/algorithms.tex
manual/forcefield.tex
manual/implement.tex
manual/monster.bib
manual/plots/angle.eps
manual/plots/dih.eps
manual/plots/f-angle.eps
manual/plots/fbposres.eps
manual/topology.tex
share/html/online/mdp.html
share/html/online/mdp_opt.html
share/top/amber03.ff/gbsa.itp
share/top/amber03.ff/tip5p.itp
share/top/amber03.ff/watermodels.dat
share/top/amber94.ff/gbsa.itp
share/top/amber94.ff/tip5p.itp
share/top/amber94.ff/watermodels.dat
share/top/amber96.ff/gbsa.itp
share/top/amber96.ff/tip5p.itp
share/top/amber96.ff/watermodels.dat
share/top/amber99.ff/gbsa.itp
share/top/amber99.ff/tip5p.itp
share/top/amber99.ff/watermodels.dat
share/top/amber99sb-ildn.ff/gbsa.itp
share/top/amber99sb-ildn.ff/tip5p.itp
share/top/amber99sb-ildn.ff/watermodels.dat
share/top/amber99sb.ff/gbsa.itp
share/top/amber99sb.ff/tip5p.itp
share/top/amber99sb.ff/watermodels.dat
share/top/amberGS.ff/gbsa.itp
share/top/amberGS.ff/tip5p.itp
share/top/amberGS.ff/watermodels.dat
share/top/charmm27.ff/aminoacids.n.tdb
share/top/charmm27.ff/aminoacids.r2b
share/top/charmm27.ff/atomtypes.atp
share/top/charmm27.ff/ffnonbonded.itp
share/top/charmm27.ff/gb.itp
share/top/charmm27.ff/tip5p.itp
share/top/charmm27.ff/watermodels.dat
share/top/gromos43a1.ff/aminoacids.n.tdb
share/top/gromos43a2.ff/aminoacids.n.tdb
share/top/gromos53a5.ff/aminoacids.n.tdb
share/top/gromos53a6.ff/aminoacids.n.tdb
share/top/gromos54a7.ff/aminoacids.n.tdb
share/top/oplsaa.ff/aminoacids.rtp
share/top/oplsaa.ff/tip5p.itp
share/top/oplsaa.ff/watermodels.dat
share/top/xlateat.dat
src/contrib/pmetest.c [deleted file]
src/external/thread_mpi/include/thread_mpi/atomic/gcc_x86.h
src/external/tng_io/CMakeLists.txt
src/external/tng_io/src/compression/CMakeLists.txt
src/external/tng_io/src/lib/CMakeLists.txt
src/gromacs/CMakeLists.txt
src/gromacs/fileio/libxdrf.c
src/gromacs/fileio/pdbio.c
src/gromacs/fileio/pdbio.h
src/gromacs/fileio/tngio.cpp
src/gromacs/fileio/tpxio.c
src/gromacs/fileio/trx.h
src/gromacs/fileio/trxio.c
src/gromacs/gmxana/anadih.c
src/gromacs/gmxana/gmx_anaeig.c
src/gromacs/gmxana/gmx_analyze.c
src/gromacs/gmxana/gmx_angle.c
src/gromacs/gmxana/gmx_chi.c
src/gromacs/gmxana/gmx_cluster.c
src/gromacs/gmxana/gmx_density.c
src/gromacs/gmxana/gmx_dos.c
src/gromacs/gmxana/gmx_editconf.c
src/gromacs/gmxana/gmx_enemat.c
src/gromacs/gmxana/gmx_energy.c
src/gromacs/gmxana/gmx_genpr.c
src/gromacs/gmxana/gmx_mdmat.c
src/gromacs/gmxana/gmx_mindist.c
src/gromacs/gmxana/gmx_polystat.c
src/gromacs/gmxana/gmx_principal.c
src/gromacs/gmxana/gmx_rama.c
src/gromacs/gmxana/gmx_rms.c
src/gromacs/gmxana/gmx_tcaf.c
src/gromacs/gmxana/gmx_traj.c
src/gromacs/gmxana/gmx_trjconv.c
src/gromacs/gmxana/gmx_vanhove.c
src/gromacs/gmxana/gmx_wham.cpp
src/gromacs/gmxlib/bondfree.c
src/gromacs/gmxlib/checkpoint.cpp
src/gromacs/gmxlib/nonbonded/nb_free_energy.c
src/gromacs/gmxlib/nonbonded/nb_generic.c
src/gromacs/gmxlib/nonbonded/nonbonded.c
src/gromacs/gmxlib/txtdump.c
src/gromacs/gmxpreprocess/addconf.c
src/gromacs/gmxpreprocess/grompp.c
src/gromacs/gmxpreprocess/hackblock.c
src/gromacs/gmxpreprocess/pdb2gmx.c
src/gromacs/gmxpreprocess/pdb2top.cpp
src/gromacs/gmxpreprocess/readir.c
src/gromacs/gmxpreprocess/readpull.c
src/gromacs/gmxpreprocess/topio.c
src/gromacs/gmxpreprocess/toppush.c
src/gromacs/gmxpreprocess/xlate.c
src/gromacs/legacyheaders/nonbonded.h
src/gromacs/legacyheaders/oenv.h
src/gromacs/legacyheaders/shellfc.h
src/gromacs/legacyheaders/tables.h
src/gromacs/legacyheaders/types/inputrec.h
src/gromacs/mdlib/constr.c
src/gromacs/mdlib/domdec.c
src/gromacs/mdlib/forcerec.c
src/gromacs/mdlib/ns.c
src/gromacs/mdlib/pme.c
src/gromacs/mdlib/shellfc.c
src/gromacs/mdlib/sim_util.c
src/gromacs/mdlib/tables.c
src/gromacs/mdlib/update.c
src/gromacs/mdlib/wall.c
src/gromacs/pulling/pull.c
src/gromacs/tools/compare.c
src/gromacs/trajectoryanalysis/tests/refdata/SelectModuleTest_HandlesMaxPDBOutput.xml
src/gromacs/trajectoryanalysis/tests/refdata/SelectModuleTest_HandlesPDBOutputWithPDBInput.xml
src/gromacs/trajectoryanalysis/tests/refdata/SelectModuleTest_HandlesSelectedPDBOutput.xml
src/programs/CMakeLists.txt
src/programs/mdrun/md.cpp
src/programs/mdrun/mdrun.cpp
src/programs/mdrun/repl_ex.cpp
src/programs/mdrun/runner.cpp

index a7fd59e5f18fd15885ce89817ce3abbdc301f432..d7aa996a60aa2806320f7ce2425845d3f22c36f9 100644 (file)
@@ -803,16 +803,22 @@ set(GMXLIB_FALLBACK   ${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/top)
 # Binary and library suffix options
 include(gmxManageSuffixes)
 
-##################################################################
+################################################################
 # Shared library settings
-##################################################################
-if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+################################################################
+if((NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin") OR ((CMAKE_SYSTEM_VERSION VERSION_GREATER 8.0) AND (CMAKE_VERSION VERSION_GREATER 2.8.11)))
     if(GMX_LIB_INSTALL_DIR STREQUAL "lib")
         set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
     endif()
-    set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${GMX_LIB_INSTALL_DIR}")
+    if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+        set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${GMX_LIB_INSTALL_DIR}")
+    else()
+        set(CMAKE_INSTALL_RPATH "@executable_path/../${GMX_LIB_INSTALL_DIR}")
+    endif()
     set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+    set(CMAKE_MACOSX_RPATH 1)
 else()
+    # We are on Darwin/OSX, and cmake cannot handle proper RPATHs
     if(CMAKE_SYSTEM_VERSION VERSION_GREATER 8.0) #rpath supported for >10.4
         set(CMAKE_INSTALL_NAME_DIR "@rpath")
         set(GMX_EXE_LINKER_FLAGS ${GMX_EXE_LINKER_FLAGS} "-Wl,-rpath,@executable_path/../${GMX_LIB_INSTALL_DIR}")
@@ -908,15 +914,16 @@ set(GMX_GPU_DETECTION_DONE TRUE CACHE INTERNAL "Whether GPU detection has alread
 #######################
 ## uninstall target
 #######################
-    CONFIGURE_FILE(
-                   "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
-                   "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
-                   IMMEDIATE @ONLY)
+CONFIGURE_FILE(   "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
+                  "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
+                  IMMEDIATE @ONLY)
 ###########################
 ADD_CUSTOM_TARGET(uninstall
                   "${CMAKE_COMMAND}" -P
                   "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake")
 ###########################
+set_directory_properties(PROPERTIES
+            ADDITIONAL_MAKE_CLEAN_FILES "install_manifest.txt")
 
 ########################################################################
 # Manual                                                               #
index f3845788b99e4623feccdc32cd6f3a8bc187ff2d..3e7956a83c73d4bf773af0f3394682136ef53455 100644 (file)
 #
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
-
-set(CMAKE_C_COMPILER "icc")
-set(CMAKE_CXX_COMPILER "icpc")
+if(NOT GMX_MPI)
+    set(CMAKE_C_COMPILER "icc")
+    set(CMAKE_CXX_COMPILER "icpc")
+else()
+    set(CMAKE_C_COMPILER "mpiicc")
+    set(CMAKE_CXX_COMPILER "mpiicpc")
+    set(GMX_PREFER_STATIC_LIBS ON CACHE BOOL "Shared libraries on Xeon Phi with MPI don't work.")
+endif()
 set(CMAKE_CXX_FLAGS "-mmic" CACHE STRING "Flags used by the compiler during all build types.")
 set(CMAKE_C_FLAGS "-mmic" CACHE STRING "Flags used by the compiler during all build types.")
 set(GMX_FFT_LIBRARY "mkl" CACHE STRING "FFT library")
index 152cddfafd63ca46fde188ab9c92ae356b715313..27f7a07d56984760e5fe3b9de1029630dffa7e01 100644 (file)
@@ -5,7 +5,7 @@ main()
   unsigned int level = 0;
 
   /* Test gcc inline asm for x86 */
-#if defined (__x86_64__) || defined (_M_X64)
+#if defined (__LP64__) || defined (_M_X64)
     __asm__("push %%rbx       \n\t"
             "cpuid            \n\t"
             "movl %%ebx, %1   \n\t"
index 2a6f7fac19217e937b6bff74b19044ab2287dc51..6f068efef813b42613cf6c19245930f213387e88 100644 (file)
@@ -36,6 +36,7 @@
 # reference values in the Gromacs regression tests.
 set( CMAKE_CXX_FLAGS_REFERENCE "-O0 -g" CACHE STRING "C++ flags for regressiontests reference runs." FORCE)
 set( CMAKE_C_FLAGS_REFERENCE "-O0 -g" CACHE STRING "C flags for regressiontests reference runs." FORCE)
+set( CMAKE_EXE_LINKER_FLAGS_REFERENCE "" CACHE STRING "Linker flags for regressiontests reference runs.")
 mark_as_advanced( CMAKE_CXX_FLAGS_REFERENCE CMAKE_C_FLAGS_REFERENCE)
 
 # turn off all fancy options for the regressiontests reference build
index 9aca788720051ad810390962714b11a9a63cde8c..db66d44051b063f1c071a0e29081f2addfe28368 100644 (file)
@@ -37,5 +37,6 @@ string(REGEX REPLACE "[/-][dD][^/-]*NDEBUG" "" CMAKE_C_FLAGS_RELWITHASSERT_INIT
 string(REGEX REPLACE "[/-][dD][^/-]*NDEBUG" "" CMAKE_CXX_FLAGS_RELWITHASSERT_INIT "${CMAKE_CXX_FLAGS_RELEASE_INIT}")
 set( CMAKE_C_FLAGS_RELWITHASSERT "${CMAKE_C_FLAGS_RELWITHASSERT_INIT}" CACHE STRING "C flags for release with assert builds.")
 set( CMAKE_CXX_FLAGS_RELWITHASSERT "${CMAKE_CXX_FLAGS_RELWITHASSERT_INIT}" CACHE STRING "C++ flags for release with assert builds.")
+set( CMAKE_EXE_LINKER_FLAGS_RELWITHASSERT "" CACHE STRING "Linker flags for release with assert builds.")
 mark_as_advanced( CMAKE_CXX_FLAGS_RELWITHASSERT CMAKE_C_FLAGS_RELWITHASSERT)
 
index 7db95394303759ecdc3e9dce689ce383e6e5c1ce..d779a2cb583d1ffe60b3399b5f468b1c054b0881 100644 (file)
@@ -214,8 +214,12 @@ MACRO(gmx_c_flags)
         #      unreferenced local variable (only C)
         #      conversion from 'size_t' to 'int', possible loss of data
         #      conversion from 'const char*' to 'void*', different 'const' qualifiers (only C)
-        GMX_TEST_CFLAG(CFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4101 /wd4267 /wd4090" GMXC_CFLAGS)
-        GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4267" GMXC_CXXFLAGS)
+        if(NOT CMAKE_CONFIGURATION_TYPES)
+            GMX_TEST_CFLAG(CFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4101 /wd4267 /wd4090" GMXC_CFLAGS)
+            GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4267" GMXC_CXXFLAGS)
+        else() #Projects only use the C++ flags
+            GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4101 /wd4267 /wd4090" GMXC_CXXFLAGS)
+        endif()
     endif()
 
     if (CMAKE_C_COMPILER_ID MATCHES "Clang")
index e5db8d1cef831bd35eb060586f51ba38bff7b106..d2533e72e40090e29bc336504bd7acb20f42c091 100644 (file)
@@ -47,10 +47,19 @@ FUNCTION(GMX_FIND_CFLAG_FOR_SOURCE VARIABLE DESCRIPTION SOURCE CFLAGSVAR)
         foreach(_testflag ${ARGN} "")
             message(STATUS "Try ${DESCRIPTION} = [${_testflag}]")
             set(CMAKE_REQUIRED_FLAGS "${${CFLAGSVAR}} ${_testflag}")
-            # make a valid variable name from the flag string: replace all non-alphanumerical chars
-            string(REGEX REPLACE "[^a-zA-Z0-9]+" "_" COMPILE_VARIABLE "C_FLAG_${_testflag}")
-            check_c_source_compiles("${SOURCE}" ${COMPILE_VARIABLE})
-            if(${${COMPILE_VARIABLE}})
+            # make valid variable names from the flag string: replace all non-alphanumerical chars
+            string(REGEX REPLACE "[^a-zA-Z0-9]+" "_" COMPILE_FLAG_VARIABLE "C_FLAG_${_testflag}")
+            string(REGEX REPLACE "[^a-zA-Z0-9]+" "_" COMPILE_SIMD_VARIABLE "C_SIMD_COMPILES_FLAG_${_testflag}")
+
+            # Check that the flag itself is fine, and that is does not generate warnings either
+            check_c_compiler_flag("${_testflag}" ${COMPILE_FLAG_VARIABLE})
+
+            if(${COMPILE_FLAG_VARIABLE})
+                # Check that we can compile SIMD source (this does not catch warnings)
+                check_c_source_compiles("${SOURCE}" ${COMPILE_SIMD_VARIABLE})
+            endif(${COMPILE_FLAG_VARIABLE})
+
+            if(${COMPILE_FLAG_VARIABLE} AND ${COMPILE_SIMD_VARIABLE})
                 set(${VARIABLE}_FLAG "${_testflag}" CACHE INTERNAL "${DESCRIPTION}")
                 set(${VARIABLE} 1 CACHE INTERNAL "Result of test for ${DESCRIPTION}" FORCE)
                 break()
@@ -82,10 +91,19 @@ FUNCTION(GMX_FIND_CXXFLAG_FOR_SOURCE VARIABLE DESCRIPTION SOURCE CXXFLAGSVAR)
         foreach(_testflag ${ARGN} "")
             message(STATUS "Try ${DESCRIPTION} = [${_testflag}]")
             set(CMAKE_REQUIRED_FLAGS "${${CXXFLAGSVAR}} ${_testflag}")
-            # make a valid variable name from the flag string: replace all non-alphanumerical chars
-            string(REGEX REPLACE "[^a-zA-Z0-9]+" "_" COMPILE_VARIABLE "CXX_FLAG_${_testflag}")
-            check_cxx_source_compiles("${SOURCE}" ${COMPILE_VARIABLE})
-            if(${${COMPILE_VARIABLE}})
+            # make valid variable names from the flag string: replace all non-alphanumerical chars
+            string(REGEX REPLACE "[^a-zA-Z0-9]+" "_" COMPILE_FLAG_VARIABLE "CXX_FLAG_${_testflag}")
+            string(REGEX REPLACE "[^a-zA-Z0-9]+" "_" COMPILE_SIMD_VARIABLE "CXX_SIMD_COMPILES_FLAG_${_testflag}")
+            
+            # Check that the flag itself is fine, and that is does not generate warnings either
+            check_cxx_compiler_flag("${_testflag}" ${COMPILE_FLAG_VARIABLE})
+
+            if(${COMPILE_FLAG_VARIABLE})
+                # Check that we can compile SIMD source (this does not catch warnings)
+                check_cxx_source_compiles("${SOURCE}" ${COMPILE_SIMD_VARIABLE})
+            endif(${COMPILE_FLAG_VARIABLE})
+
+            if(${COMPILE_FLAG_VARIABLE} AND ${COMPILE_SIMD_VARIABLE})
                 set(${VARIABLE}_FLAG "${_testflag}" CACHE INTERNAL "${DESCRIPTION}")
                 set(${VARIABLE} 1 CACHE INTERNAL "Result of test for ${DESCRIPTION}" FORCE)
                 break()
index 569f028de41446f8ae36712c71a51b9494ca9b08..b7761de7f5ad1dd9523fe0a4d4170808ebf5e16b 100644 (file)
@@ -70,6 +70,22 @@ if(GMX_GPU OR GMX_GPU_AUTO)
     else()
         find_package(CUDA 4.0 ${FIND_CUDA_QUIETLY})
     endif()
+    # Cmake 2.8.12 (and CMake 3.0) introduced a new bug where the cuda
+    # library dir is added twice as an rpath on APPLE, which in turn causes
+    # the install_name_tool to wreck the binaries when it tries to remove this
+    # path. Since this is set inside the cuda module, we remove the extra rpath
+    # added in the library string - an rpath is not a library anyway, and at
+    # least for Gromacs this works on all CMake versions. This should be
+    # reasonably future-proof, since newer versions of CMake appear to handle
+    # the rpath automatically based on the provided library path, meaning
+    # the explicit rpath specification is no longer needed.
+    if(APPLE AND (CMAKE_VERSION VERSION_GREATER 2.8.11))
+        foreach(elem ${CUDA_LIBRARIES})
+            if(elem MATCHES "-Wl,.*")
+                list(REMOVE_ITEM CUDA_LIBRARIES ${elem})
+            endif()
+        endforeach(elem)
+    endif()
 endif()
 
 # Depending on the current vale of GMX_GPU and GMX_GPU_AUTO:
index a0b3028c925502fce18ce309b603aee4e9564cbc..e0a7728221a600049d7990b5f1f8b892ddf952de 100644 (file)
@@ -125,6 +125,12 @@ if (NOT DEFINED CUDA_NVCC_FLAGS_SET)
         mark_as_advanced(CUDA_HOST_COMPILER CUDA_HOST_COMPILER_OPTIONS)
     endif()
 
+    if(APPLE AND CMAKE_C_COMPILER_ID MATCHES "GNU")
+        # Some versions of gcc-4.8 and gcc-4.9 produce errors (in particular on OS X)
+        # if we do not use -D__STRICT_ANSI__. It is harmless, so we might as well add it for all versions.
+        set(CUDA_HOST_COMPILER_OPTIONS "${CUDA_HOST_COMPILER_OPTIONS}-D__STRICT_ANSI__;")
+    endif()
+
     # on Linux we need to add -fPIC when building shared gmx libs
     # Note: will add -fPIC for any compiler that supports it as it shouldn't hurt
     if(BUILD_SHARED_LIBS)
index 1137db92ecdd9769ab158929b7e49459e82dfdd0..44bdd202cba78574cf1612802236fc556405a2ff 100644 (file)
@@ -66,12 +66,12 @@ elseif(${GMX_SIMD} STREQUAL "SSE2")
 
     gmx_find_cflag_for_source(CFLAGS_SSE2 "C compiler SSE2 flag"
                               "#include<xmmintrin.h>
-                              int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_rsqrt_ps(x);return 0;}"
+                              int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_rsqrt_ps(x);return _mm_movemask_ps(x);}"
                               SIMD_C_FLAGS
                               "-msse2" "/arch:SSE2" "-hgnu")
     gmx_find_cxxflag_for_source(CXXFLAGS_SSE2 "C++ compiler SSE2 flag"
                                 "#include<xmmintrin.h>
-                                int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_rsqrt_ps(x);return 0;}"
+                                int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_rsqrt_ps(x);return _mm_movemask_ps(x);}"
                                 SIMD_CXX_FLAGS
                                 "-msse2" "/arch:SSE2" "-hgnu")
 
@@ -87,12 +87,12 @@ elseif(${GMX_SIMD} STREQUAL "SSE4.1")
     # Note: MSVC enables SSE4.1 with the SSE2 flag, so we include that in testing.
     gmx_find_cflag_for_source(CFLAGS_SSE4_1 "C compiler SSE4.1 flag"
                               "#include<smmintrin.h>
-                              int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_dp_ps(x,x,0x77);return 0;}"
+                              int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_dp_ps(x,x,0x77);return _mm_movemask_ps(x);}"
                               SIMD_C_FLAGS
                               "-msse4.1" "/arch:SSE4.1" "/arch:SSE2" "-hgnu")
     gmx_find_cxxflag_for_source(CXXFLAGS_SSE4_1 "C++ compiler SSE4.1 flag"
                                 "#include<smmintrin.h>
-                                int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_dp_ps(x,x,0x77);return 0;}"
+                                int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_dp_ps(x,x,0x77);return _mm_movemask_ps(x);}"
                                 SIMD_CXX_FLAGS
                                 "-msse4.1" "/arch:SSE4.1" "/arch:SSE2" "-hgnu")
 
@@ -144,14 +144,14 @@ elseif(${GMX_SIMD} STREQUAL "AVX_128_FMA")
 "#include<immintrin.h>
 ${INCLUDE_X86INTRIN_H}
 ${INCLUDE_INTRIN_H}
-int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_macc_ps(x,x,x);return 0;}"
+int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_macc_ps(x,x,x);return _mm_movemask_ps(x);}"
                               SIMD_C_FLAGS
                               "-mfma4" "-hgnu")
     gmx_find_cxxflag_for_source(CXXFLAGS_AVX_128_FMA "C++ compiler AVX (128 bit) FMA4 flag"
 "#include<immintrin.h>
 ${INCLUDE_X86INTRIN_H}
 ${INCLUDE_INTRIN_H}
-int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_macc_ps(x,x,x);return 0;}"
+int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_macc_ps(x,x,x);return _mm_movemask_ps(x);}"
                                 SIMD_CXX_FLAGS
                                 "-mfma4" "-hgnu")
 
@@ -165,14 +165,14 @@ int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_macc_ps(x,x,x);return 0;}"
 "#include<immintrin.h>
 ${INCLUDE_X86INTRIN_H}
 ${INCLUDE_INTRIN_H}
-int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_frcz_ps(x);return 0;}"
+int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_frcz_ps(x);return _mm_movemask_ps(x);}"
                               SIMD_C_FLAGS
                               "-mxop")
     gmx_find_cxxflag_for_source(CXXFLAGS_AVX_128_XOP "C++ compiler AVX (128 bit) XOP flag"
 "#include<immintrin.h>
 ${INCLUDE_X86INTRIN_H}
 ${INCLUDE_INTRIN_H}
-int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_frcz_ps(x);return 0;}"
+int main(){__m128 x=_mm_set1_ps(0.5);x=_mm_frcz_ps(x);return _mm_movemask_ps(x);}"
                                 SIMD_CXX_FLAGS
                                 "-mxop")
 
@@ -207,12 +207,12 @@ elseif(${GMX_SIMD} STREQUAL "AVX_256")
 
     gmx_find_cflag_for_source(CFLAGS_AVX "C compiler AVX (256 bit) flag"
                               "#include<immintrin.h>
-                              int main(){__m256 x=_mm256_set1_ps(0.5);x=_mm256_add_ps(x,x);return 0;}"
+                              int main(){__m256 x=_mm256_set1_ps(0.5);x=_mm256_add_ps(x,x);return _mm256_movemask_ps(x);}"
                               SIMD_C_FLAGS
                               "-mavx" "/arch:AVX" "-hgnu")
     gmx_find_cxxflag_for_source(CXXFLAGS_AVX "C++ compiler AVX (256 bit) flag"
                                 "#include<immintrin.h>
-                                int main(){__m256 x=_mm256_set1_ps(0.5);x=_mm256_add_ps(x,x);return 0;}"
+                                int main(){__m256 x=_mm256_set1_ps(0.5);x=_mm256_add_ps(x,x);return _mm256_movemask_ps(x);}"
                                 SIMD_CXX_FLAGS
                                 "-mavx" "/arch:AVX" "-hgnu")
 
@@ -231,12 +231,12 @@ elseif(${GMX_SIMD} STREQUAL "AVX2_256")
 
     gmx_find_cflag_for_source(CFLAGS_AVX2 "C compiler AVX2 flag"
                               "#include<immintrin.h>
-                              int main(){__m256 x=_mm256_set1_ps(0.5);x=_mm256_fmadd_ps(x,x,x);return 0;}"
+                              int main(){__m256 x=_mm256_set1_ps(0.5);x=_mm256_fmadd_ps(x,x,x);return _mm256_movemask_ps(x);}"
                               SIMD_C_FLAGS
                               "-march=core-avx2" "-mavx2" "/arch:AVX" "-hgnu") # no AVX2-specific flag for MSVC yet
     gmx_find_cxxflag_for_source(CXXFLAGS_AVX2 "C++ compiler AVX2 flag"
                                 "#include<immintrin.h>
-                                int main(){__m256 x=_mm256_set1_ps(0.5);x=_mm256_fmadd_ps(x,x,x);return 0;}"
+                                int main(){__m256 x=_mm256_set1_ps(0.5);x=_mm256_fmadd_ps(x,x,x);return _mm256_movemask_ps(x);}"
                                 SIMD_CXX_FLAGS
                                 "-march=core-avx2" "-mavx2" "/arch:AVX" "-hgnu") # no AVX2-specific flag for MSVC yet
 
index 51e925ba834f771bd7f2dc3be3c0b950de50779d..7439c6bccd09bafb5bad4881081928a2b5c7c4b4 100644 (file)
@@ -263,7 +263,7 @@ atoms to perform certain actions on. The maximum number of groups is
 256, but each atom can only belong to six different groups, one 
 each of the following:
 \begin{description}
-\item[temperature-coupling group \swapindex{temperature-coupling}{group}]
+\item[\swapindex{temperature-coupling}{group}]
 The \normindex{temperature coupling} parameters (reference
 temperature, time constant, number of degrees of freedom, see
 \ssecref{update}) can be defined for each T-coupling group
@@ -362,7 +362,7 @@ is computed by calculating the force between non-bonded atom pairs: \\
 $\ve{F}_i = \sum_j \ve{F}_{ij}$ \\
 plus the forces due to bonded interactions (which may depend on 1, 2,
 3, or 4 atoms), plus restraining and/or external forces. \\
-The potential and kinetic energies and the pressure tensor are computed. \\   
+The potential and kinetic energies and the pressure tensor may be computed. \\
 $\Downarrow$\\
 {\bf 3. Update configuration} \\[1ex]
 The movement of the atoms is simulated by numerically solving Newton's
@@ -496,7 +496,11 @@ buffer. There are some important differences that affect results,
 performance and feature support. The group scheme can be made to work
 (almost) like the Verlet scheme, but this will lead to a decrease in
 performance. The group scheme is especially fast for water molecules,
-which are abundant in many simulations.
+which are abundant in many simulations, but on the most recent x86
+processors, this advantage is negated by the better instruction-level
+parallelism available in the Verlet-scheme implementation. The group
+scheme is deprecated in version 5.0, and will be removed in a future
+version.
 
 In the group scheme, a neighbor list is generated consisting of pairs
 of groups of at least one atom. These groups were originally
@@ -529,22 +533,23 @@ The Verlet cut-off scheme uses a buffered pair list by default. It
 also uses clusters of atoms, but these are not static as in the group
 scheme. Rather, the clusters are defined spatially and consist of 4 or
 8 atoms, which is convenient for stream computing, using e.g. SSE, AVX
-or CUDA on GPUs. At neighbor search steps, an atom pair list (or
-cluster pair list, but that's an implementation detail) is created
-with a Verlet buffer. Thus the pair-list cut-off is larger than the
+or CUDA on GPUs. At neighbor search steps, a pair list is created
+with a Verlet buffer, ie. the pair-list cut-off is larger than the
 interaction cut-off. In the non-bonded force kernels, forces are only
 added when an atom pair is within the cut-off distance at that
 particular time step. This ensures that as atoms move between pair
 search steps, forces between nearly all atoms within the cut-off
 distance are calculated. We say {\em nearly} all atoms, because
 {\gromacs} uses a fixed pair list update frequency for
-efficiency. There is a small chance that an atom pair distance is
-decreased to within the cut-off in this fixed number of steps. This
-small chance results in a small energy drift. When temperature
+efficiency. An atom-pair, whose distance was outside the cut-off,
+could possibly move enough during this fixed number of
+steps that its distance is now within the cut-off. This
+small chance results in a small energy drift, and the size of the
+chance depends on the temperature. When temperature
 coupling is used, the buffer size can be determined automatically,
-given a certain limit on the energy drift.
+given a certain tolerance on the energy drift.
 
-The Verlet scheme specific settings in the {\tt mdp} file are:
+The {\tt mdp} file settings specific to the Verlet scheme are:
 \begin{verbatim}
 cutoff-scheme           = Verlet
 verlet-buffer-tolerance = 0.005
@@ -554,11 +559,15 @@ by default set to 0.005 kJ/mol/ps pair energy error per atom. Note that
 errors in pair energies cancel and the effect on the total energy drift
 is usually at least an order of magnitude smaller than the tolerance.
 Furthermore, the drift of the total energy is affected by many other
-factors, the constraint contribution is often the dominating one.
-For constant energy (NVE) simulations, this drift should be set to -1
-and a buffer has to be set manually by specifying {\tt rlist} $>$ {\tt
-  rcoulomb}. The simplest way to get a reasonable buffer size is to
-use an NVT {\tt mdp} file with the target temperature set to what you
+factors; often, the contribution from the constraint algorithm dominates.
+
+For constant-energy (NVE) simulations, the buffer size will be
+inferred from the temperature that corresponds to the velocities
+(either those generated, if applicable, or those found in the input
+configuration). Alternatively, the tolerance can be set to -1 and a
+buffer set manually by specifying {\tt rlist} $>$ {\tt max(rcoulomb,
+  rvdw)}. The simplest way to get a reasonable buffer size is to use
+an NVT {\tt mdp} file with the target temperature set to what you
 expect in your NVE simulation, and transfer the buffer size printed by
 {\tt grompp} to your NVE {\tt mdp} file.
 
@@ -572,10 +581,10 @@ calculate all 16 particle-pair interactions at once, which maps nicely
 to SIMD units which can perform multiple floating operations at once
 (e.g. SSE, AVX, CUDA on GPUs, BlueGene FPUs). These non-bonded kernels
 are much faster than the kernels used in the group scheme for most
-types of systems, except for water molecules when not using a buffered
-pair list. This latter case is quite common for (bio-)molecular
-simulations, so for greatest speed, it is worth comparing the
-performance of both schemes.
+types of systems, except for water molecules on processors with short
+SIMD widths when not using a buffered pair list. This latter case is
+common for (bio-)molecular simulations, so for greatest speed, it is
+worth comparing the performance of both schemes.
 
 As the Verlet cut-off scheme was introduced in version 4.6, not
 all features of the group scheme are supported yet. The Verlet scheme
@@ -589,18 +598,20 @@ given in \tabref{cutoffschemesupport}.
 \dline
 Non-bonded interaction feature    & group & Verlet \\
 \dline
-unbuffered cut-off scheme         & $\surd$ & \\
+unbuffered cut-off scheme         & $\surd$ & not by default \\
 exact cut-off                     & shift/switch & $\surd$ \\
 shifted interactions              & force+energy & energy \\
-switched forces                   & $\surd$ & \\
+switched potential                & $\surd$ & $\surd$ \\
+switched forces                   & $\surd$ & $\surd$ \\
 non-periodic systems              & $\surd$ & Z  + walls \\
 implicit solvent                  & $\surd$ & \\
-free energy perturbed non-bondeds & $\surd$ & \\
+free energy perturbed non-bondeds & $\surd$ & $\surd$ \\
 group energy contributions        & $\surd$ & CPU (not on GPU) \\
 energy group exclusions           & $\surd$ & \\
 AdResS multi-scale                & $\surd$ & \\
 OpenMP multi-threading            & only PME & $\surd$ \\
 native GPU support                &         & $\surd$ \\
+Lennard-Jones PME                 & $\surd$ & $\surd$ \\
 \dline
 \end{tabular}
 }
@@ -611,7 +622,7 @@ native GPU support                &         & $\surd$ \\
 
 \ifthenelse{\equal{\gmxlite}{1}}{}{
 \subsubsection{Energy drift and pair-list buffering}
-For a canonical ensemble, the average energy error caused by the
+For a canonical (NVT) ensemble, the average energy error caused by the
 finite Verlet buffer size can be determined from the atomic
 displacements and the shape of the potential at the cut-off.
 %Since we are interested in the small drift regime, we will assume
@@ -753,17 +764,21 @@ don't move freely over 18 fs, but rather vibrate.
 
 \subsubsection{Cut-off artifacts and switched interactions}
 With the Verlet scheme, the pair potentials are shifted to be zero at
-the cut-off, such that the potential is the integral of the force.
-Note that in the group scheme this is not possible, because no exact
-cut-off distance is used. There can still be energy drift from
-non-zero forces at the cut-off. This effect is extremely small and
-often not noticeable, as other integration errors may dominate. To
+the cut-off, which makes the potential the integral of the force.
+This is only possible in the group scheme if the shape of the potential
+is such that its value is zero at the cut-off distance.
+However, there can still be energy drift when the
+forces are non-zero at the cut-off. This effect is extremely small and
+often not noticeable, as other integration errors (e.g. from constraints)
+may dominate. To
 completely avoid cut-off artifacts, the non-bonded forces can be
 switched exactly to zero at some distance smaller than the neighbor
 list cut-off (there are several ways to do this in {\gromacs}, see
 \secref{mod_nb_int}). One then has a buffer with the size equal to the
-neighbor list cut-off less the longest interaction cut-off. With the
-group cut-off scheme, one can then also choose to let {\tt mdrun} only
+neighbor list cut-off less the longest interaction cut-off.
+
+With the
+group cut-off scheme, one can also choose to let {\tt mdrun} only
 update the neighbor list when required. That is when one or more
 particles have moved more than half the buffer size from the center of
 geometry of the \swapindex{charge}{group} to which they belong (see
@@ -773,8 +788,9 @@ This option guarantees that there are no cut-off artifacts.  {\bf
 cost, since the neighbor list update frequency will be determined by
 just one or two particles moving slightly beyond the half buffer
 length (which not even necessarily implies that the neighbor list is
-invalid), while 99.99\% of the particles are fine.  } % Brace matches
-ifthenelse test for gmxlite
+invalid), while 99.99\% of the particles are fine.
+
+} % Brace matches ifthenelse test for gmxlite
 
 \subsubsection{Simple search\swapindexquiet{simple}{search}}
 Due to \eqnsref{box_rot}{simplerc}, the vector $\rvij$
@@ -833,12 +849,12 @@ of atoms with net charge zero, called charge groups, in and
 out of the neighbor list. This reduces the cut-off effects from
 the charge-charge level to the dipole-dipole level, which decay
 much faster. With the advent of full range electrostatics methods,
-such as particle mesh Ewald (\secref{pme}), the use of charge groups is
+such as particle-mesh Ewald (\secref{pme}), the use of charge groups is
 no longer required for accuracy. It might even have a slight negative effect
 on the accuracy or efficiency, depending on how the neighbor list is made
 and the interactions are calculated.
 
-But there is still an important reason for using ``charge groups'': efficiency.
+But there is still an important reason for using ``charge groups'': efficiency with the group cut-off scheme.
 Where applicable, neighbor searching is carried out on the basis of
 charge groups which are defined in the molecular topology.
 If the nearest image distance between the {\em
@@ -856,6 +872,9 @@ of 3 to 4 atoms for optimal performance. For all-atom force fields
 this is relatively easy, as one can simply put hydrogen atoms, and in some
 case oxygen atoms, in the same charge group as the heavy atom they
 are connected to; for example: CH$_3$, CH$_2$, CH, NH$_2$, NH, OH, CO$_2$, CO.
+
+With the Verlet cut-off scheme, charge groups are ignored.
+
 } % Brace matches ifthenelse test for gmxlite
 
 \subsection{Compute forces}
@@ -877,39 +896,39 @@ E_{kin} = \half \sum_{i=1}^N m_i v_i^2
 \eeq
 From this the absolute temperature $T$ can be computed using:
 \beq
-\half N_{df} kT = E_{kin}
+\half N_{\mathrm{df}} kT = E_{\mathrm{kin}}
 \label{eqn:E-T}
 \eeq
 where $k$ is Boltzmann's constant and $N_{df}$ is the number of
 degrees of freedom which can be computed from:
 \beq
-N_{df}  ~=~     3 N - N_c - N_{com}
+N_{\mathrm{df}}  ~=~     3 N - N_c - N_{\mathrm{com}}
 \eeq
 Here $N_c$ is the number of {\em \normindex{constraints}} imposed on the system.
-When performing molecular dynamics $N_{com}=3$ additional degrees of
+When performing molecular dynamics $N_{\mathrm{com}}=3$ additional degrees of
 freedom must be removed, because the three
 center-of-mass velocities are constants of the motion, which are usually
 set to zero. When simulating in vacuo, the rotation around the center of mass
-can also be removed, in this case $N_{com}=6$.
+can also be removed, in this case $N_{\mathrm{com}}=6$.
 When more than one temperature-coupling group\index{temperature-coupling group} is used, the number of degrees
 of freedom for group $i$ is:
 \beq
-N^i_{df}  ~=~  (3 N^i - N^i_c) \frac{3 N - N_c - N_{com}}{3 N - N_c}
+N^i_{\mathrm{df}}  ~=~  (3 N^i - N^i_c) \frac{3 N - N_c - N_{\mathrm{com}}}{3 N - N_c}
 \eeq
 
 The kinetic energy can also be written as a tensor, which is necessary
 for pressure calculation in a triclinic system, or systems where shear
 forces  are imposed:
 \beq
-{\bf E}_{kin} = \half \sum_i^N m_i \vvi \otimes \vvi
+{\bf E}_{\mathrm{kin}} = \half \sum_i^N m_i \vvi \otimes \vvi
 \eeq
 
 \subsubsection{Pressure and virial}
 The \normindex{pressure} 
 tensor {\bf P} is calculated from the difference between 
-kinetic energy $E_{kin}$ and the \normindex{virial} ${\bf \Xi}$:
+kinetic energy $E_{\mathrm{kin}}$ and the \normindex{virial} ${\bf \Xi}$:
 \beq
-{\bf P} = \frac{2}{V} ({\bf E}_{kin}-{\bf \Xi})
+{\bf P} = \frac{2}{V} ({\bf E}_{\mathrm{kin}}-{\bf \Xi})
 \label{eqn:P}
 \eeq
 where $V$ is the volume of the computational box. 
@@ -2910,7 +2929,8 @@ of the domain decomposition cell can scale down by at least
 a factor of 0.8. For 3-D domain decomposition this allows cells
 to change their volume by about a factor of 0.5, which should allow
 for compensation of a load imbalance of 100\%.
-The required scaling can be changed with the {\tt -dds} option of {\tt mdrun}.
+The minimum allowed scaling can be changed with the {\tt -dds}
+option of {\tt mdrun}.
 
 \subsection{Constraints in parallel\index{constraints}}
 \label{subsec:plincs}
@@ -2960,11 +2980,11 @@ and their default values is given in \tabref{dd_ranges}.
 \dline
 interaction & range & option & default \\
 \dline
-non-bonded        & $r_c$ = max($r_{list}$,$r_{VdW}$,$r_{Coul}$) & {\tt mdp} file & \\
-two-body bonded   & max($r_{mb}$,$r_c$) & {\tt mdrun -rdd} & starting conf. + 10\% \\
-multi-body bonded & $r_{mb}$ & {\tt mdrun -rdd} & starting conf. + 10\% \\
-constraints       & $r_{con}$ & {\tt mdrun -rcon} & est. from bond lengths \\
-virtual sites     & $r_{con}$ & {\tt mdrun -rcon} & 0 \\
+non-bonded        & $r_c$ = max($r_{\mathrm{list}}$,$r_{\mathrm{VdW}}$,$r_{\mathrm{Coul}}$) & {\tt mdp} file & \\
+two-body bonded   & max($r_{\mathrm{mb}}$,$r_c$) & {\tt mdrun -rdd} & starting conf. + 10\% \\
+multi-body bonded & $r_{\mathrm{mb}}$ & {\tt mdrun -rdd} & starting conf. + 10\% \\
+constraints       & $r_{\mathrm{con}}$ & {\tt mdrun -rcon} & est. from bond lengths \\
+virtual sites     & $r_{\mathrm{con}}$ & {\tt mdrun -rcon} & 0 \\
 \dline
 \end{tabular}
 }
@@ -2976,13 +2996,13 @@ In most cases the defaults of {\tt mdrun} should not cause the simulation
 to stop with an error message of missing interactions.
 The range for the bonded interactions is determined from the distance
 between bonded charge-groups in the starting configuration, with 10\% added
-for headroom. For the constraints, the value of $r_{con}$ is determined by
+for headroom. For the constraints, the value of $r_{\mathrm{con}}$ is determined by
 taking the maximum distance that ({\tt lincs_order + 1}) bonds can cover
 when they all connect at angles of 120 degrees.
-The actual constraint communication is not limited by $r_{con}$,
+The actual constraint communication is not limited by $r_{\mathrm{con}}$,
 but by the minimum cell size $L_C$, which has the following lower limit:
 \beq
-L_C \geq \max(r_{mb},r_{con})
+L_C \geq \max(r_{\mathrm{mb}},r_{\mathrm{con}})
 \eeq
 Without dynamic load balancing the system is actually allowed to scale
 beyond this limit when pressure scaling is used.
@@ -2992,15 +3012,15 @@ rather it is the shortest distance between the triclinic cells borders.
 For rhombic dodecahedra this is a factor of $\sqrt{3/2}$ shorter
 along $x$ and $y$.
 
-When $r_{mb} > r_c$, {\tt mdrun} employs a smart algorithm to reduce
+When $r_{\mathrm{mb}} > r_c$, {\tt mdrun} employs a smart algorithm to reduce
 the communication. Simply communicating all charge groups within
-$r_{mb}$ would increase the amount of communication enormously.
+$r_{\mathrm{mb}}$ would increase the amount of communication enormously.
 Therefore only charge-groups that are connected by bonded interactions
 to charge groups which are not locally present are communicated.
 This leads to little extra communication, but also to a slightly
 increased cost for the domain decomposition setup.
 In some cases, {\eg} coarse-grained simulations with a very short cut-off,
-one might want to set $r_{mb}$ by hand to reduce this cost.
+one might want to set $r_{\mathrm{mb}}$ by hand to reduce this cost.
 
 \subsection{Multiple-Program, Multiple-Data PME parallelization\index{PME}}
 \label{subsec:mpmd_pme}
@@ -3111,27 +3131,27 @@ Implicit solvent calculations in {\gromacs} can be done using the
 generalized Born-formalism, and the Still~\cite{Still97}, HCT~\cite{Truhlar96}, 
 and OBC~\cite{Case04} models are available for calculating the Born radii.
 
-Here, the free energy $G_{solv}$ of solvation is the sum of three terms, 
-a solvent-solvent cavity term ($G_{cav}$), a solute-solvent van der 
-Waals term ($G_{vdw}$), and finally a solvent-solute electrostatics 
-polarization term ($G_{pol}$).
+Here, the free energy $G_{\mathrm{solv}}$ of solvation is the sum of three terms,
+a solvent-solvent cavity term ($G_{\mathrm{cav}}$), a solute-solvent van der
+Waals term ($G_{\mathrm{vdw}}$), and finally a solvent-solute electrostatics
+polarization term ($G_{\mathrm{pol}}$).
 
-The sum of $G_{cav}$ and $G_{vdw}$ corresponds to the (non-polar) 
-free energy of solvation for a molecule from which all charges 
-have been removed, and is commonly called $G_{np}$,
+The sum of $G_{\mathrm{cav}}$ and $G_{\mathrm{vdw}}$ corresponds to the (non-polar)
+free energy of solvation for a molecule from which all charges
+have been removed, and is commonly called $G_{\mathrm{np}}$,
 calculated from the total solvent accessible surface area 
 multiplied with a surface tension. 
 The total expression for the solvation free energy then becomes:
 
 \beq
-G_{solv} = G_{np}  + G_{pol}
+G_{\mathrm{solv}} = G_{\mathrm{np}}  + G_{\mathrm{pol}}
 \label{eqn:gb_solv}
 \eeq
 
-Under the generalized Born model, $G_{pol}$ is calculated from the generalized Born equation~\cite{Still97}:
+Under the generalized Born model, $G_{\mathrm{pol}}$ is calculated from the generalized Born equation~\cite{Still97}:
 
 \beq
-G_{pol} = \left(1-\frac{1}{\epsilon}\right) \sum_{i=1}^n \sum_{j>i}^n \frac {q_i q_j}{\sqrt{r^2_{ij} + b_i b_j \exp\left(\frac{-r^2_{ij}}{4 b_i b_j}\right)}}
+G_{\mathrm{pol}} = \left(1-\frac{1}{\epsilon}\right) \sum_{i=1}^n \sum_{j>i}^n \frac {q_i q_j}{\sqrt{r^2_{ij} + b_i b_j \exp\left(\frac{-r^2_{ij}}{4 b_i b_j}\right)}}
 \label{eqn:gb_still}
 \eeq
 
@@ -3153,11 +3173,11 @@ x=\frac{r_{ij}}{\sqrt{b_i b_j }} = r_{ij} c_i c_j
 In the end, the full re-formulation of~\ref{eqn:gb_still} becomes:
  
 \beq
-G_{pol} = \left(1-\frac{1}{\epsilon}\right) \sum_{i=1}^n \sum_{j>i}^n \frac{q_i q_j}{\sqrt{b_i  b_j}} ~\xi (x) = \left(1-\frac{1}{\epsilon}\right) \sum_{i=1}^n q_i c_i \sum_{j>i}^n q_j c_j~\xi (x)
+G_{\mathrm{pol}} = \left(1-\frac{1}{\epsilon}\right) \sum_{i=1}^n \sum_{j>i}^n \frac{q_i q_j}{\sqrt{b_i  b_j}} ~\xi (x) = \left(1-\frac{1}{\epsilon}\right) \sum_{i=1}^n q_i c_i \sum_{j>i}^n q_j c_j~\xi (x)
 \label{eqn:gb_final}
 \eeq 
 
-The non-polar part ($G_{np}$) of Equation~\ref{eqn:gb_solv} is calculated 
+The non-polar part ($G_{\mathrm{np}}$) of Equation~\ref{eqn:gb_solv} is calculated 
 directly from the Born radius of each atom using a simple ACE type 
 approximation by Schaefer {\em et al.}~\cite{Karplus98}, including a 
 simple loop over all atoms. 
index 9ffa55cc044a3b8c2d57b85424ffb9dc2aecf0f7..d99292b8c83b416bad3173d82ddf4815f39e331f 100644 (file)
@@ -349,7 +349,7 @@ The modified Coulomb potential function is:
 See also \figref{shift}.
 
 \begin{figure}
-\centerline{\includegraphics[angle=270,width=10cm]{plots/shiftf}}
+\centerline{\includegraphics[width=10cm]{plots/shiftf}}
 \caption[The Coulomb Force, Shifted Force and Shift Function
 $S(r)$,.]{The Coulomb Force, Shifted Force and Shift Function $S(r)$,
 using r$_1$ = 2 and r$_c$ = 4.} 
@@ -390,7 +390,7 @@ The \swapindex{bond}{stretching} between two covalently bonded atoms
 $i$ and $j$ is represented by a harmonic potential:
 
 \begin{figure}
-\centerline{\raisebox{4cm}{\includegraphics[angle=270,width=5cm]{plots/bstretch}}\includegraphics[width=7cm]{plots/f-bond}}
+\centerline{\raisebox{2cm}{\includegraphics[width=5cm]{plots/bstretch}}\includegraphics[width=7cm]{plots/f-bond}}
 \caption[Bond stretching.]{Principle of bond stretching (left), and the bond
 stretching potential (right).}
 \label{fig:bstretch1}
@@ -417,9 +417,9 @@ The corresponding force is:
 \ve{F}_i(\rvij) = k^b_{ij}(\rij^2-b_{ij}^2)~\rvij
 \eeq
 The force constants for this form of the potential are related to the usual
-harmonic force constant $k^{b,harm}$ (\secref{bondpot}) as
+harmonic force constant $k^{b,\mathrm{harm}}$ (\secref{bondpot}) as
 \beq
-2 k^b b_{ij}^2 = k^{b,harm}
+2 k^b b_{ij}^2 = k^{b,\mathrm{harm}}
 \eeq
 The force constants are mostly derived from the harmonic ones used in 
 \gromosv{87}~\cite{biomos}. Although this form is computationally more 
@@ -534,7 +534,7 @@ The bond-\swapindex{angle}{vibration} between a triplet of atoms $i$ - $j$ - $k$
 is also represented by a harmonic potential on the angle $\tijk$
 
 \begin{figure}
-\centerline{\raisebox{4cm}{\includegraphics[angle=270,width=5cm]{plots/angle}}\includegraphics[width=7cm]{plots/f-angle}}
+\centerline{\raisebox{1cm}{\includegraphics[width=5cm]{plots/angle}}\includegraphics[width=7cm]{plots/f-angle}}
 \caption[Angle vibration.]{Principle of angle vibration (left) and the
 bond angle potential (right).}
 \label{fig:angle}
@@ -576,10 +576,10 @@ where
 \eeq
 The corresponding force can be derived by partial differentiation with respect
 to the atomic positions. The force constants in this function are related
-to the force constants in the harmonic form $k^{\theta,harm}$
+to the force constants in the harmonic form $k^{\theta,\mathrm{harm}}$
 (\ssecref{harmonicangle}) by:
 \beq
-k^{\theta} \sin^2(\tijk^0) = k^{\theta,harm}
+k^{\theta} \sin^2(\tijk^0) = k^{\theta,\mathrm{harm}}
 \eeq
 In the \gromosv{96} manual there is a much more complicated conversion formula
 which is temperature dependent. The formulas are equivalent at 0 K
@@ -708,8 +708,8 @@ aromatic rings) planar, or to prevent molecules from flipping over to their
 \normindex{mirror image}s, see \figref{imp}.
 
 \begin {figure}
-\centerline{\includegraphics[angle=270,width=4cm]{plots/ring-imp}\hspace{1cm}
-\includegraphics[angle=270,width=3cm]{plots/subst-im}\hspace{1cm}\includegraphics[angle=270,width=3cm]{plots/tetra-im}}
+\centerline{\includegraphics[width=4cm]{plots/ring-imp}\hspace{1cm}
+\includegraphics[width=3cm]{plots/subst-im}\hspace{1cm}\includegraphics[width=3cm]{plots/tetra-im}}
 \caption[Improper dihedral angles.]{Principle of improper
 dihedral angles. Out of plane bending for rings (left), substituents
 of rings (middle), out of tetrahedral (right). The improper dihedral
@@ -772,7 +772,7 @@ when multiple parameters are defined for the same atomtypes
 in the {\tt [ dihedraltypes ]} section.
 
 \begin{figure}
-\centerline{\raisebox{4.5cm}{\includegraphics[angle=270,width=5cm]{plots/dih}}\includegraphics[width=7cm]{plots/f-dih}}
+\centerline{\raisebox{1cm}{\includegraphics[width=5cm]{plots/dih}}\includegraphics[width=7cm]{plots/f-dih}}
 \caption[Proper dihedral angle.]{Principle of proper dihedral angle
 (left, in {\em trans} form) and the dihedral angle potential (right).} 
 \label{fig:pdihf}
@@ -1155,6 +1155,7 @@ as in an improper dihedral (sec.~\ref{sec:imp}) but with a slightly
 modified potential. Using:
 \beq
 \phi' = \left(\phi-\phi_0\right) ~{\rm MOD}~ 2\pi
+\label{eqn:dphi}
 \eeq
 where $\phi_0$ is the reference angle, the potential is defined as:
 \beq
@@ -1377,7 +1378,7 @@ definition in your topology file, like in the following example:
 
 \begin{verbatim}
 [ distance_restraints ]
-; ai  aj    type  index  type'   low    up1     up2    fac
+; ai   aj   type   index   type'      low     up1     up2     fac
 10     16      1       0       1      0.0     0.3     0.4     1.0
 10     28      1       1       1      0.0     0.3     0.4     1.0
 10     46      1       1       1      0.0     0.3     0.4     1.0
@@ -1912,7 +1913,7 @@ When soft core potentials are selected (by setting {\tt sc-alpha} \textgreater
 sequentially, then the Coulombic interaction is turned off linearly,
 rather than using soft core interactions, which should be less
 statistically noisy in most cases.  This behavior can be overwritten
-by using the mdp option {\tt sc-coul} to 'yes'. Additionally, the
+by using the mdp option {\tt sc-coul} to {\tt yes}. Additionally, the
 soft-core interaction potential is only applied when either the A or B
 state has zero interaction potential.  If both A and B states have
 nonzero interaction potential, default linear scaling described above
@@ -1933,7 +1934,7 @@ r_A &=& \left(\alpha \sigma_A^{48} \LAM^p + r^{48} \right)^\frac{1}{48}
 r_B &=& \left(\alpha \sigma_B^{48} \LL^p + r^{48} \right)^\frac{1}{48}
 \eea
 This ``1-1-48'' path is also implemented in {\gromacs}. Note that for this path the soft core $\alpha$
-should satisfy $0.001 < \alpha < 0.003$,rather than $\alpha \approx
+should satisfy $0.001 < \alpha < 0.003$, rather than $\alpha \approx
 0.5$.
 
 %} % Brace matches ifthenelse test for gmxlite
@@ -1956,7 +1957,7 @@ of atom {\bf i};
 atoms {\bf i+1} and {\bf i+2} are called {\em \normindex{exclusions}} of atom {\bf i}.
 
 \begin{figure}
-\centerline{\includegraphics[angle=270,width=8cm]{plots/chain}}
+\centerline{\includegraphics[width=8cm]{plots/chain}}
 \caption{Atoms along an alkane chain.}
 \label{fig:chain}
 \end{figure}
@@ -1985,14 +1986,16 @@ in most cases, acceptable, except when applying the cut-off implies
 the creation of charges, in which case you should consider using the
 lattice sum methods provided by {\gromacs}.
 
-Consider a water molecule interacting with another atom. When we would apply
-the cut-off on an atom-atom basis we might include the atom-oxygen
+Consider a water molecule interacting with another atom. If we would apply
+a plain cut-off on an atom-atom basis we might include the atom-oxygen
 interaction (with a charge of $-0.82$) without the compensating charge
 of the protons, and as a result, induce a large dipole moment over the system.
 Therefore, we have to keep groups of atoms with total charge
-0 together. These groups are called {\em charge groups}.
+0 together. These groups are called {\em charge groups}. Note that with
+a proper treatment of long-range electrostatics (e.g. particle-mesh Ewald
+(\secref{pme}), keeping charge groups together is not required.
 
-\subsection{Treatment of Cut-offs\index{cut-off}}
+\subsection{Treatment of Cut-offs in the group scheme\index{cut-off}}
 \newcommand{\rs}{$r_{short}$}
 \newcommand{\rl}{$r_{long}$}
 {\gromacs} is quite flexible in treating cut-offs, which implies
@@ -2369,11 +2372,11 @@ crystals~\cite{Ewald21}. The idea is to convert the single
 slowly-converging sum \eqnref{totalcoulomb} into two
 quickly-converging terms and a constant term:
 \begin{eqnarray}
-V &=& V_{dir} + V_{rec} + V_{0} \\[0.5ex]
-V_{dir} &=& \frac{f}{2} \sum_{i,j}^{N}
+V &=& V_{\mathrm{dir}} + V_{\mathrm{rec}} + V_{0} \\[0.5ex]
+V_{\mathrm{dir}} &=& \frac{f}{2} \sum_{i,j}^{N}
 \sum_{n_x}\sum_{n_y}
 \sum_{n_{z}*} q_i q_j \frac{\mbox{erfc}(\beta {r}_{ij,{\bf n}} )}{{r}_{ij,{\bf n}}} \\[0.5ex]
-V_{rec} &=& \frac{f}{2 \pi V} \sum_{i,j}^{N} q_i q_j
+V_{\mathrm{rec}} &=& \frac{f}{2 \pi V} \sum_{i,j}^{N} q_i q_j
 \sum_{m_x}\sum_{m_y}
 \sum_{m_{z}*} \frac{\exp{\left( -(\pi {\bf m}/\beta)^2 + 2 \pi i
       {\bf m} \cdot ({\bf r}_i - {\bf r}_j)\right)}}{{\bf m}^2} \\[0.5ex]
@@ -2495,31 +2498,14 @@ by selecting the electrostatics type:
 coulombtype     = P3M-AD
 \end{verbatim}
 
-\subsection{Optimizing Fourier transforms}
-To get the best possible performance you should try to avoid large
-prime numbers for grid dimensions.
-The FFT code used in {\gromacs} is
-optimized for grid sizes of the form $2^a 3^b 5^c 7^d 11^e 13^f$,
-where $e+f$ is $0$ or $1$ and the other exponents arbitrary. (See
-further the documentation of the FFT algorithms at
-\href{http://www.fftw.org}{www.fftw.org}.
+\subsection{Optimizing Fourier transforms and PME calculations}
+It is recommended to optimize the parameters for calculation of
+electrostatic interaction such as PME grid dimensions and cut-off radii.
+This is particularly relevant to do before launching long production runs.
 
-It is also possible to optimize the transforms for the current problem
-by performing some calculations at the start of the run. This is not
-done by default since it takes a couple of minutes, but for large
-runs it will save time. Turn it on by specifying
-
-\begin{verbatim}
-optimize-fft      = yes
-\end{verbatim}
-in your {\tt .mdp} file.
-
-When running in parallel, the grid must be communicated several times,
-thus hurting scaling performance. With PME you can improve this
-by increasing grid spacing while simultaneously increasing the
-interpolation to {\eg} sixth order.
-Since the interpolation is entirely local, doing so will
-improve the scaling in most cases.
+{\gromacs} includes a special tool, {\tt g_tune_pme}, which automates the 
+process of selecting the optimal size of the grid and number of PME-only
+notes.
 
 %
 % Temporarily removed since I am not sure about the state of the testlr
@@ -2682,11 +2668,11 @@ non-homogeneous outside of the cut-off distance, we can instead use
 the Particle-mesh Ewald method as discussed for electrostatics above.
 In this case the modified Ewald equations become
 \begin{eqnarray}
-V &=& V_{dir} + V_{rec} + V_{0} \\[0.5ex]
-V_{dir} &=& -\frac{1}{2} \sum_{i,j}^{N}
+V &=& V_{\mathrm{dir}} + V_{\mathrm{rec}} + V_{0} \\[0.5ex]
+V_{\mathrm{dir}} &=& -\frac{1}{2} \sum_{i,j}^{N}
 \sum_{n_x}\sum_{n_y}
 \sum_{n_{z}*} \frac{C_{ij}^{(6)}g(\beta {r}_{ij,{\bf n}})}{{r_{ij,{\bf n}}}^6} \\[0.5ex]
-V_{rec} &=& \frac{{\pi}^{\frac{3}{2}} \beta^{3}}{2V} \sum_{m_x}\sum_{m_y}\sum_{m_{z}*}
+V_{\mathrm{rec}} &=& \frac{{\pi}^{\frac{3}{2}} \beta^{3}}{2V} \sum_{m_x}\sum_{m_y}\sum_{m_{z}*}
 f(\pi |{\mathbf m}|/\beta) \times \sum_{i,j}^{N} C_{ij}^{(6)} {\mathrm{exp}}\left[-2\pi i {\bf m}\cdot({\bf r_i}-{\bf r_j})\right] \\[0.5ex]
 V_{0} &=& -\frac{\beta^{6}}{12}\sum_{i}^{N} C_{ii}^{(6)},
 \end{eqnarray}
@@ -2794,21 +2780,6 @@ select we recommend \gromosv{96} for united-atom setups and OPLS-AA/L for
 all-atom parameters. That said, we describe the available options in
 some detail.
 
-\subsection{GROMOS87\index{GROMOS87 force field}}
-The \gromosv{87} suite of programs and corresponding force
-field~\cite{biomos} formed the basis for the development of {\gromacs}
-in the early 1990s.  The original GROMOS87 force field is not
-available in {\gromacs}. In previous versions ($<$ 3.3.2) there used
-to be the so-called ``{\gromacs} force field,'' which was based on
-\gromosv{87}~\cite{biomos}\index{GROMOS87}, with a small modification
-concerning the interaction between water oxygens and carbon
-atoms~\cite{Buuren93b,Mark94}, as well as 10 extra atom
-types~\cite{Jorgensen83,Buuren93a,Buuren93b,Mark94,Liu95}.
-
-Since version 5.0 this force field has been ``deprecated''. Should 
-you have a justifiable reason to use this force field please 
-use eariler versions of {\gromacs}.
-
 \subsubsection{All-hydrogen force field}
 The \gromosv{87}-based all-hydrogen force field is almost identical to the
 normal \gromosv{87} force field, since the extra hydrogens have no
@@ -2885,7 +2856,7 @@ of the blocks. {\bf Note} that all {\gromacs} programs can read compressed
 
 \subsection{AMBER\index{AMBER force field}}
 
-As of version 4.5, {\gromacs} provides native support for the following AMBER force fields:
+{\gromacs} provides native support for the following AMBER force fields:
 
 \begin{itemize}
 \item AMBER94~\cite{Cornell1995}
@@ -2900,10 +2871,12 @@ As of version 4.5, {\gromacs} provides native support for the following AMBER fo
 \subsection{CHARMM\index{CHARMM force field}}
 \label{subsec:charmmff}
 
-As of version 4.5, {\gromacs} supports the CHARMM27 force field for proteins~\cite{mackerell04, mackerell98}, lipids~\cite{feller00} and nucleic acids~\cite{foloppe00}. The protein parameters (and to some extent the lipid and nucleic acid parameters) were thoroughly tested -- both by comparing potential energies between the port and the standard parameter set in the CHARMM molecular simulation package, as well by how the protein force field behaves together with {\gromacs}-specific techniques such as virtual sites (enabling long time steps) and a fast implicit solvent recently implemented~\cite{Larsson10} -- and the details and results are presented in the paper by Bjelkmar et al.~\cite{Bjelkmar10}. The nucleic acid parameters, as well as the ones for HEME, were converted and tested by Michel Cuendet.
+{\gromacs} supports the CHARMM force field for proteins~\cite{mackerell04, mackerell98}, lipids~\cite{feller00} and nucleic acids~\cite{foloppe00,Mac2000}. The protein parameters (and to some extent the lipid and nucleic acid parameters) were thoroughly tested -- both by comparing potential energies between the port and the standard parameter set in the CHARMM molecular simulation package, as well by how the protein force field behaves together with {\gromacs}-specific techniques such as virtual sites (enabling long time steps) and a fast implicit solvent recently implemented~\cite{Larsson10} -- and the details and results are presented in the paper by Bjelkmar et al.~\cite{Bjelkmar10}. The nucleic acid parameters, as well as the ones for HEME, were converted and tested by Michel Cuendet.
 
 When selecting the CHARMM force field in {\tt \normindex{pdb2gmx}} the default option is to use \normindex{CMAP} (for torsional correction map). To exclude CMAP, use {\tt -nocmap}. The basic form of the CMAP term implemented in {\gromacs} is a function of the $\phi$ and $\psi$ backbone torsion angles. This term is defined in the {\tt .rtp} file by a {\tt [ cmap ]} statement at the end of each residue supporting CMAP. The following five atom names define the two torsional angles. Atoms 1-4 define $\phi$, and atoms 2-5 define $\psi$. The corresponding atom types are then matched to the correct CMAP type in the {\tt cmap.itp} file that contains the correction maps.
 
+A port of the CHARMM36 force field for use with GROMACS is also available at \url{http://mackerell.umaryland.edu/charmm_ff.shtml#gromacs}.
+
 \subsection{Coarse-grained force-fields}
 \index{force-field, coarse-grained}
 \label{sec:cg-forcefields}
index db6ecd24fca324b805a294f5c61af368d2c894a2..2d70c6b625fd76de80102adeb6f2c1d07ae984c7 100644 (file)
@@ -1,7 +1,7 @@
 %
 % This file is part of the GROMACS molecular simulation package.
 %
-% Copyright (c) 2013, by the GROMACS development team, led by
+% Copyright (c) 2013,2014, by the GROMACS development team, led by
 % Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 % and including many others, as listed in the AUTHORS file in the
 % top-level source directory and at http://www.gromacs.org.
@@ -570,25 +570,6 @@ to the maximum accuracy.
 It is clear that only one iteration extra (in double 
 precision) is needed for a double-precision result.
 
-\section{Modifying GROMACS}
-The following files have to be edited in case you want to add a bonded
-potential of any type.
-\begin{enumerate}
-\item {\tt include/bondf.h}
-\item {\tt include/types/idef.h}
-\item {\tt include/types/nrnb.h}
-\item {\tt include/types/enums.h}
-\item {\tt include/grompp.h}
-\item {\tt src/kernel/topdirs.c}
-\item {\tt src/gmxlib/tpxio.c}
-\item {\tt src/gmxlib/bondfree.c}
-\item {\tt src/gmxlib/ifunc.c}
-\item {\tt src/gmxlib/nrnb.c}
-\item {\tt src/kernel/convparm.c}
-\item {\tt src/kernel/topdirs.c}
-\item {\tt src/kernel/topio.c}
-\end{enumerate}
-
 % LocalWords:  Virial virial triclinic intra mol mshift shiftvec sqrt SPC lj yf
 % LocalWords:  coul Fortran SGI AMD Raphson IEEE taylor epsr accy ieee yx fpdef
 % LocalWords:  lsb nr inversef src formulae GROMACS
index ed75b91a220d3b5d254c6e740d4c5b37431e6744..0774ae539cbb954bcf42bb600075a03f676570b2 100644 (file)
@@ -8676,3 +8676,18 @@ number = {7},
 pages = {2887--2899},
 year  = 2013
 }
+
+@article {Mac2000,
+author = {MacKerell, Alexander D. and Banavali, Nilesh K.},
+title = {All-atom empirical force field for nucleic acids: {II.} Application to molecular dynamics simulations of {DNA} and {RNA} in solution},
+journal = BTjcc,
+volume = {21},
+number = {2},
+publisher = {John Wiley & Sons, Inc.},
+issn = {1096-987X},
+url = {http://dx.doi.org/10.1002/(SICI)1096-987X(20000130)21:2<105::AID-JCC3>3.0.CO;2-P},
+doi = {10.1002/(SICI)1096-987X(20000130)21:2<105::AID-JCC3>3.0.CO;2-P},
+pages = {105--120},
+keywords = {CHARMM, force field, molecular dynamics, parametrization, DNA, RNA},
+year = {2000},
+}
index 6122e911bffcb73af6cf9bf3cb0e6ffe9197c2ab..e9f4771760da170cdce50750adfe1888b54d2816 100644 (file)
@@ -1,32 +1,81 @@
-%!PS-Adobe-2.0 EPSF
-%%Title: /tmp/xfig-fig008452
-%%Creator: fig2dev
-%%CreationDate: Thu Mar  9 17:17:56 1995
-%%For: spoel@rugmd17 (David van der Spoel,Room 17.14,4327)
-%%BoundingBox: 0 0 99 180
-%%Pages: 0
+%!PS-Adobe-3.0 EPSF-3.0
+%%Title: angle.fig
+%%Creator: fig2dev Version 3.2 Patchlevel 5d
+%%CreationDate: Fri Jun 13 15:51:52 2014
+%%BoundingBox: 0 0 191 105
+%Magnification: 1.0000
 %%EndComments
-/$F2psDict 200 dict def 
+%%BeginProlog
+/$F2psDict 200 dict def
 $F2psDict begin
 $F2psDict /mtrx matrix put
+/col-1 {0 setgray} bind def
+/col0 {0.000 0.000 0.000 srgb} bind def
+/col1 {0.000 0.000 1.000 srgb} bind def
+/col2 {0.000 1.000 0.000 srgb} bind def
+/col3 {0.000 1.000 1.000 srgb} bind def
+/col4 {1.000 0.000 0.000 srgb} bind def
+/col5 {1.000 0.000 1.000 srgb} bind def
+/col6 {1.000 1.000 0.000 srgb} bind def
+/col7 {1.000 1.000 1.000 srgb} bind def
+/col8 {0.000 0.000 0.560 srgb} bind def
+/col9 {0.000 0.000 0.690 srgb} bind def
+/col10 {0.000 0.000 0.820 srgb} bind def
+/col11 {0.530 0.810 1.000 srgb} bind def
+/col12 {0.000 0.560 0.000 srgb} bind def
+/col13 {0.000 0.690 0.000 srgb} bind def
+/col14 {0.000 0.820 0.000 srgb} bind def
+/col15 {0.000 0.560 0.560 srgb} bind def
+/col16 {0.000 0.690 0.690 srgb} bind def
+/col17 {0.000 0.820 0.820 srgb} bind def
+/col18 {0.560 0.000 0.000 srgb} bind def
+/col19 {0.690 0.000 0.000 srgb} bind def
+/col20 {0.820 0.000 0.000 srgb} bind def
+/col21 {0.560 0.000 0.560 srgb} bind def
+/col22 {0.690 0.000 0.690 srgb} bind def
+/col23 {0.820 0.000 0.820 srgb} bind def
+/col24 {0.500 0.190 0.000 srgb} bind def
+/col25 {0.630 0.250 0.000 srgb} bind def
+/col26 {0.750 0.380 0.000 srgb} bind def
+/col27 {1.000 0.500 0.500 srgb} bind def
+/col28 {1.000 0.630 0.630 srgb} bind def
+/col29 {1.000 0.750 0.750 srgb} bind def
+/col30 {1.000 0.880 0.880 srgb} bind def
+/col31 {1.000 0.840 0.000 srgb} bind def
+
+end
+
+/cp {closepath} bind def
+/ef {eofill} bind def
+/gr {grestore} bind def
+/gs {gsave} bind def
+/sa {save} bind def
+/rs {restore} bind def
 /l {lineto} bind def
 /m {moveto} bind def
-/s {stroke} bind def
+/rm {rmoveto} bind def
 /n {newpath} bind def
-/gs {gsave} bind def
-/gr {grestore} bind def
-/clp {closepath} bind def
-/graycol {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
-4 -2 roll mul setrgbcolor} bind def
-/col-1 {} def
-/col0 {0 0 0 setrgbcolor} bind def
-/col1 {0 0 1 setrgbcolor} bind def
-/col2 {0 1 0 setrgbcolor} bind def
-/col3 {0 1 1 setrgbcolor} bind def
-/col4 {1 0 0 setrgbcolor} bind def
-/col5 {1 0 1 setrgbcolor} bind def
-/col6 {1 1 0 setrgbcolor} bind def
-/col7 {1 1 1 setrgbcolor} bind def
+/s {stroke} bind def
+/sh {show} bind def
+/slc {setlinecap} bind def
+/slj {setlinejoin} bind def
+/slw {setlinewidth} bind def
+/srgb {setrgbcolor} bind def
+/rot {rotate} bind def
+/sc {scale} bind def
+/sd {setdash} bind def
+/ff {findfont} bind def
+/sf {setfont} bind def
+/scf {scalefont} bind def
+/sw {stringwidth} bind def
+/tr {translate} bind def
+/tnt {dup dup currentrgbcolor
+  4 -2 roll dup 1 exch sub 3 -1 roll mul add
+  4 -2 roll dup 1 exch sub 3 -1 roll mul add
+  4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
+  bind def
+/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
+  4 -2 roll mul srgb} bind def
  /DrawEllipse {
        /endangle exch def
        /startangle exch def
@@ -35,51 +84,103 @@ $F2psDict /mtrx matrix put
        /y exch def
        /x exch def
        /savematrix mtrx currentmatrix def
-       x y translate xrad yrad scale 0 0 1 startangle endangle arc
+       x y tr xrad yrad sc 0 0 1 startangle endangle arc
+       closepath
        savematrix setmatrix
        } def
 
-       end
 /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
 /$F2psEnd {$F2psEnteredState restore end} def
-%%EndProlog
 
+/pageheader {
+save
+newpath 0 105 moveto 0 0 lineto 191 0 lineto 191 105 lineto closepath clip newpath
+-55.9 170.5 translate
+1 -1 scale
 $F2psBegin
-0 setlinecap 0 setlinejoin
--63.0 -54.0 translate 90 rotate 0.900 -0.900 scale
-0.500 setlinewidth
-n 178.680 130.760 m 179.000 139.000 l 174.840 131.880 l gs 2 setlinejoin col-1 s gr
-n 143.160 131.880 m 139.000 139.000 l 139.320 130.760 l gs 2 setlinejoin col-1 s gr
-n 159.000 144.833 20.833 -163.741 -16.259 arc
+10 setmiterlimit
+0 slj 0 slc
+ 0.06299 0.06299 sc
+} bind def
+/pagefooter {
+$F2psEnd
+restore
+} bind def
+%%EndProlog
+pageheader
+%
+% Fig objects follow
+%
+% 
+% here starts figure with depth 0
+% Arc
+7.500 slw
+0 slc
+gs  clippath
+2607 1994 m 2680 2127 l 2733 2098 l 2660 1965 l 2660 1965 l 2692 2085 l 2607 1994 l cp
+2139 1965 m 2066 2098 l 2119 2127 l 2192 1994 l 2192 1994 l 2108 2085 l 2139 1965 l cp
+eoclip
+n 2400.0 2187.5 312.5 -163.7407 -16.2593 arc
 gs col-1 s gr
+ gr
+
+% arrowhead
+0 slj
+n 2139 1965 m 2108 2085 l 2192 1994 l  col-1 s
+% arrowhead
+n 2607 1994 m 2692 2085 l 2660 1965 l  col-1 s
 % Ellipse
-n 239 79 10 10 0 360 DrawEllipse gs 0.00 setgray fill gr
-gs col-1 s gr
+n 3600 1200 150 150 0 360 DrawEllipse gs 0.00 setgray ef gr gs col-1 s gr
+
 % Ellipse
-n 79 79 10 10 0 360 DrawEllipse gs 0.00 setgray fill gr
-gs col-1 s gr
+n 1200 1200 150 150 0 360 DrawEllipse gs 0.00 setgray ef gr gs col-1 s gr
+
 % Ellipse
-n 159 169 10 10 0 360 DrawEllipse gs 0.00 setgray fill gr
-gs col-1 s gr
-2.000 setlinewidth
+n 2400 2550 150 150 0 360 DrawEllipse gs 0.00 setgray ef gr gs col-1 s gr
+
 % Polyline
-n 84 84 m 154 169 l gs col-1 s gr
+30.000 slw
+n 1275 1275 m
+ 2325 2550 l gs col-1 s gr 
 % Polyline
-n 164 169 m 234 84 l gs col-1 s gr
-0.500 setlinewidth
+n 2475 2550 m
+ 3525 1275 l gs col-1 s gr 
 % Polyline
-n 79 79 m 59 99 l gs col-1 s gr
-n 66.071 94.757 m 59.000 99.000 l 63.243 91.929 l gs 2 setlinejoin col-1 s gr
+7.500 slw
+gs  clippath
+975 1381 m 868 1489 l 910 1531 l 1018 1424 l 1018 1424 l 912 1488 l 975 1381 l cp
+eoclip
+n 1200 1200 m
+ 900 1500 l gs col-1 s gr gr
+
+% arrowhead
+n 975 1381 m 912 1488 l 1018 1424 l  col-1 s
 % Polyline
-n 239 79 m 259 99 l gs col-1 s gr
-n 254.757 91.929 m 259.000 99.000 l 251.929 94.757 l gs 2 setlinejoin col-1 s gr
+gs  clippath
+3781 1424 m 3889 1531 l 3931 1489 l 3824 1381 l 3824 1381 l 3888 1488 l 3781 1424 l cp
+eoclip
+n 3600 1200 m
+ 3900 1500 l gs col-1 s gr gr
+
+% arrowhead
+n 3781 1424 m 3888 1488 l 3824 1381 l  col-1 s
 % Polyline
-n 159 169 m 159 139 l gs col-1 s gr
-n 157.000 147.000 m 159.000 139.000 l 161.000 147.000 l gs 2 setlinejoin col-1 s gr
-/Symbol findfont 18.00 scalefont setfont
-149 109 m 
-gs 1 -1 scale (q) col-1 show gr
-/Helvetica findfont 16.00 scalefont setfont
-159 114 m 
-gs 1 -1 scale (0) col-1 show gr
-$F2psEnd
+gs  clippath
+2430 2237 m 2430 2085 l 2370 2085 l 2370 2237 l 2370 2237 l 2400 2117 l 2430 2237 l cp
+eoclip
+n 2400 2550 m
+ 2400 2100 l gs col-1 s gr gr
+
+% arrowhead
+n 2430 2237 m 2400 2117 l 2370 2237 l  col-1 s
+/Symbol ff 285.75 scf sf
+2250 1650 m
+gs 1 -1 sc (q) col-1 sh gr
+/Helvetica ff 254.00 scf sf
+2400 1725 m
+gs 1 -1 sc (0) col-1 sh gr
+% here ends figure;
+pagefooter
+showpage
+%%Trailer
+%EOF
index 119e0dfaff0083f6380998d8158586081f4392e5..b8d6be93aa94851c9ca8d9aec7f18585e79e686f 100644 (file)
@@ -1,32 +1,81 @@
-%!PS-Adobe-2.0 EPSF
-%%Title: /tmp/xfig-fig028754
-%%Creator: fig2dev
-%%CreationDate: Mon Nov 21 16:29:31 1994
-%%For: spoel@rugmd17 (David van der Spoel,Room 17.14,4327)
-%%BoundingBox: 0 0 146 224
-%%Pages: 0
+%!PS-Adobe-3.0 EPSF-3.0
+%%Title: dih.fig
+%%Creator: fig2dev Version 3.2 Patchlevel 5d
+%%CreationDate: Fri Jun 13 15:56:50 2014
+%%BoundingBox: 0 0 237 150
+%Magnification: 1.0000
 %%EndComments
-/$F2psDict 200 dict def 
+%%BeginProlog
+/$F2psDict 200 dict def
 $F2psDict begin
 $F2psDict /mtrx matrix put
+/col-1 {0 setgray} bind def
+/col0 {0.000 0.000 0.000 srgb} bind def
+/col1 {0.000 0.000 1.000 srgb} bind def
+/col2 {0.000 1.000 0.000 srgb} bind def
+/col3 {0.000 1.000 1.000 srgb} bind def
+/col4 {1.000 0.000 0.000 srgb} bind def
+/col5 {1.000 0.000 1.000 srgb} bind def
+/col6 {1.000 1.000 0.000 srgb} bind def
+/col7 {1.000 1.000 1.000 srgb} bind def
+/col8 {0.000 0.000 0.560 srgb} bind def
+/col9 {0.000 0.000 0.690 srgb} bind def
+/col10 {0.000 0.000 0.820 srgb} bind def
+/col11 {0.530 0.810 1.000 srgb} bind def
+/col12 {0.000 0.560 0.000 srgb} bind def
+/col13 {0.000 0.690 0.000 srgb} bind def
+/col14 {0.000 0.820 0.000 srgb} bind def
+/col15 {0.000 0.560 0.560 srgb} bind def
+/col16 {0.000 0.690 0.690 srgb} bind def
+/col17 {0.000 0.820 0.820 srgb} bind def
+/col18 {0.560 0.000 0.000 srgb} bind def
+/col19 {0.690 0.000 0.000 srgb} bind def
+/col20 {0.820 0.000 0.000 srgb} bind def
+/col21 {0.560 0.000 0.560 srgb} bind def
+/col22 {0.690 0.000 0.690 srgb} bind def
+/col23 {0.820 0.000 0.820 srgb} bind def
+/col24 {0.500 0.190 0.000 srgb} bind def
+/col25 {0.630 0.250 0.000 srgb} bind def
+/col26 {0.750 0.380 0.000 srgb} bind def
+/col27 {1.000 0.500 0.500 srgb} bind def
+/col28 {1.000 0.630 0.630 srgb} bind def
+/col29 {1.000 0.750 0.750 srgb} bind def
+/col30 {1.000 0.880 0.880 srgb} bind def
+/col31 {1.000 0.840 0.000 srgb} bind def
+
+end
+
+/cp {closepath} bind def
+/ef {eofill} bind def
+/gr {grestore} bind def
+/gs {gsave} bind def
+/sa {save} bind def
+/rs {restore} bind def
 /l {lineto} bind def
 /m {moveto} bind def
-/s {stroke} bind def
+/rm {rmoveto} bind def
 /n {newpath} bind def
-/gs {gsave} bind def
-/gr {grestore} bind def
-/clp {closepath} bind def
-/graycol {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
-4 -2 roll mul setrgbcolor} bind def
-/col-1 {} def
-/col0 {0 0 0 setrgbcolor} bind def
-/col1 {0 0 1 setrgbcolor} bind def
-/col2 {0 1 0 setrgbcolor} bind def
-/col3 {0 1 1 setrgbcolor} bind def
-/col4 {1 0 0 setrgbcolor} bind def
-/col5 {1 0 1 setrgbcolor} bind def
-/col6 {1 1 0 setrgbcolor} bind def
-/col7 {1 1 1 setrgbcolor} bind def
+/s {stroke} bind def
+/sh {show} bind def
+/slc {setlinecap} bind def
+/slj {setlinejoin} bind def
+/slw {setlinewidth} bind def
+/srgb {setrgbcolor} bind def
+/rot {rotate} bind def
+/sc {scale} bind def
+/sd {setdash} bind def
+/ff {findfont} bind def
+/sf {setfont} bind def
+/scf {scalefont} bind def
+/sw {stringwidth} bind def
+/tr {translate} bind def
+/tnt {dup dup currentrgbcolor
+  4 -2 roll dup 1 exch sub 3 -1 roll mul add
+  4 -2 roll dup 1 exch sub 3 -1 roll mul add
+  4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb}
+  bind def
+/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul
+  4 -2 roll mul srgb} bind def
  /DrawEllipse {
        /endangle exch def
        /startangle exch def
@@ -35,55 +84,85 @@ $F2psDict /mtrx matrix put
        /y exch def
        /x exch def
        /savematrix mtrx currentmatrix def
-       x y translate xrad yrad scale 0 0 1 startangle endangle arc
+       x y tr xrad yrad sc 0 0 1 startangle endangle arc
+       closepath
        savematrix setmatrix
        } def
 
-       end
 /$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def
 /$F2psEnd {$F2psEnteredState restore end} def
-%%EndProlog
 
+/pageheader {
+save
+newpath 0 150 moveto 0 0 lineto 237 0 lineto 237 150 lineto closepath clip newpath
+-65.6 170.5 translate
+1 -1 scale
 $F2psBegin
-0 setlinecap 0 setlinejoin
--16.0 -63.0 translate 90 rotate 0.900 -0.900 scale
-1.000 setlinewidth
-n 173.167 99.000 20.833 73.741 -73.741 arcn
+10 setmiterlimit
+0 slj 0 slc
+ 0.06299 0.06299 sc
+} bind def
+/pagefooter {
+$F2psEnd
+restore
+} bind def
+%%EndProlog
+pageheader
+%
+% Fig objects follow
+%
+% 
+% here starts figure with depth 0
+% Arc
+15.000 slw
+0 slc
+n 2612.5 1500.0 312.5 73.7407 -73.7407 arcn
 gs col-1 s gr
-0.500 setlinewidth
+
 % Ellipse
-n 79 169 10 10 0 360 DrawEllipse gs 0.00 setgray fill gr
-gs col-1 s gr
+7.500 slw
+n 1200 2550 150 150 0 360 DrawEllipse gs 0.00 setgray ef gr gs col-1 s gr
+
 % Ellipse
-n 119 99 10 10 0 360 DrawEllipse gs 0.00 setgray fill gr
-gs col-1 s gr
+n 1800 1500 150 150 0 360 DrawEllipse gs 0.00 setgray ef gr gs col-1 s gr
+
 % Ellipse
-n 239 99 10 10 0 360 DrawEllipse gs 0.00 setgray fill gr
-gs col-1 s gr
+n 3600 1500 150 150 0 360 DrawEllipse gs 0.00 setgray ef gr gs col-1 s gr
+
 % Ellipse
-n 299 39 10 10 0 360 DrawEllipse gs 0.00 setgray fill gr
-gs col-1 s gr
-1.000 setlinewidth
+n 4500 600 150 150 0 360 DrawEllipse gs 0.00 setgray ef gr gs col-1 s gr
+
 % Polyline
-n 114 109 m 79 169 l gs col-1 s gr
+0 slj
+15.000 slw
+n 1725 1650 m
+ 1200 2550 l gs col-1 s gr 
 % Polyline
-n 129 99 m 229 99 l gs col-1 s gr
+n 1950 1500 m
+ 3450 1500 l gs col-1 s gr 
 % Polyline
-n 249 94 m 294 49 l gs col-1 s gr
+n 3750 1425 m
+ 4425 750 l gs col-1 s gr 
 % Polyline
-n 179 79 m 189 79 l gs col-1 s gr
+n 2700 1200 m
+ 2850 1200 l gs col-1 s gr 
 % Polyline
-n 179 79 m 184 84 l gs col-1 s gr
-/Helvetica-Bold findfont 14.00 scalefont setfont
-139 89 m 
-gs 1 -1 scale (j) col-1 show gr
-/Helvetica-Bold findfont 14.00 scalefont setfont
-259 114 m 
-gs 1 -1 scale (k) col-1 show gr
-/Helvetica-Bold findfont 14.00 scalefont setfont
-314 34 m 
-gs 1 -1 scale (l) col-1 show gr
-/Helvetica-Bold findfont 14.00 scalefont setfont
-94 174 m 
-gs 1 -1 scale (i) col-1 show gr
-$F2psEnd
+n 2700 1200 m
+ 2775 1275 l gs col-1 s gr 
+/Helvetica-Bold ff 222.25 scf sf
+2100 1350 m
+gs 1 -1 sc (j) col-1 sh gr
+/Helvetica-Bold ff 222.25 scf sf
+3900 1725 m
+gs 1 -1 sc (k) col-1 sh gr
+/Helvetica-Bold ff 222.25 scf sf
+4725 525 m
+gs 1 -1 sc (l) col-1 sh gr
+/Helvetica-Bold ff 222.25 scf sf
+1425 2625 m
+gs 1 -1 sc (i) col-1 sh gr
+% here ends figure;
+pagefooter
+showpage
+%%Trailer
+%EOF
index c237ec2f6018578e21eac345cbd35c0df97c1a1f..aa43a8a884d92c94f64690d182b99b952467578c 100644 (file)
@@ -1,15 +1,27 @@
-%!PS-Adobe-3.0 EPSF-3.0
-%%BoundingBox: (atend)
+%!PS-Adobe-2.0 EPSF-2.0
+%%BoundingBox: 23 19 566 779
+%%HiResBoundingBox: 23.000000 19.000000 566.000000 779.000000
 %%LanguageLevel: 2
-%%Creator: Grace-5.1.14
-%%CreationDate: Thu Mar 30 17:18:42 2006
+%%Creator: Grace-5.1.23
+%%CreationDate: Fri Jun 13 15:46:08 2014
 %%DocumentData: Clean8Bit
-%%Orientation: Portrait
-%%Title: f_angle.xvg
-%%For: spoel
-%%DocumentNeededResources: (atend)
+%%PageOrder: Ascend
+%%Title: manual/plots/f-angle.xvg
+%%For: marklocal
 %%EndComments
+% EPSF created by ps2eps 1.68
 %%BeginProlog
+save
+countdictstack
+mark
+newpath
+/showpage {} def
+/setpagedevice {pop} def
+%%EndProlog
+%%Page 1 1
+%%BeginProlog
+/PAGE_OFFSET_X 0 def
+/PAGE_OFFSET_Y 0 def
 /m {moveto} def
 /l {lineto} def
 /s {stroke} def
@@ -45,6 +57,9 @@
 /Color13 {0.4039 0.0275 0.2824} def
 /Color14 {0.2510 0.8784 0.8157} def
 /Color15 {0.0000 0.5451 0.0000} def
+/Color16 {0.7529 0.7529 0.7529} def
+/Color17 {0.5059 0.5059 0.5059} def
+/Color18 {0.2588 0.2588 0.2588} def
 /PTRN {
  /pat_bits exch def 
  <<
@@ -391,8 +406,12 @@ ellipsedict /mtrx matrix put
 ] def
 %%EndProlog
 %%BeginSetup
-612.00 612.00 scale
 %%EndSetup
+%%Page: 1 1
+PAGE_OFFSET_X PAGE_OFFSET_Y translate
+612.00 612.00 scale
+90 rotate
+0.0 -1.0 translate
 n
 0.0000 0.0000 m
 0.0000 1.0000 l
@@ -696,40 +715,40 @@ dup length dict begin
  /Encoding DefEncoding def
  currentdict
 end
-/Font4 exch definefont pop
-/Font4 FFSF
+/Font16 exch definefont pop
+/Font16 FFSF
 0.1220 0.1157 m
 GS
 [0.0344 0.0000 0.0000 0.0344 0 0] CC
 (100) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.3957 0.1157 m
 GS
 [0.0344 0.0000 0.0000 0.0344 0 0] CC
 (110) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.6695 0.1157 m
 GS
 [0.0344 0.0000 0.0000 0.0344 0 0] CC
 (120) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.9433 0.1157 m
 GS
 [0.0344 0.0000 0.0000 0.0344 0 0] CC
 (130) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 1.2171 0.1157 m
 GS
 [0.0344 0.0000 0.0000 0.0344 0 0] CC
 (140) show
 GR
 /Symbol findfont
-/Font12 exch definefont pop
-/Font12 FFSF
+/Font37 exch definefont pop
+/Font37 FFSF
 0.6876 0.0763 m
 GS
 [0.0414 0.0000 0.0000 0.0414 0 0] CC
@@ -831,67 +850,67 @@ n
 1.2451 0.9500 m
 1.2251 0.9500 l
 s
-/Font4 FFSF
+/Font16 FFSF
 0.1224 0.1382 m
 GS
 [0.0344 0.0000 0.0000 0.0344 0 0] CC
 (0) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.1031 0.2982 m
 GS
 [0.0344 0.0000 0.0000 0.0344 0 0] CC
 (10) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.1031 0.4582 m
 GS
 [0.0344 0.0000 0.0000 0.0344 0 0] CC
 (20) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.1031 0.6182 m
 GS
 [0.0344 0.0000 0.0000 0.0344 0 0] CC
 (30) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.1031 0.7782 m
 GS
 [0.0344 0.0000 0.0000 0.0344 0 0] CC
 (40) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.1031 0.9382 m
 GS
 [0.0344 0.0000 0.0000 0.0344 0 0] CC
 (50) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.0762 0.4263 m
 GS
 [0.0000 0.0414 -0.0414 0.0000 0 0] CC
 (V) show
 GR
-/Font12 FFSF
+/Font37 FFSF
 0.0927 0.4537 m
 GS
 [0.0000 0.0293 -0.0293 0.0000 0 0] CC
 (q) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.0762 0.4690 m
 GS
 [0.0000 0.0414 -0.0414 0.0000 0 0] CC
 ( \(kJ mole) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.0513 0.6373 m
 GS
 [0.0000 0.0293 -0.0293 0.0000 0 0] CC
 (-1) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.0762 0.6631 m
 GS
 [0.0000 0.0414 -0.0414 0.0000 0 0] CC
@@ -905,8 +924,14 @@ n
 0.1500 0.1500 l
 c
 s
+showpage
+%%PageTrailer
 %%Trailer
-%%BoundingBox: 17 45 781 591
 %%DocumentNeededResources: font Helvetica
 %%+ font Symbol
+%%Trailer
+cleartomark
+countdictstack
+exch sub { end } repeat
+restore
 %%EOF
index e576b2226f53f9397a05534768f6be2aa54d7d82..449b24b46b1a039d2d9b19f302a842e3037d1c2c 100644 (file)
@@ -1,15 +1,27 @@
-%!PS-Adobe-3.0 EPSF-3.0
-%%BoundingBox: (atend)
+%!PS-Adobe-2.0 EPSF-2.0
+%%BoundingBox: 179 53 432 703
+%%HiResBoundingBox: 179.000000 53.500000 431.500000 702.500000
 %%LanguageLevel: 2
-%%Creator: Grace-5.1.22
-%%CreationDate: Fri Mar  9 09:37:59 2012
+%%Creator: Grace-5.1.23
+%%CreationDate: Fri Jun 13 16:01:20 2014
 %%DocumentData: Clean8Bit
-%%Orientation: Portrait
-%%Title: fbposres.xvg
-%%For: jhub
-%%DocumentNeededResources: (atend)
+%%PageOrder: Ascend
+%%Title: manual/plots/fbposres.xvg
+%%For: marklocal
 %%EndComments
+% EPSF created by ps2eps 1.68
 %%BeginProlog
+save
+countdictstack
+mark
+newpath
+/showpage {} def
+/setpagedevice {pop} def
+%%EndProlog
+%%Page 1 1
+%%BeginProlog
+/PAGE_OFFSET_X 0 def
+/PAGE_OFFSET_Y 0 def
 /m {moveto} def
 /l {lineto} def
 /s {stroke} def
@@ -52,6 +64,9 @@
 /Color20 {0.5882 0.5882 1.0000} def
 /Color21 {0.0000 0.6275 0.0000} def
 /Color22 {0.0000 0.7059 0.0000} def
+/Color23 {0.7529 0.7529 0.7529} def
+/Color24 {0.5059 0.5059 0.5059} def
+/Color25 {0.2588 0.2588 0.2588} def
 /PTRN {
  /pat_bits exch def 
  <<
@@ -399,7 +414,11 @@ ellipsedict /mtrx matrix put
 %%EndProlog
 %%BeginSetup
 %%EndSetup
+%%Page: 1 1
+PAGE_OFFSET_X PAGE_OFFSET_Y translate
 612.00 612.00 scale
+90 rotate
+0.0 -1.0 translate
 n
 0.0000 0.0000 m
 0.0000 1.0000 l
@@ -596,38 +615,38 @@ dup length dict begin
  /Encoding DefEncoding def
  currentdict
 end
-/Font4 exch definefont pop
-/Font4 FFSF
+/Font16 exch definefont pop
+/Font16 FFSF
 0.1427 0.3251 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (-1) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.2453 0.3251 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (-0.5) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.3706 0.3251 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (0) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.4746 0.3251 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (0.5) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.5981 0.3251 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (1) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.3499 0.2994 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
@@ -737,44 +756,44 @@ n
 0.6019 0.7000 m
 0.5819 0.7000 l
 s
-/Font4 FFSF
+/Font16 FFSF
 0.1294 0.3746 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (0) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.1176 0.4382 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (10) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.1176 0.5018 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (20) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.1176 0.5655 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (30) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.1176 0.6291 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (40) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.1176 0.6927 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (50) show
 GR
-/Font4 FFSF
-0.1033 0.4691 m
+/Font16 FFSF
+0.1029 0.4691 m
 GS
 [0.0000 0.0210 -0.0210 0.0000 0 0] CC
 (V\(r\) [kJ/mol]) show
@@ -969,37 +988,37 @@ n
 1.1441 0.7000 m
 1.1441 0.6800 l
 s
-/Font4 FFSF
+/Font16 FFSF
 0.6850 0.3251 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (-1) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.7876 0.3251 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (-0.5) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.9129 0.3251 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (0) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 1.0168 0.3251 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (0.5) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 1.1404 0.3251 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (1) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.8921 0.2994 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 1.1441 0.7000 m
 1.1241 0.7000 l
 s
-/Font4 FFSF
+/Font16 FFSF
 0.6717 0.3746 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (0) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.6599 0.4382 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (10) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.6599 0.5018 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (20) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.6599 0.5655 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (30) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.6599 0.6291 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 (40) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.6599 0.6927 m
 GS
 [0.0210 0.0000 0.0000 0.0210 0 0] CC
 0.4669 0.4449 l
 0.4569 0.4499 l
 s
-/Font4 FFSF
+/Font16 FFSF
 0.3407 0.4816 m
 GS
 [0.0280 0.0000 0.0000 0.0280 0 0] CC
 (2 r) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.3732 0.4704 m
 GS
 [0.0198 0.0000 0.0000 0.0198 0 0] CC
 (fb) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.2169 0.6348 m
 GS
 [0.0280 0.0000 0.0000 0.0280 0 0] CC
 (A) show
 GR
-/Font4 FFSF
+/Font16 FFSF
 0.7475 0.6324 m
 GS
 [0.0280 0.0000 0.0000 0.0280 0 0] CC
 (B) show
 GR
+showpage
+%%PageTrailer
 %%Trailer
-%%BoundingBox: 52 179 704 435
 %%DocumentNeededResources: font Helvetica
+%%Trailer
+cleartomark
+countdictstack
+exch sub { end } repeat
+restore
 %%EOF
index c5638116b5e48593c39062e7d4d3954b18dcacf2..87782be2f792f48655dd0239f6203477670c77a3 100644 (file)
@@ -1190,7 +1190,7 @@ in \tabref{topfile2}} \\
 \newcommand{\ttss}{\tt \scriptsize}
 
 \begin{landscape}
-\begin{longtable}{|l|lcc>{\raggedright}p{2.5in}cc|}
+\begin{longtable}{|p{1.8in}|lcc>{\raggedright}p{2.5in}cc|}
 \caption{Details of {\tt [~moleculetype~]} directives}\\
 \dline
 Name of interaction              & Topology file directive          & num.  & func. & Order of parameters and their units                   & use in     & Cross- \\
@@ -1199,8 +1199,11 @@ Name of interaction              & Topology file directive          & num.  & fu
 \endhead
 \dline
 \endfoot
-\label{tab:topfile2}\footnotetext[1]{The required number of atom indices for this directive}\footnotetext[2]{The index to use to select this function type}\footnotetext[3]{Indicates which of the parameters for this interaction can be interpolated during free energy calculations}\footnotetext[4]{This interaction type will be used by {{\tts grompp}} for generating exclusions}\footnotetext[5]{This interaction type can be converted to constraints by {{\tts grompp}}}\footnotetext[7]{The combination rule determines the type of LJ parameters, see~\ssecref{nbpar}}\footnotetext[6]{No connection, and so no exclusions, are generated for this interaction}bond
-                                   & {\tts bonds}\fnm{4},\fnm{5}    & 2     & 1     & $b_0$ (nm); $k_b$ (\kJmolnm{-2})                      & all        & \ssecref{harmonicbond} \\
+% The footnotetext fields only work inside the body, and not from a
+% column with ``p'' formatting'!
+bond                               & {\tts bonds}\fnm{4},\fnm{5}    & 2     & 1     & $b_0$ (nm); $k_b$ (\kJmolnm{-2})                      & all        & \ssecref{harmonicbond}
+\label{tab:topfile2} \footnotetext[1]{The required number of atom indices for this directive}\footnotetext[2]{The index to use to select this function type}\footnotetext[3]{Indicates which of the parameters for this interaction can be interpolated during free energy calculations}\footnotetext[4]{This interaction type will be used by {{\tts grompp}} for generating exclusions}\footnotetext[5]{This interaction type can be converted to constraints by {{\tts grompp}}}\footnotetext[7]{The combination rule determines the type of LJ parameters, see~\ssecref{nbpar}}\footnotetext[6]{No connection, and so no exclusions, are generated for this interaction}
+\\
 G96 bond                           & {\tts bonds}\fnm{4},\fnm{5}    & 2     & 2     & $b_0$ (nm); $k_b$ (\kJmolnm{-4})                      & all        & \ssecref{G96bond} \\
 Morse                              & {\tts bonds}\fnm{4},\fnm{5}    & 2     & 3     & $b_0$ (nm); $D$ (\kJmol); $\beta$ (nm$^{-1}$)         & all        & \ssecref{Morsebond} \\
 cubic bond                         & {\tts bonds}\fnm{4},\fnm{5}    & 2     & 4     & $b_0$ (nm); $C_{i=2,3}$ (\kJmolnm{-i})                &            & \ssecref{cubicbond} \\
@@ -1362,6 +1365,11 @@ Urea         3
    2     1     1000       0    1000 ; Restrain to a line (Y-axis)
    3     1     1000       0       0 ; Restrain to a plane (Y-Z-plane)
 
+[ dihedral_restraints ]
+; ai   aj    ak    al  type  label  phi  dphi  kfac  power
+    3    6     1    2     1      1  180     0     1      2
+    1    4     3    5     1      1  180     0     1      2
+
 ; Include TIP3P water topology
 #include "amber99/tip3p.itp"
 
@@ -1471,6 +1479,19 @@ to reference positions (\ssecref{positionrestraint}).
 The reference positions are read from a 
 separate coordinate file by {\tt \normindex{grompp}}.
 
+
+{\bf {\tt [~dihedral_restraints~]} :} restrain selected dihedrals to a reference value.
+The implementation of dihedral restraints is described in section \ssecref{dihedralrestraint} of the manual.
+The parameters specified in the [dihedral_restraints] directive are as follows:
+\begin{itemize}
+\item {\tt type} has only one possible value which is 1
+\item {\tt label} is unused and has been removed from the code.
+\item {\tt phi} is the value of $\phi_0$ in \eqnref{dphi} and \eqnref{dihre} of the manual.
+\item {\tt dphi} is the value of $\Delta\phi$ in \eqnref{dihre} of the manual.
+\item {\tt kfac} is analogous to {\tt fac} in the implementation of distance restraints. It is the factor by which the force constant is multiplied. By doing so, different restraints can be maintained with different force constants.
+\item {\tt power} is unused and has been removed from the code.
+\end{itemize}
+
 {\bf {\tt \#include "tip3p.itp"} :} includes a topology file that was already
 constructed (see section~\ssecref{molitp}).
 
@@ -1863,7 +1884,7 @@ tensor, not a vector.
 \label{subsec:fffiles}
 Many force fields are available by default.
 Force fields are detected by the presence of {\tt <name>.ff} directories
-in the {\gromacs} {\tt /share/top} sub-directory and/or the working directory.
+in the {\tt \$GMXLIB/share/gromacs/top} sub-directory and/or the working directory.
 The information regarding the location of the force field files is printed
 by {\tt pdb2gmx} so you can easily keep track of which version of a force field
 is being called, in case you have made modifications in one location or another.
index ebbec487aefac7c710335f96193c9cee8a7813a2..d55efb5372540f9f9b8a51ae0089a7b999d2b7d0 100644 (file)
@@ -111,7 +111,6 @@ ns-type                  = grid
 pbc                      = xyz
 ; nblist cut-off         = 
 rlist                    = 0.8
-domain-decomposition     = no
 
 ; OPTIONS FOR ELECTROSTATICS AND VDW = 
 ; Method for doing electrostatics = 
index 7ab2d5df163d2070f0e8ea1216dfa353720df7a8..cf05d983594a5469948f3cee81a7225ee99c8f84 100644 (file)
@@ -1357,8 +1357,8 @@ 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.</dd>
 </dl></dd>
 <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
+<dd>the distance components to be used with geometry <b>distance</b>,
+and also sets which components are printed
 to the output files</dd>
 <dt><b>pull-r1: (1) [nm]</b></dt>
 <dd>the inner radius of the cylinder for geometry <b>cylinder</b></dd>
index 363f1c6a32d0da3bc3f3920be6760e603f52f352..ad74dcde140bc88f978adf5241f30271f32baf7b 100644 (file)
@@ -1,38 +1,35 @@
 [ implicit_genborn_params ]
-
 ; atype      sar      st     pi       gbr       hct
-C            0.172    1      1.554    0.1875    0.72 ; C
-CA           0.18     1      1.037    0.1875    0.72 ; C
-CB           0.172    0.012  1.554    0.1875    0.72 ; C
-CC           0.172    1      1.554    0.1875    0.72 ; C
-CN           0.172    0.012  1.554    0.1875    0.72 ; C
-CR           0.18     1      1.073    0.1875    0.72 ; C
-CT           0.18     1      1.276    0.190     0.72 ; C
-CV           0.18     1      1.073    0.1875    0.72 ; C 
-CW           0.18     1      1.073    0.1875    0.72 ; C
-C*           0.172    0.012  1.554    0.1875    0.72 ; C
-H            0.1      1      1        0.115     0.85 ; H
-HC           0.1      1      1        0.125     0.85 ; H
-H0           0.1      1      1        0.125     0.85 ; H
-H1           0.1      1      1        0.125     0.85 ; H
-HA           0.1      1      1        0.125     0.85 ; H
-H4           0.1      1      1        0.115     0.85 ; H
-H5           0.1      1      1        0.125     0.85 ; H
-HO           0.1      1      1        0.105     0.85 ; H
-HS           0.1      1      1        0.125     0.85 ; H
-HP           0.1      1      1        0.125     0.85 ; H
-N            0.155    1      1.028    0.17063   0.79 ; N
-NA           0.155    1      1.028    0.17063   0.79 ; N
-NB           0.155    1      1.215    0.17063   0.79 ; N
-N2           0.16     1      1.215    0.17063   0.79 ; N
-N3           0.16     1      1.215    0.1625    0.79 ; N
-O            0.15     1      0.926    0.148     0.85 ; O
-OH           0.152    1      1.080    0.1535    0.85 ; O
-O2           0.17     1      0.922    0.148     0.85 ; O
-S            0.18     1      1.121    0.1775    0.96 ; S
-SH           0.18     1      1.121    0.1775    0.96 ; S
-
+;Br           0.1      1      1        0.125     0.85 ; H
+C            0.172    1      1.554    0.17    0.72 ; C
+CA           0.18     1      1.037    0.17    0.72 ; C
+CB           0.172    0.012  1.554    0.17    0.72 ; C
+CC           0.172    1      1.554    0.17    0.72 ; C
+CN           0.172    0.012  1.554    0.17    0.72 ; C
+CR           0.18     1      1.073    0.17    0.72 ; C
+CT           0.18     1      1.276    0.17     0.72 ; C
+CV           0.18     1      1.073    0.17    0.72 ; C
+CW           0.18     1      1.073    0.17    0.72 ; C
+C*           0.172    0.012  1.554    0.17    0.72 ; C
+H            0.1      1      1        0.13     0.85 ; H
+HC           0.1      1      1        0.12     0.85 ; H
+H1           0.1      1      1        0.12     0.85 ; H
+HA           0.1      1      1        0.12     0.85 ; H
+H4           0.1      1      1        0.12     0.85 ; H
+H5           0.1      1      1        0.12     0.85 ; H
+HO           0.1      1      1        0.12     0.85 ; H
+HS           0.1      1      1        0.12     0.85 ; H
+HP           0.1      1      1        0.12     0.85 ; H
+N            0.155    1      1.028    0.155   0.79 ; N
+NA           0.155    1      1.028    0.155   0.79 ; N
+NB           0.155    1      1.215    0.155   0.79 ; N
+N2           0.16     1      1.215    0.155   0.79 ; N
+N3           0.16     1      1.215    0.155    0.79 ; N
+O            0.15     1      0.926    0.15     0.85 ; O
+OH           0.152    1      1.080    0.15    0.85 ; O
+O2           0.17     1      0.922    0.15     0.85 ; O
+S            0.18     1      1.121    0.18    0.96 ; S
+SH           0.18     1      1.121    0.18    0.96 ; S
 ; masscenters for vsites do not have gbsa parameters
-
 MNH3         0        0      0        0         0
 MCH3         0        0      0        0         0
index c3120b0ed1e9345c044dc59215e7e5b55876c178..007b57acda9154e630a58e5e43178ddf7fee7b40 100644 (file)
@@ -1,3 +1,8 @@
+; original reference: [M. W. Mahoney and W. L. Jorgensen, J. Chem. Phys. 112 , 2000]
+;
+; Note that there are various issues with tip5p and the different forcefields.
+; Discussion is here: http://redmine.gromacs.org/issues/1348
+
 [ moleculetype ]
 ; molname      nrexcl
 SOL            2
index 420808db5e5779b24161f08d306c6dda18d5ec8e..7e4956a7e9a47dd4fafbf390fb65446eade24058 100644 (file)
@@ -1,5 +1,6 @@
 tip3p    TIP3P     TIP 3-point, recommended
 tip4p    TIP4P     TIP 4-point
 tip4pew  TIP4P-Ew  TIP 4-point optimized with Ewald
+tip5p    TIP5P     TIP 5-point (see http://redmine.gromacs.org/issues/1348 for issues)
 spc      SPC       simple point charge
 spce     SPC/E     extended simple point charge
index e4197c9ab445342b9f41e6528939939ff5bf6651..ad74dcde140bc88f978adf5241f30271f32baf7b 100644 (file)
@@ -1,38 +1,35 @@
 [ implicit_genborn_params ]
-
 ; atype      sar      st     pi       gbr       hct
-;H0           0.1      1      1        0.125     0.85 ; H
-C            0.172    1      1.554    0.1875    0.72 ; C
-CA           0.18     1      1.037    0.1875    0.72 ; C
-CB           0.172    0.012  1.554    0.1875    0.72 ; C
-CC           0.172    1      1.554    0.1875    0.72 ; C
-CN           0.172    0.012  1.554    0.1875    0.72 ; C
-CR           0.18     1      1.073    0.1875    0.72 ; C
-CT           0.18     1      1.276    0.190     0.72 ; C
-CV           0.18     1      1.073    0.1875    0.72 ; C 
-CW           0.18     1      1.073    0.1875    0.72 ; C
-C*           0.172    0.012  1.554    0.1875    0.72 ; C
-H            0.1      1      1        0.115     0.85 ; H
-HC           0.1      1      1        0.125     0.85 ; H
-H1           0.1      1      1        0.125     0.85 ; H
-HA           0.1      1      1        0.125     0.85 ; H
-H4           0.1      1      1        0.115     0.85 ; H
-H5           0.1      1      1        0.125     0.85 ; H
-HO           0.1      1      1        0.105     0.85 ; H
-HS           0.1      1      1        0.125     0.85 ; H
-HP           0.1      1      1        0.125     0.85 ; H
-N            0.155    1      1.028    0.17063   0.79 ; N
-NA           0.155    1      1.028    0.17063   0.79 ; N
-NB           0.155    1      1.215    0.17063   0.79 ; N
-N2           0.16     1      1.215    0.17063   0.79 ; N
-N3           0.16     1      1.215    0.1625    0.79 ; N
-O            0.15     1      0.926    0.148     0.85 ; O
-OH           0.152    1      1.080    0.1535    0.85 ; O
-O2           0.17     1      0.922    0.148     0.85 ; O
-S            0.18     1      1.121    0.1775    0.96 ; S
-SH           0.18     1      1.121    0.1775    0.96 ; S
-
+;Br           0.1      1      1        0.125     0.85 ; H
+C            0.172    1      1.554    0.17    0.72 ; C
+CA           0.18     1      1.037    0.17    0.72 ; C
+CB           0.172    0.012  1.554    0.17    0.72 ; C
+CC           0.172    1      1.554    0.17    0.72 ; C
+CN           0.172    0.012  1.554    0.17    0.72 ; C
+CR           0.18     1      1.073    0.17    0.72 ; C
+CT           0.18     1      1.276    0.17     0.72 ; C
+CV           0.18     1      1.073    0.17    0.72 ; C
+CW           0.18     1      1.073    0.17    0.72 ; C
+C*           0.172    0.012  1.554    0.17    0.72 ; C
+H            0.1      1      1        0.13     0.85 ; H
+HC           0.1      1      1        0.12     0.85 ; H
+H1           0.1      1      1        0.12     0.85 ; H
+HA           0.1      1      1        0.12     0.85 ; H
+H4           0.1      1      1        0.12     0.85 ; H
+H5           0.1      1      1        0.12     0.85 ; H
+HO           0.1      1      1        0.12     0.85 ; H
+HS           0.1      1      1        0.12     0.85 ; H
+HP           0.1      1      1        0.12     0.85 ; H
+N            0.155    1      1.028    0.155   0.79 ; N
+NA           0.155    1      1.028    0.155   0.79 ; N
+NB           0.155    1      1.215    0.155   0.79 ; N
+N2           0.16     1      1.215    0.155   0.79 ; N
+N3           0.16     1      1.215    0.155    0.79 ; N
+O            0.15     1      0.926    0.15     0.85 ; O
+OH           0.152    1      1.080    0.15    0.85 ; O
+O2           0.17     1      0.922    0.15     0.85 ; O
+S            0.18     1      1.121    0.18    0.96 ; S
+SH           0.18     1      1.121    0.18    0.96 ; S
 ; masscenters for vsites do not have gbsa parameters
-
 MNH3         0        0      0        0         0
 MCH3         0        0      0        0         0
index c3120b0ed1e9345c044dc59215e7e5b55876c178..007b57acda9154e630a58e5e43178ddf7fee7b40 100644 (file)
@@ -1,3 +1,8 @@
+; original reference: [M. W. Mahoney and W. L. Jorgensen, J. Chem. Phys. 112 , 2000]
+;
+; Note that there are various issues with tip5p and the different forcefields.
+; Discussion is here: http://redmine.gromacs.org/issues/1348
+
 [ moleculetype ]
 ; molname      nrexcl
 SOL            2
index 420808db5e5779b24161f08d306c6dda18d5ec8e..7e4956a7e9a47dd4fafbf390fb65446eade24058 100644 (file)
@@ -1,5 +1,6 @@
 tip3p    TIP3P     TIP 3-point, recommended
 tip4p    TIP4P     TIP 4-point
 tip4pew  TIP4P-Ew  TIP 4-point optimized with Ewald
+tip5p    TIP5P     TIP 5-point (see http://redmine.gromacs.org/issues/1348 for issues)
 spc      SPC       simple point charge
 spce     SPC/E     extended simple point charge
index e4197c9ab445342b9f41e6528939939ff5bf6651..ad74dcde140bc88f978adf5241f30271f32baf7b 100644 (file)
@@ -1,38 +1,35 @@
 [ implicit_genborn_params ]
-
 ; atype      sar      st     pi       gbr       hct
-;H0           0.1      1      1        0.125     0.85 ; H
-C            0.172    1      1.554    0.1875    0.72 ; C
-CA           0.18     1      1.037    0.1875    0.72 ; C
-CB           0.172    0.012  1.554    0.1875    0.72 ; C
-CC           0.172    1      1.554    0.1875    0.72 ; C
-CN           0.172    0.012  1.554    0.1875    0.72 ; C
-CR           0.18     1      1.073    0.1875    0.72 ; C
-CT           0.18     1      1.276    0.190     0.72 ; C
-CV           0.18     1      1.073    0.1875    0.72 ; C 
-CW           0.18     1      1.073    0.1875    0.72 ; C
-C*           0.172    0.012  1.554    0.1875    0.72 ; C
-H            0.1      1      1        0.115     0.85 ; H
-HC           0.1      1      1        0.125     0.85 ; H
-H1           0.1      1      1        0.125     0.85 ; H
-HA           0.1      1      1        0.125     0.85 ; H
-H4           0.1      1      1        0.115     0.85 ; H
-H5           0.1      1      1        0.125     0.85 ; H
-HO           0.1      1      1        0.105     0.85 ; H
-HS           0.1      1      1        0.125     0.85 ; H
-HP           0.1      1      1        0.125     0.85 ; H
-N            0.155    1      1.028    0.17063   0.79 ; N
-NA           0.155    1      1.028    0.17063   0.79 ; N
-NB           0.155    1      1.215    0.17063   0.79 ; N
-N2           0.16     1      1.215    0.17063   0.79 ; N
-N3           0.16     1      1.215    0.1625    0.79 ; N
-O            0.15     1      0.926    0.148     0.85 ; O
-OH           0.152    1      1.080    0.1535    0.85 ; O
-O2           0.17     1      0.922    0.148     0.85 ; O
-S            0.18     1      1.121    0.1775    0.96 ; S
-SH           0.18     1      1.121    0.1775    0.96 ; S
-
+;Br           0.1      1      1        0.125     0.85 ; H
+C            0.172    1      1.554    0.17    0.72 ; C
+CA           0.18     1      1.037    0.17    0.72 ; C
+CB           0.172    0.012  1.554    0.17    0.72 ; C
+CC           0.172    1      1.554    0.17    0.72 ; C
+CN           0.172    0.012  1.554    0.17    0.72 ; C
+CR           0.18     1      1.073    0.17    0.72 ; C
+CT           0.18     1      1.276    0.17     0.72 ; C
+CV           0.18     1      1.073    0.17    0.72 ; C
+CW           0.18     1      1.073    0.17    0.72 ; C
+C*           0.172    0.012  1.554    0.17    0.72 ; C
+H            0.1      1      1        0.13     0.85 ; H
+HC           0.1      1      1        0.12     0.85 ; H
+H1           0.1      1      1        0.12     0.85 ; H
+HA           0.1      1      1        0.12     0.85 ; H
+H4           0.1      1      1        0.12     0.85 ; H
+H5           0.1      1      1        0.12     0.85 ; H
+HO           0.1      1      1        0.12     0.85 ; H
+HS           0.1      1      1        0.12     0.85 ; H
+HP           0.1      1      1        0.12     0.85 ; H
+N            0.155    1      1.028    0.155   0.79 ; N
+NA           0.155    1      1.028    0.155   0.79 ; N
+NB           0.155    1      1.215    0.155   0.79 ; N
+N2           0.16     1      1.215    0.155   0.79 ; N
+N3           0.16     1      1.215    0.155    0.79 ; N
+O            0.15     1      0.926    0.15     0.85 ; O
+OH           0.152    1      1.080    0.15    0.85 ; O
+O2           0.17     1      0.922    0.15     0.85 ; O
+S            0.18     1      1.121    0.18    0.96 ; S
+SH           0.18     1      1.121    0.18    0.96 ; S
 ; masscenters for vsites do not have gbsa parameters
-
 MNH3         0        0      0        0         0
 MCH3         0        0      0        0         0
index c3120b0ed1e9345c044dc59215e7e5b55876c178..007b57acda9154e630a58e5e43178ddf7fee7b40 100644 (file)
@@ -1,3 +1,8 @@
+; original reference: [M. W. Mahoney and W. L. Jorgensen, J. Chem. Phys. 112 , 2000]
+;
+; Note that there are various issues with tip5p and the different forcefields.
+; Discussion is here: http://redmine.gromacs.org/issues/1348
+
 [ moleculetype ]
 ; molname      nrexcl
 SOL            2
index 420808db5e5779b24161f08d306c6dda18d5ec8e..7e4956a7e9a47dd4fafbf390fb65446eade24058 100644 (file)
@@ -1,5 +1,6 @@
 tip3p    TIP3P     TIP 3-point, recommended
 tip4p    TIP4P     TIP 4-point
 tip4pew  TIP4P-Ew  TIP 4-point optimized with Ewald
+tip5p    TIP5P     TIP 5-point (see http://redmine.gromacs.org/issues/1348 for issues)
 spc      SPC       simple point charge
 spce     SPC/E     extended simple point charge
index 632e8cbe13a3d8d188e388681901e7843c940982..ad74dcde140bc88f978adf5241f30271f32baf7b 100644 (file)
@@ -1,38 +1,35 @@
 [ implicit_genborn_params ]
-
 ; atype      sar      st     pi       gbr       hct
 ;Br           0.1      1      1        0.125     0.85 ; H
-C            0.172    1      1.554    0.1875    0.72 ; C
-CA           0.18     1      1.037    0.1875    0.72 ; C
-CB           0.172    0.012  1.554    0.1875    0.72 ; C
-CC           0.172    1      1.554    0.1875    0.72 ; C
-CN           0.172    0.012  1.554    0.1875    0.72 ; C
-CR           0.18     1      1.073    0.1875    0.72 ; C
-CT           0.18     1      1.276    0.190     0.72 ; C
-CV           0.18     1      1.073    0.1875    0.72 ; C 
-CW           0.18     1      1.073    0.1875    0.72 ; C
-C*           0.172    0.012  1.554    0.1875    0.72 ; C
-H            0.1      1      1        0.115     0.85 ; H
-HC           0.1      1      1        0.125     0.85 ; H
-H1           0.1      1      1        0.125     0.85 ; H
-HA           0.1      1      1        0.125     0.85 ; H
-H4           0.1      1      1        0.115     0.85 ; H
-H5           0.1      1      1        0.125     0.85 ; H
-HO           0.1      1      1        0.105     0.85 ; H
-HS           0.1      1      1        0.125     0.85 ; H
-HP           0.1      1      1        0.125     0.85 ; H
-N            0.155    1      1.028    0.17063   0.79 ; N
-NA           0.155    1      1.028    0.17063   0.79 ; N
-NB           0.155    1      1.215    0.17063   0.79 ; N
-N2           0.16     1      1.215    0.17063   0.79 ; N
-N3           0.16     1      1.215    0.1625    0.79 ; N
-O            0.15     1      0.926    0.148     0.85 ; O
-OH           0.152    1      1.080    0.1535    0.85 ; O
-O2           0.17     1      0.922    0.148     0.85 ; O
-S            0.18     1      1.121    0.1775    0.96 ; S
-SH           0.18     1      1.121    0.1775    0.96 ; S
-
+C            0.172    1      1.554    0.17    0.72 ; C
+CA           0.18     1      1.037    0.17    0.72 ; C
+CB           0.172    0.012  1.554    0.17    0.72 ; C
+CC           0.172    1      1.554    0.17    0.72 ; C
+CN           0.172    0.012  1.554    0.17    0.72 ; C
+CR           0.18     1      1.073    0.17    0.72 ; C
+CT           0.18     1      1.276    0.17     0.72 ; C
+CV           0.18     1      1.073    0.17    0.72 ; C
+CW           0.18     1      1.073    0.17    0.72 ; C
+C*           0.172    0.012  1.554    0.17    0.72 ; C
+H            0.1      1      1        0.13     0.85 ; H
+HC           0.1      1      1        0.12     0.85 ; H
+H1           0.1      1      1        0.12     0.85 ; H
+HA           0.1      1      1        0.12     0.85 ; H
+H4           0.1      1      1        0.12     0.85 ; H
+H5           0.1      1      1        0.12     0.85 ; H
+HO           0.1      1      1        0.12     0.85 ; H
+HS           0.1      1      1        0.12     0.85 ; H
+HP           0.1      1      1        0.12     0.85 ; H
+N            0.155    1      1.028    0.155   0.79 ; N
+NA           0.155    1      1.028    0.155   0.79 ; N
+NB           0.155    1      1.215    0.155   0.79 ; N
+N2           0.16     1      1.215    0.155   0.79 ; N
+N3           0.16     1      1.215    0.155    0.79 ; N
+O            0.15     1      0.926    0.15     0.85 ; O
+OH           0.152    1      1.080    0.15    0.85 ; O
+O2           0.17     1      0.922    0.15     0.85 ; O
+S            0.18     1      1.121    0.18    0.96 ; S
+SH           0.18     1      1.121    0.18    0.96 ; S
 ; masscenters for vsites do not have gbsa parameters
-
 MNH3         0        0      0        0         0
 MCH3         0        0      0        0         0
index c3120b0ed1e9345c044dc59215e7e5b55876c178..007b57acda9154e630a58e5e43178ddf7fee7b40 100644 (file)
@@ -1,3 +1,8 @@
+; original reference: [M. W. Mahoney and W. L. Jorgensen, J. Chem. Phys. 112 , 2000]
+;
+; Note that there are various issues with tip5p and the different forcefields.
+; Discussion is here: http://redmine.gromacs.org/issues/1348
+
 [ moleculetype ]
 ; molname      nrexcl
 SOL            2
index 420808db5e5779b24161f08d306c6dda18d5ec8e..7e4956a7e9a47dd4fafbf390fb65446eade24058 100644 (file)
@@ -1,5 +1,6 @@
 tip3p    TIP3P     TIP 3-point, recommended
 tip4p    TIP4P     TIP 4-point
 tip4pew  TIP4P-Ew  TIP 4-point optimized with Ewald
+tip5p    TIP5P     TIP 5-point (see http://redmine.gromacs.org/issues/1348 for issues)
 spc      SPC       simple point charge
 spce     SPC/E     extended simple point charge
index 632e8cbe13a3d8d188e388681901e7843c940982..ad74dcde140bc88f978adf5241f30271f32baf7b 100644 (file)
@@ -1,38 +1,35 @@
 [ implicit_genborn_params ]
-
 ; atype      sar      st     pi       gbr       hct
 ;Br           0.1      1      1        0.125     0.85 ; H
-C            0.172    1      1.554    0.1875    0.72 ; C
-CA           0.18     1      1.037    0.1875    0.72 ; C
-CB           0.172    0.012  1.554    0.1875    0.72 ; C
-CC           0.172    1      1.554    0.1875    0.72 ; C
-CN           0.172    0.012  1.554    0.1875    0.72 ; C
-CR           0.18     1      1.073    0.1875    0.72 ; C
-CT           0.18     1      1.276    0.190     0.72 ; C
-CV           0.18     1      1.073    0.1875    0.72 ; C 
-CW           0.18     1      1.073    0.1875    0.72 ; C
-C*           0.172    0.012  1.554    0.1875    0.72 ; C
-H            0.1      1      1        0.115     0.85 ; H
-HC           0.1      1      1        0.125     0.85 ; H
-H1           0.1      1      1        0.125     0.85 ; H
-HA           0.1      1      1        0.125     0.85 ; H
-H4           0.1      1      1        0.115     0.85 ; H
-H5           0.1      1      1        0.125     0.85 ; H
-HO           0.1      1      1        0.105     0.85 ; H
-HS           0.1      1      1        0.125     0.85 ; H
-HP           0.1      1      1        0.125     0.85 ; H
-N            0.155    1      1.028    0.17063   0.79 ; N
-NA           0.155    1      1.028    0.17063   0.79 ; N
-NB           0.155    1      1.215    0.17063   0.79 ; N
-N2           0.16     1      1.215    0.17063   0.79 ; N
-N3           0.16     1      1.215    0.1625    0.79 ; N
-O            0.15     1      0.926    0.148     0.85 ; O
-OH           0.152    1      1.080    0.1535    0.85 ; O
-O2           0.17     1      0.922    0.148     0.85 ; O
-S            0.18     1      1.121    0.1775    0.96 ; S
-SH           0.18     1      1.121    0.1775    0.96 ; S
-
+C            0.172    1      1.554    0.17    0.72 ; C
+CA           0.18     1      1.037    0.17    0.72 ; C
+CB           0.172    0.012  1.554    0.17    0.72 ; C
+CC           0.172    1      1.554    0.17    0.72 ; C
+CN           0.172    0.012  1.554    0.17    0.72 ; C
+CR           0.18     1      1.073    0.17    0.72 ; C
+CT           0.18     1      1.276    0.17     0.72 ; C
+CV           0.18     1      1.073    0.17    0.72 ; C
+CW           0.18     1      1.073    0.17    0.72 ; C
+C*           0.172    0.012  1.554    0.17    0.72 ; C
+H            0.1      1      1        0.13     0.85 ; H
+HC           0.1      1      1        0.12     0.85 ; H
+H1           0.1      1      1        0.12     0.85 ; H
+HA           0.1      1      1        0.12     0.85 ; H
+H4           0.1      1      1        0.12     0.85 ; H
+H5           0.1      1      1        0.12     0.85 ; H
+HO           0.1      1      1        0.12     0.85 ; H
+HS           0.1      1      1        0.12     0.85 ; H
+HP           0.1      1      1        0.12     0.85 ; H
+N            0.155    1      1.028    0.155   0.79 ; N
+NA           0.155    1      1.028    0.155   0.79 ; N
+NB           0.155    1      1.215    0.155   0.79 ; N
+N2           0.16     1      1.215    0.155   0.79 ; N
+N3           0.16     1      1.215    0.155    0.79 ; N
+O            0.15     1      0.926    0.15     0.85 ; O
+OH           0.152    1      1.080    0.15    0.85 ; O
+O2           0.17     1      0.922    0.15     0.85 ; O
+S            0.18     1      1.121    0.18    0.96 ; S
+SH           0.18     1      1.121    0.18    0.96 ; S
 ; masscenters for vsites do not have gbsa parameters
-
 MNH3         0        0      0        0         0
 MCH3         0        0      0        0         0
index c3120b0ed1e9345c044dc59215e7e5b55876c178..007b57acda9154e630a58e5e43178ddf7fee7b40 100644 (file)
@@ -1,3 +1,8 @@
+; original reference: [M. W. Mahoney and W. L. Jorgensen, J. Chem. Phys. 112 , 2000]
+;
+; Note that there are various issues with tip5p and the different forcefields.
+; Discussion is here: http://redmine.gromacs.org/issues/1348
+
 [ moleculetype ]
 ; molname      nrexcl
 SOL            2
index 420808db5e5779b24161f08d306c6dda18d5ec8e..7e4956a7e9a47dd4fafbf390fb65446eade24058 100644 (file)
@@ -1,5 +1,6 @@
 tip3p    TIP3P     TIP 3-point, recommended
 tip4p    TIP4P     TIP 4-point
 tip4pew  TIP4P-Ew  TIP 4-point optimized with Ewald
+tip5p    TIP5P     TIP 5-point (see http://redmine.gromacs.org/issues/1348 for issues)
 spc      SPC       simple point charge
 spce     SPC/E     extended simple point charge
index 632e8cbe13a3d8d188e388681901e7843c940982..ad74dcde140bc88f978adf5241f30271f32baf7b 100644 (file)
@@ -1,38 +1,35 @@
 [ implicit_genborn_params ]
-
 ; atype      sar      st     pi       gbr       hct
 ;Br           0.1      1      1        0.125     0.85 ; H
-C            0.172    1      1.554    0.1875    0.72 ; C
-CA           0.18     1      1.037    0.1875    0.72 ; C
-CB           0.172    0.012  1.554    0.1875    0.72 ; C
-CC           0.172    1      1.554    0.1875    0.72 ; C
-CN           0.172    0.012  1.554    0.1875    0.72 ; C
-CR           0.18     1      1.073    0.1875    0.72 ; C
-CT           0.18     1      1.276    0.190     0.72 ; C
-CV           0.18     1      1.073    0.1875    0.72 ; C 
-CW           0.18     1      1.073    0.1875    0.72 ; C
-C*           0.172    0.012  1.554    0.1875    0.72 ; C
-H            0.1      1      1        0.115     0.85 ; H
-HC           0.1      1      1        0.125     0.85 ; H
-H1           0.1      1      1        0.125     0.85 ; H
-HA           0.1      1      1        0.125     0.85 ; H
-H4           0.1      1      1        0.115     0.85 ; H
-H5           0.1      1      1        0.125     0.85 ; H
-HO           0.1      1      1        0.105     0.85 ; H
-HS           0.1      1      1        0.125     0.85 ; H
-HP           0.1      1      1        0.125     0.85 ; H
-N            0.155    1      1.028    0.17063   0.79 ; N
-NA           0.155    1      1.028    0.17063   0.79 ; N
-NB           0.155    1      1.215    0.17063   0.79 ; N
-N2           0.16     1      1.215    0.17063   0.79 ; N
-N3           0.16     1      1.215    0.1625    0.79 ; N
-O            0.15     1      0.926    0.148     0.85 ; O
-OH           0.152    1      1.080    0.1535    0.85 ; O
-O2           0.17     1      0.922    0.148     0.85 ; O
-S            0.18     1      1.121    0.1775    0.96 ; S
-SH           0.18     1      1.121    0.1775    0.96 ; S
-
+C            0.172    1      1.554    0.17    0.72 ; C
+CA           0.18     1      1.037    0.17    0.72 ; C
+CB           0.172    0.012  1.554    0.17    0.72 ; C
+CC           0.172    1      1.554    0.17    0.72 ; C
+CN           0.172    0.012  1.554    0.17    0.72 ; C
+CR           0.18     1      1.073    0.17    0.72 ; C
+CT           0.18     1      1.276    0.17     0.72 ; C
+CV           0.18     1      1.073    0.17    0.72 ; C
+CW           0.18     1      1.073    0.17    0.72 ; C
+C*           0.172    0.012  1.554    0.17    0.72 ; C
+H            0.1      1      1        0.13     0.85 ; H
+HC           0.1      1      1        0.12     0.85 ; H
+H1           0.1      1      1        0.12     0.85 ; H
+HA           0.1      1      1        0.12     0.85 ; H
+H4           0.1      1      1        0.12     0.85 ; H
+H5           0.1      1      1        0.12     0.85 ; H
+HO           0.1      1      1        0.12     0.85 ; H
+HS           0.1      1      1        0.12     0.85 ; H
+HP           0.1      1      1        0.12     0.85 ; H
+N            0.155    1      1.028    0.155   0.79 ; N
+NA           0.155    1      1.028    0.155   0.79 ; N
+NB           0.155    1      1.215    0.155   0.79 ; N
+N2           0.16     1      1.215    0.155   0.79 ; N
+N3           0.16     1      1.215    0.155    0.79 ; N
+O            0.15     1      0.926    0.15     0.85 ; O
+OH           0.152    1      1.080    0.15    0.85 ; O
+O2           0.17     1      0.922    0.15     0.85 ; O
+S            0.18     1      1.121    0.18    0.96 ; S
+SH           0.18     1      1.121    0.18    0.96 ; S
 ; masscenters for vsites do not have gbsa parameters
-
 MNH3         0        0      0        0         0
 MCH3         0        0      0        0         0
index c3120b0ed1e9345c044dc59215e7e5b55876c178..007b57acda9154e630a58e5e43178ddf7fee7b40 100644 (file)
@@ -1,3 +1,8 @@
+; original reference: [M. W. Mahoney and W. L. Jorgensen, J. Chem. Phys. 112 , 2000]
+;
+; Note that there are various issues with tip5p and the different forcefields.
+; Discussion is here: http://redmine.gromacs.org/issues/1348
+
 [ moleculetype ]
 ; molname      nrexcl
 SOL            2
index 66f8fabc0b116a10ed35a2b5ba60fd2b3a68836d..fa5b9442f647acf64c00e4bdcfdbe5a8062f0920 100644 (file)
@@ -1,5 +1,6 @@
 tip3p    TIP3P     TIP 3-point, recommended
 tip4p    TIP4P     TIP 4-point
 tip4pew  TIP4P-Ew  TIP 4-point optimized with Ewald, recommended 
+tip5p    TIP5P     TIP 5-point (see http://redmine.gromacs.org/issues/1348 for issues)
 spc      SPC       simple point charge
 spce     SPC/E     extended simple point charge
index e4197c9ab445342b9f41e6528939939ff5bf6651..ad74dcde140bc88f978adf5241f30271f32baf7b 100644 (file)
@@ -1,38 +1,35 @@
 [ implicit_genborn_params ]
-
 ; atype      sar      st     pi       gbr       hct
-;H0           0.1      1      1        0.125     0.85 ; H
-C            0.172    1      1.554    0.1875    0.72 ; C
-CA           0.18     1      1.037    0.1875    0.72 ; C
-CB           0.172    0.012  1.554    0.1875    0.72 ; C
-CC           0.172    1      1.554    0.1875    0.72 ; C
-CN           0.172    0.012  1.554    0.1875    0.72 ; C
-CR           0.18     1      1.073    0.1875    0.72 ; C
-CT           0.18     1      1.276    0.190     0.72 ; C
-CV           0.18     1      1.073    0.1875    0.72 ; C 
-CW           0.18     1      1.073    0.1875    0.72 ; C
-C*           0.172    0.012  1.554    0.1875    0.72 ; C
-H            0.1      1      1        0.115     0.85 ; H
-HC           0.1      1      1        0.125     0.85 ; H
-H1           0.1      1      1        0.125     0.85 ; H
-HA           0.1      1      1        0.125     0.85 ; H
-H4           0.1      1      1        0.115     0.85 ; H
-H5           0.1      1      1        0.125     0.85 ; H
-HO           0.1      1      1        0.105     0.85 ; H
-HS           0.1      1      1        0.125     0.85 ; H
-HP           0.1      1      1        0.125     0.85 ; H
-N            0.155    1      1.028    0.17063   0.79 ; N
-NA           0.155    1      1.028    0.17063   0.79 ; N
-NB           0.155    1      1.215    0.17063   0.79 ; N
-N2           0.16     1      1.215    0.17063   0.79 ; N
-N3           0.16     1      1.215    0.1625    0.79 ; N
-O            0.15     1      0.926    0.148     0.85 ; O
-OH           0.152    1      1.080    0.1535    0.85 ; O
-O2           0.17     1      0.922    0.148     0.85 ; O
-S            0.18     1      1.121    0.1775    0.96 ; S
-SH           0.18     1      1.121    0.1775    0.96 ; S
-
+;Br           0.1      1      1        0.125     0.85 ; H
+C            0.172    1      1.554    0.17    0.72 ; C
+CA           0.18     1      1.037    0.17    0.72 ; C
+CB           0.172    0.012  1.554    0.17    0.72 ; C
+CC           0.172    1      1.554    0.17    0.72 ; C
+CN           0.172    0.012  1.554    0.17    0.72 ; C
+CR           0.18     1      1.073    0.17    0.72 ; C
+CT           0.18     1      1.276    0.17     0.72 ; C
+CV           0.18     1      1.073    0.17    0.72 ; C
+CW           0.18     1      1.073    0.17    0.72 ; C
+C*           0.172    0.012  1.554    0.17    0.72 ; C
+H            0.1      1      1        0.13     0.85 ; H
+HC           0.1      1      1        0.12     0.85 ; H
+H1           0.1      1      1        0.12     0.85 ; H
+HA           0.1      1      1        0.12     0.85 ; H
+H4           0.1      1      1        0.12     0.85 ; H
+H5           0.1      1      1        0.12     0.85 ; H
+HO           0.1      1      1        0.12     0.85 ; H
+HS           0.1      1      1        0.12     0.85 ; H
+HP           0.1      1      1        0.12     0.85 ; H
+N            0.155    1      1.028    0.155   0.79 ; N
+NA           0.155    1      1.028    0.155   0.79 ; N
+NB           0.155    1      1.215    0.155   0.79 ; N
+N2           0.16     1      1.215    0.155   0.79 ; N
+N3           0.16     1      1.215    0.155    0.79 ; N
+O            0.15     1      0.926    0.15     0.85 ; O
+OH           0.152    1      1.080    0.15    0.85 ; O
+O2           0.17     1      0.922    0.15     0.85 ; O
+S            0.18     1      1.121    0.18    0.96 ; S
+SH           0.18     1      1.121    0.18    0.96 ; S
 ; masscenters for vsites do not have gbsa parameters
-
 MNH3         0        0      0        0         0
 MCH3         0        0      0        0         0
index c3120b0ed1e9345c044dc59215e7e5b55876c178..007b57acda9154e630a58e5e43178ddf7fee7b40 100644 (file)
@@ -1,3 +1,8 @@
+; original reference: [M. W. Mahoney and W. L. Jorgensen, J. Chem. Phys. 112 , 2000]
+;
+; Note that there are various issues with tip5p and the different forcefields.
+; Discussion is here: http://redmine.gromacs.org/issues/1348
+
 [ moleculetype ]
 ; molname      nrexcl
 SOL            2
index 420808db5e5779b24161f08d306c6dda18d5ec8e..7e4956a7e9a47dd4fafbf390fb65446eade24058 100644 (file)
@@ -1,5 +1,6 @@
 tip3p    TIP3P     TIP 3-point, recommended
 tip4p    TIP4P     TIP 4-point
 tip4pew  TIP4P-Ew  TIP 4-point optimized with Ewald
+tip5p    TIP5P     TIP 5-point (see http://redmine.gromacs.org/issues/1348 for issues)
 spc      SPC       simple point charge
 spce     SPC/E     extended simple point charge
index 53fc89d5034a747aec39c5e01d28bb69f5841a8e..87d81835ac0eb11d262358ba0ba22fcbffd2dd54 100644 (file)
@@ -2,7 +2,7 @@
 
 [ GLY-NH3+ ]
 [ replace ]
- N     N       NH3             14.0027 -0.3
+ N     N       NH3             14.00 -0.3
  CA    CA      CT2             12.011  0.13
 [ Add ]
  3     4       H       N       CA      C
@@ -12,7 +12,7 @@
 
 [ NH3+ ]
 [ replace ]
- N       N     NH3             14.0027 -0.3
+ N       N     NH3             14.00 -0.3
  CA      CA    CT1             12.011  0.21
  HA      HA    HB              1.008    0.10
 [ Add ]
@@ -23,7 +23,7 @@
 
 [ PRO-NH2+ ]
 [ replace ]
- N       N     NP       14.0027 -0.07
+ N       N     NP       14.007 -0.07
  CA      CA    CP1      12.011  0.16
  CD      CD    CP3      12.011  0.16
 [ add ]
@@ -33,7 +33,7 @@
 ; 
 [ NH2 ]
 [ replace ]
- N             NH2             14.0067 -0.96
+ N             NH2             14.007 -0.96
  CA            CT1             12.011  0.19
  HA            HB              1.008   0.09
 [ add ]
@@ -46,7 +46,7 @@
 ; 
 [ GLY-NH2 ]
 [ replace ]
- N             NH2             14.0067 -0.96
+ N             NH2             14.007 -0.96
  CA            CT2             12.011  0.10
 [ add ]
  2     4       HT      N       CA      C
@@ -58,7 +58,7 @@
 ; 
 [ PRO-NH ]
 [ replace ]
- N             NP      14.0027 -0.40
+ N             NP      14.00 -0.40
  CA            CP1     12.011  -0.08
  CD            CP3     12.011  -0.10
 [ add ]
index 41bcbab9f1415cf2f0c653c0537854c0583ba5ec..f3e88d2682c818df69b4ac6b31ebda897c917855 100644 (file)
@@ -1,6 +1,7 @@
 ; rtp residue to rtp building block table
 ;GMX   Force-field
 HISD   HSD
+HIS1   HSD
 HISE   HSE
 HISH   HSP
 LYSN   LSN
index 1af5eac52716fa7f424b78480cbcb7a8dda0b09b..b4d7135fcdb678707a8d1a16f08632b45b06385b 100644 (file)
@@ -129,6 +129,7 @@ MNH3        0.0000 ; vsite (rigid tetrahedrical NH3 group)
 MNH2   0.0000 ; vsite
 MCH3   0.0000 ; vsite (rigid CH3 group connected to carbons)
 MCH3S  0.0000 ; vsite (rigid CH3 group connected to S)
+MW      0.0    ; Dummy mass in rigid tyrosine rings
 ; DNA and RNA section
 P       30.974 ;        Phosphorus  ### For DNA
 P2     30.974000 ;     pyrophosphate phosphorus (see toppar_all27_na_nad_ppi.str)  ### For DNA 
index 48ab6326d3ed9e3e99289422fa4f8e207fb30c18..82daff23322a6de758854c30aafb31d7b536a25e 100644 (file)
@@ -156,6 +156,7 @@ MNH3        0       0.000000        0.00    A       0.0     0.0
 MNH2   0       0.000000        0.00    A       0.0     0.0
 MCH3   0       0.000000        0.00    A       0.0     0.0
 MCH3S  0       0.000000        0.00    A       0.0     0.0
+MW      0       0.000000        0.00    A       0.0     0.0
 ; Ions and noble gases (useful for tutorials)
 Cu2+   29      63.54600        2.00    A       2.08470e-01     4.76976e+00
 Ar     18      39.94800        0.00    A       3.41000e-01     2.74580e-02
index bdd87ef10b710f6200255c012a3fb1a71d178e24..33d51c6d94169909a129d9ca24a2323e58b47285 100644 (file)
@@ -45,3 +45,4 @@
  MNH2          0       0       0       0        0    ; dummy mass
  MCH3          0       0       0       0        0    ; dummy mass
  MCH3S         0       0       0       0        0    ; dummy mass
+ MW             0       0       0       0        0
index d5e92ffd61480223335e135ff9129a0fc3bbf33d..d13477c90f5eeac1c0efa5061a58f832d2827c48 100644 (file)
@@ -1,3 +1,8 @@
+; original reference: [M. W. Mahoney and W. L. Jorgensen, J. Chem. Phys. 112 , 2000]
+;
+; Note that there are various issues with tip5p and the different forcefields.
+; Discussion is here: http://redmine.gromacs.org/issues/1348
+
 [ moleculetype ]
 ; molname      nrexcl
 SOL            2
index 72f00cd5db86072aef34ef3cf47f5cbfba2fe856..5446473cdee132eadedde36c29193336919ab077 100644 (file)
@@ -1,5 +1,6 @@
 tip3p   TIP3P   TIP 3-point, recommended
 tip4p   TIP4P   TIP 4-point
 tips3p  TIPS3P  CHARMM TIP 3-point with LJ on H's (note: twice as slow in GROMACS)
+tip5p   TIP5P   TIP 5-point (see http://redmine.gromacs.org/issues/1348 for issues)
 spc     SPC     simple point charge
 spce    SPC/E   extended simple point charge
index 7b513a1fab5a03dc73d4c937e33173297d1da742..d14447ec3316d805e7ac65fd8c589d947530e267 100644 (file)
@@ -21,7 +21,7 @@ CA    N       H1      ga_10
 CA     N       H2      ga_10
 CA     N       H3      ga_10
 [ dihedrals ]
-H1     N       CA      C       gd_14
+H1     N       CA      C       gd_19
 
 [ NH2 ]
 [ replace ]
@@ -39,7 +39,7 @@ H1    N       H2      ga_9
 CA     N       H1      ga_10
 CA     N       H2      ga_10
 [ dihedrals ]
-H1     N       CA      C       gd_14
+H1     N       CA      C       gd_19
 
 [ PRO-NH2+ ]
 [ replace ]
@@ -57,7 +57,7 @@ CA    N       H2      ga_10
 CD     N       H1      ga_10
 CD     N       H2      ga_10
 [ dihedrals ]
-H1     N       CA      C       gd_14
+CD     N       CA      C       gd_19
 
 [ PRO-NH ]
 [ replace ]
@@ -70,6 +70,8 @@ N     H       gb_2
 [ angles ]
 CA     N       H       ga_10
 CD     N       H       ga_10
+[ dihedrals ]
+CD      N       CA      C       gd_19
 
 [ GLY-NH3+ ]
 [ replace ]
@@ -92,5 +94,5 @@ CA    N       H1      ga_10
 CA     N       H2      ga_10
 CA     N       H3      ga_10
 [ dihedrals ]
-H1     N       CA      C       gd_14
+H1     N       CA      C       gd_19
 
index 7b513a1fab5a03dc73d4c937e33173297d1da742..d14447ec3316d805e7ac65fd8c589d947530e267 100644 (file)
@@ -21,7 +21,7 @@ CA    N       H1      ga_10
 CA     N       H2      ga_10
 CA     N       H3      ga_10
 [ dihedrals ]
-H1     N       CA      C       gd_14
+H1     N       CA      C       gd_19
 
 [ NH2 ]
 [ replace ]
@@ -39,7 +39,7 @@ H1    N       H2      ga_9
 CA     N       H1      ga_10
 CA     N       H2      ga_10
 [ dihedrals ]
-H1     N       CA      C       gd_14
+H1     N       CA      C       gd_19
 
 [ PRO-NH2+ ]
 [ replace ]
@@ -57,7 +57,7 @@ CA    N       H2      ga_10
 CD     N       H1      ga_10
 CD     N       H2      ga_10
 [ dihedrals ]
-H1     N       CA      C       gd_14
+CD     N       CA      C       gd_19
 
 [ PRO-NH ]
 [ replace ]
@@ -70,6 +70,8 @@ N     H       gb_2
 [ angles ]
 CA     N       H       ga_10
 CD     N       H       ga_10
+[ dihedrals ]
+CD      N       CA      C       gd_19
 
 [ GLY-NH3+ ]
 [ replace ]
@@ -92,5 +94,5 @@ CA    N       H1      ga_10
 CA     N       H2      ga_10
 CA     N       H3      ga_10
 [ dihedrals ]
-H1     N       CA      C       gd_14
+H1     N       CA      C       gd_19
 
index 08f0beb2315e9e8892bc80d22a32557b519b71bf..af24c6060942599e029bd5d89800c7036f0ac764 100644 (file)
@@ -21,7 +21,7 @@ CA    N       H1      ga_11
 CA     N       H2      ga_11
 CA     N       H3      ga_11
 [ dihedrals ]
-H1     N       CA      C       gd_29
+H1     N       CA      C       gd_39
 
 [ NH2 ]
 [ replace ]
@@ -39,7 +39,7 @@ H1    N       H2      ga_10
 CA     N       H1      ga_11
 CA     N       H2      ga_11
 [ dihedrals ]
-H1     N       CA      C       gd_29
+H1     N       CA      C       gd_39
 
 [ PRO-NH2+ ]
 [ replace ]
@@ -59,7 +59,7 @@ CA    N       H2      ga_11
 CD     N       H1      ga_11
 CD     N       H2      ga_11
 [ dihedrals ]
-H1     N       CA      C       gd_29
+CD     N       CA      C       gd_39
 
 [ PRO-NH ]
 [ replace ]
@@ -72,6 +72,8 @@ N     H       gb_2
 [ angles ]
 CA     N       H       ga_11
 CD     N       H       ga_11
+[ dihedrals ]
+CD      N       CA      C       gd_39
 
 [ GLY-NH3+ ]
 [ replace ]
@@ -94,5 +96,5 @@ CA    N       H1      ga_11
 CA     N       H2      ga_11
 CA     N       H3      ga_11
 [ dihedrals ]
-H1     N       CA      C       gd_29
+H1     N       CA      C       gd_39
 
index 3d58ae40b3bada8cf0f539e303cbe82d062506ac..6a116ec222c02ecc9801985bf8b3a1f8634f152c 100644 (file)
@@ -21,7 +21,7 @@ CA    N       H1      ga_11
 CA     N       H2      ga_11
 CA     N       H3      ga_11
 [ dihedrals ]
-H1     N       CA      C       gd_29
+H1     N       CA      C       gd_39
 
 [ NH2 ]
 [ replace ]
@@ -40,7 +40,7 @@ H1    N       H2      ga_10
 CA     N       H1      ga_11
 CA     N       H2      ga_11
 [ dihedrals ]
-H1     N       CA      C       gd_29
+H1     N       CA      C       gd_39
 
 [ PRO-NH2+ ]
 [ replace ]
@@ -60,7 +60,7 @@ CA    N       H2      ga_11
 CD     N       H1      ga_11
 CD     N       H2      ga_11
 [ dihedrals ]
-H1     N       CA      C       gd_29
+CD     N       CA      C       gd_39
 
 [ PRO-NH ]
 [ replace ]
@@ -73,6 +73,8 @@ N     H       gb_2
 [ angles ]
 CA     N       H       ga_11
 CD     N       H       ga_11
+[ dihedrals ]
+CD      N       CA      C       gd_39
 
 [ GLY-NH3+ ]
 [ replace ]
@@ -95,5 +97,5 @@ CA    N       H1      ga_11
 CA     N       H2      ga_11
 CA     N       H3      ga_11
 [ dihedrals ]
-H1     N       CA      C       gd_29
+H1     N       CA      C       gd_39
 
index 119d105b8d750a611d2af96f25d0cbd9f373eadb..97d9eea4f7edfe8c2401e53de3623c1471c32dce 100644 (file)
@@ -21,7 +21,7 @@ CA    N       H1      ga_11
 CA     N       H2      ga_11
 CA     N       H3      ga_11
 [ dihedrals ]
-H1     N       CA      C       gd_29
+H1     N       CA      C       gd_39
 
 [ NH2 ]
 [ replace ]
@@ -40,7 +40,7 @@ H1    N       H2      ga_10
 CA     N       H1      ga_11
 CA     N       H2      ga_11
 [ dihedrals ]
-H1     N       CA      C       gd_29
+H1     N       CA      C       gd_39
 
 [ PRO-NH2+ ]
 [ replace ]
@@ -60,7 +60,7 @@ CA    N       H2      ga_11
 CD     N       H1      ga_11
 CD     N       H2      ga_11
 [ dihedrals ]
-H1     N       CA      C       gd_29
+CD     N       CA      C       gd_39
 
 [ PRO-NH ]
 [ replace ]
@@ -73,6 +73,8 @@ N     H       gb_2
 [ angles ]
 CA     N       H       ga_11
 CD     N       H       ga_11
+[ dihedrals ]
+CD      N       CA      C       gd_39
 
 [ GLY-NH3+ ]
 [ replace ]
@@ -95,5 +97,5 @@ CA    N       H1      ga_11
 CA     N       H2      ga_11
 CA     N       H3      ga_11
 [ dihedrals ]
-H1     N       CA      C       gd_29
+H1     N       CA      C       gd_39
 
index 597e3eb9a4afae11ceaeed611f5ee0b58316468f..abadb0b3865a2f54bf233617378c95f92d1245fe 100644 (file)
    HB1    opls_140    0.060     2
    HB2    opls_140    0.060     2
     CG    opls_267    0.520     3
-   OD1    opls_269   -0.530     3
-   OD2    opls_268   -0.440     4
+   OD1    opls_269   -0.440     3
+   OD2    opls_268   -0.530     4
    HD2    opls_270    0.450     4
      C    opls_235    0.500     5
      O    opls_236   -0.500     5
index 02b8c67fa5f17e883d3443b9d537492796a153c5..22418b5f6239700d09341a9e36c86493c1569aad 100644 (file)
@@ -1,3 +1,8 @@
+; original reference: [M. W. Mahoney and W. L. Jorgensen, J. Chem. Phys. 112 , 2000]
+;
+; Note that there are various issues with tip5p and the different forcefields.
+; Discussion is here: http://redmine.gromacs.org/issues/1348
+
 [ moleculetype ]
 ; molname       nrexcl
 SOL             2
@@ -10,10 +15,25 @@ SOL             2
 4       opls_120     1       SOL             LP1             1      -0.241
 5       opls_120     1       SOL             LP2             1      -0.241
 
+#ifndef FLEXIBLE
+
 [ settles ]
 ; i     funct   doh     dhh
 1       1       0.09572 0.15139
 
+#else
+
+[ bonds ]
+; i     j       funct   length  force.c.
+1       2       1       0.09572 502416.0 0.09572        502416.0
+1       3       1       0.09572 502416.0 0.09572        502416.0
+
+[ angles ]
+; i     j       k       funct   angle   force.c.
+2       1       3       1       104.52  628.02  104.52  628.02
+
+#endif
+
 [ virtual_sites3 ]
 ; The position of the virtual site is computed as follows:
 ;
index 44f5e9270a7602129556ac13a010a99016551c58..420bb9225a6f49715a12eb298cc276eb6244b75e 100644 (file)
@@ -1,6 +1,6 @@
 tip4p   TIP4P  TIP 4-point, recommended
 tip3p   TIP3P  TIP 3-point
-tip5p   TIP5P  TIP 5-point
+tip5p   TIP5P  TIP 5-point (see http://redmine.gromacs.org/issues/1348 for issues)
 tip5pe  TIP5P  TIP 5-point improved for Ewald sums
 spc     SPC    simple point charge
 spce    SPC/E  extended simple point charge
index 71583c184f09ef3102a4b3b26d6c8d306071e18a..ff815a5ec0713ff518c792f3138fd6e9cf46c4e0 100644 (file)
@@ -1,28 +1,28 @@
 26
-ILE     CD1    CD
-ILE     HD11   HD1
-ILE      HD12   HD2
-ILE      HD13   HD3
-HOH     O      OW
-HOH      OW1    OW
-HO4     O      OW
-HO4      OW1    OW
-HO5     O      OW
-HO5      OW1    OW
-HEME    N_A    NA
-HEME    N_B    NB
-HEME    N_C    NC
-HEME    N_D    ND
-protein         O1     O
-protein         O2     OXT
-protein         OT1    O
-protein         OT2    OXT
-protein         OT     OXT
-protein  O'     O
-protein  O''    OXT
-protein  OC1   O
-protein  OC2   OXT
-protein  HN     H
-protein  HT1    H1
-protein  HT2    H2
-protein  HT3    H3
+ILE            CD1    CD
+ILE            HD11   HD1
+ILE            HD12   HD2
+ILE            HD13   HD3
+HOH            O      OW
+HOH            OW1    OW
+HO4            O      OW
+HO4            OW1    OW
+HO5            O      OW
+HO5            OW1    OW
+HEME           N_A    NA
+HEME           N_B    NB
+HEME           N_C    NC
+HEME           N_D    ND
+protein        HN     H
+protein-nterm  HT1    H1
+protein-nterm  HT2    H2
+protein-nterm  HT3    H3
+protein-cterm  O1     O
+protein-cterm  O2     OXT
+protein-cterm  OT1    O
+protein-cterm  OT2    OXT
+protein-cterm  OT     OXT
+protein-cterm  O'     O
+protein-cterm  O''    OXT
+protein-cterm  OC1    O
+protein-cterm  OC2    OXT
diff --git a/src/contrib/pmetest.c b/src/contrib/pmetest.c
deleted file mode 100644 (file)
index 8ed303c..0000000
+++ /dev/null
@@ -1,474 +0,0 @@
-/*
- * 
- *                This source code is part of
- * 
- *                 G   R   O   M   A   C   S
- * 
- *          GROningen MAchine for Chemical Simulations
- * 
- *                        VERSION 3.3.99_development_20071104
- * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
- * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
- * Copyright (c) 2001-2006, 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 "typedefs.h"
-#include "macros.h"
-#include "gromacs/utility/smalloc.h"
-#include "copyrite.h"
-#include "nrnb.h"
-#include "txtdump.h"
-#include "gromacs/fileio/tpxio.h"
-#include "gromacs/commandline/pargs.h"
-#include "gromacs/utility/futil.h"
-#include "gromacs/utility/fatalerror.h"
-#include "gromacs/math/vec.h"
-#include "mdatoms.h"
-#include "coulomb.h"
-#include "nsb.h"
-#include "pme.h"
-#include "force.h"
-#include "gromacs/fileio/xvgr.h"
-#include "gromacs/pbcutil/pbc.h"
-
-#include "gromacs/utility/gmxmpi.h"
-
-#include "block_tx.h"
-
-rvec *xptr=NULL;
-
-static int comp_xptr(const void *a,const void *b)
-{
-  int  va,vb;
-  real dx;
-  
-  va = *(int *)a;
-  vb = *(int *)b;
-  
-  if ((dx = (xptr[va][XX] - xptr[vb][XX])) < 0)
-    return -1;
-  else if (dx > 0)
-    return 1;
-  else
-    return 0;
-}
-
-static void do_my_pme(FILE *fp,real tm,gmx_bool bVerbose,t_inputrec *ir,
-                     rvec x[],rvec xbuf[],rvec f[],
-                     real charge[],real qbuf[],real qqbuf[],
-                     matrix box,gmx_bool bSort,
-                     t_commrec *cr,t_nsborder *nsb,t_nrnb *nrnb,
-                     t_block *excl,real qtot,
-                     t_forcerec *fr,int index[],FILE *fp_xvg,
-                     int ngroups,unsigned short cENER[])
-{
-  real   ener,vcorr,q,xx,dvdl=0,vdip,vcharge;
-  tensor vir,vir_corr,vir_tot;
-  rvec   mu_tot[2];
-  int    i,m,ii,ig,jg;
-  real   **epme,*qptr;
-  
-  /* Initiate local variables */  
-  fr->f_el_recip = f;
-  clear_mat(vir);
-  clear_mat(vir_corr);
-  
-  if (ngroups > 1) {
-    fprintf(fp,"There are %d energy groups\n",ngroups);
-    snew(epme,ngroups);
-    for(i=0; (i<ngroups); i++)
-      snew(epme[i],ngroups);
-  }
-    
-  /* Put x is in the box, this part needs to be parallellized properly */
-  /*put_atoms_in_box(box,nsb->natoms,x);*/
-  /* Here sorting of X (and q) is done.
-   * Alternatively, one could just put the atoms in one of the
-   * cr->nnodes slabs. That is much cheaper than sorting.
-   */
-  for(i=0; (i<nsb->natoms); i++)
-    index[i] = i;
-  if (bSort) {
-    xptr = x;
-    qsort(index,nsb->natoms,sizeof(index[0]),comp_xptr);
-    xptr = NULL; /* To trap unintentional use of the ptr */
-  }
-  /* After sorting we only need the part that is to be computed on 
-   * this processor. We also compute the mu_tot here (system dipole)
-   */
-  clear_rvec(mu_tot[0]);
-  for(i=START(nsb); (i<START(nsb)+HOMENR(nsb)); i++) {
-    ii      = index[i];
-    q       = charge[ii];
-    qbuf[i] = q;
-    for(m=0; (m<DIM); m++) {
-      xx         = x[ii][m];
-      xbuf[i][m] = xx;
-      mu_tot[0][m] += q*xx;
-    }
-    clear_rvec(f[ii]);
-  }
-  copy_rvec(mu_tot[0],mu_tot[1]);
-  if (debug) {
-    pr_rvec(debug,0,"qbuf",qbuf,nsb->natoms,TRUE);
-    pr_rvecs(debug,0,"xbuf",xbuf,nsb->natoms);
-    pr_rvecs(debug,0,"box",box,DIM);
-  }
-  for(ig=0; (ig<ngroups); ig++) {
-    for(jg=ig; (jg<ngroups); jg++) {
-      if (ngroups > 1) {
-       for(i=START(nsb); (i<START(nsb)+HOMENR(nsb)); i++) {
-         if ((cENER[i] == ig) || (cENER[i] == jg))
-           qqbuf[i] = qbuf[i];
-         else
-           qqbuf[i] = 0;
-       }
-       qptr = qqbuf;
-      }
-      else
-       qptr = qbuf;
-      ener  = do_pme(fp,bVerbose,ir,xbuf,f,qptr,qptr,box,cr,
-                    nsb,nrnb,vir,fr->ewaldcoeff,FALSE,0,&dvdl,FALSE);
-      vcorr = ewald_LRcorrection(fp,nsb,cr,fr,qptr,qptr,excl,xbuf,box,mu_tot,
-                                ir->ewald_geometry,ir->epsilon_surface,
-                                0,&dvdl,&vdip,&vcharge);
-      gmx_sum(1,&ener,cr);
-      gmx_sum(1,&vcorr,cr);
-      if (ngroups > 1)
-       epme[ig][jg] = ener+vcorr;
-    }
-  }
-  if (ngroups > 1) {
-    if (fp_xvg) 
-      fprintf(fp_xvg,"%10.3f",tm);
-    for(ig=0; (ig<ngroups); ig++) {
-      for(jg=ig; (jg<ngroups); jg++) {
-       if (ig != jg)
-         epme[ig][jg] -= epme[ig][ig]+epme[jg][jg];
-       if (fp_xvg) 
-         fprintf(fp_xvg,"  %12.5e",epme[ig][jg]);
-      }
-    }
-    if (fp_xvg) 
-      fprintf(fp_xvg,"\n");
-  }
-  else {
-    fprintf(fp,"Time: %10.3f Energy: %12.5e  Correction: %12.5e  Total: %12.5e\n",
-           tm,ener,vcorr,ener+vcorr);
-    if (fp_xvg) 
-      fprintf(fp_xvg,"%10.3f %12.5e %12.5e %12.5e\n",tm,ener+vcorr,vdip,vcharge);
-    if (bVerbose) {
-      m_add(vir,vir_corr,vir_tot);
-      gmx_sum(9,vir_tot[0],cr);
-      pr_rvecs(fp,0,"virial",vir_tot,DIM); 
-    }
-    fflush(fp);
-  }
-}
-
-int main(int argc,char *argv[])
-{
-  static char *desc[] = {
-    "The [TT]pmetest[tt] program tests the scaling of the PME code. When only given",
-    "a [TT].tpr[tt] file it will compute PME for one frame. When given a trajectory",
-    "it will do so for all the frames in the trajectory. Before the PME",
-    "routine is called the coordinates are sorted along the X-axis.[PAR]",
-    "As an extra service to the public the program can also compute",
-    "long-range Coulomb energies for components of the system. When the",
-    "[TT]-groups[tt] flag is given to the program the energy groups",
-    "from the [TT].tpr[tt] file will be read, and half an energy matrix computed."
-  };
-  t_commrec    *cr,*mcr;
-  static t_filenm fnm[] = {
-    { efTPX, NULL,      NULL,       ffREAD  },
-    { efTRN, "-o",      NULL,       ffWRITE },
-    { efLOG, "-g",      "pme",      ffWRITE },
-    { efTRX, "-f",      NULL,       ffOPTRD },
-    { efXVG, "-x",      "ener-pme", ffWRITE }
-  };
-#define NFILE asize(fnm)
-
-  /* Command line options ! */
-  static gmx_bool bVerbose=FALSE;
-  static gmx_bool bOptFFT=FALSE;
-  static gmx_bool bSort=FALSE;
-  static int  ewald_geometry=eewg3D;
-  static int  nnodes=1;
-  static int  pme_order=0;
-  static rvec grid = { -1, -1, -1 };
-  static real rc   = 0.0;
-  static real dtol = 0.0;
-  static gmx_bool bGroups = FALSE;
-  static t_pargs pa[] = {
-    { "-np",      FALSE, etINT, {&nnodes},
-      "Number of nodes, must be the same as used for [TT]grompp[tt]" },
-    { "-v",       FALSE, etBOOL,{&bVerbose},  
-      "Be loud and noisy" },
-    { "-sort",    FALSE, etBOOL,{&bSort},  
-      "Sort coordinates. Crucial for domain decomposition." },
-    { "-grid",    FALSE, etRVEC,{&grid},
-      "Number of grid cells in X, Y, Z dimension (if -1 use from [TT].tpr[tt])" },
-    { "-order",   FALSE, etINT, {&pme_order},
-      "Order of the PME spreading algorithm" },
-    { "-groups",  FALSE, etBOOL, {&bGroups},
-      "Compute half an energy matrix based on the energy groups in your [TT].tpr[tt] file" },
-    { "-rc",      FALSE, etREAL, {&rc},
-      "Rcoulomb for Ewald summation" },
-    { "-tol",     FALSE, etREAL, {&dtol},
-      "Tolerance for Ewald summation" }
-  };
-  FILE        *fp;
-  t_inputrec  *ir;
-  t_topology  top;
-  t_tpxheader tpx;
-  t_nrnb      nrnb;
-  t_nsborder  *nsb;
-  t_forcerec  *fr;
-  t_mdatoms   *mdatoms;
-  char        title[STRLEN];
-  int         natoms,step,status,i,ncg,root;
-  real        t,lambda,ewaldcoeff,qtot;
-  rvec        *x,*f,*xbuf;
-  int         *index;
-  gmx_bool        bCont;
-  real        *charge,*qbuf,*qqbuf;
-  matrix      box;
-  
-  /* Start the actual parallel code if necessary */
-  cr   = init_par(&argc,&argv);
-  root = 0;
-  
-  if (MASTER(cr)) 
-    CopyRight(stderr,argv[0]);
-  
-  /* Parse command line on all processors, arguments are passed on in 
-   * init_par (see above)
-   */
-  parse_common_args(&argc,argv,
-                   PCA_NOEXIT_ON_ARGS | PCA_BE_NICE |
-                   PCA_CAN_SET_DEFFNM | (MASTER(cr) ? 0 : PCA_QUIET),
-                   NFILE,fnm,asize(pa),pa,asize(desc),desc,0,NULL);
-  
-#ifndef GMX_MPI
-  if (nnodes > 1) 
-    gmx_fatal(FARGS,"GROMACS compiled without MPI support - can't do parallel runs");
-#endif
-
-  /* Open log files on all processors */
-  open_log(ftp2fn(efLOG,NFILE,fnm),cr);
-  snew(ir,1);
-  
-  if (MASTER(cr)) {
-    /* Read tpr file etc. */
-    read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&tpx,FALSE,NULL,NULL);
-    snew(x,tpx.natoms);
-    read_tpx(ftp2fn(efTPX,NFILE,fnm),&step,&t,&lambda,ir,
-            box,&natoms,x,NULL,NULL,&top);
-    /* Charges */
-    qtot = 0;
-    snew(charge,natoms);
-    for(i=0; (i<natoms); i++) {
-      charge[i] = top.atoms.atom[i].q;
-      qtot += charge[i];
-    }
-  
-    /* Grid stuff */
-    if (opt2parg_bSet("-grid",asize(pa),pa)) {
-      ir->nkx = grid[XX];
-      ir->nky = grid[YY];
-      ir->nkz = grid[ZZ];
-    }
-    /* Check command line parameters for consistency */
-    if ((ir->nkx <= 0) || (ir->nky <= 0) || (ir->nkz <= 0))
-      gmx_fatal(FARGS,"PME grid = %d %d %d",ir->nkx,ir->nky,ir->nkz);
-    if (opt2parg_bSet("-rc",asize(pa),pa)) 
-      ir->rcoulomb = rc;
-    if (ir->rcoulomb <= 0)
-      gmx_fatal(FARGS,"rcoulomb should be > 0 (not %f)",ir->rcoulomb);
-    if (opt2parg_bSet("-order",asize(pa),pa)) 
-      ir->pme_order = pme_order;
-    if (ir->pme_order <= 0)
-      gmx_fatal(FARGS,"pme_order should be > 0 (not %d)",ir->pme_order);
-    if (opt2parg_bSet("-tol",asize(pa),pa))
-      ir->ewald_rtol = dtol;
-    if (ir->ewald_rtol <= 0)
-      gmx_fatal(FARGS,"ewald_tol should be > 0 (not %f)",ir->ewald_rtol);
-  }
-  else {
-    init_top(&top);
-  }
-
-  /* Add parallellization code here */
-  snew(nsb,1);
-  if (MASTER(cr)) {
-    ncg = top.blocks[ebCGS].multinr[0];
-    for(i=0; (i<cr->nnodes-1); i++)
-      top.blocks[ebCGS].multinr[i] = min(ncg,(ncg*(i+1))/cr->nnodes);
-    for( ; (i<MAXNODES); i++)
-      top.blocks[ebCGS].multinr[i] = ncg;
-  }
-  if (PAR(cr)) {
-    /* Set some variables to zero to avoid core dumps */
-    ir->opts.ngtc = ir->opts.ngacc = ir->opts.ngfrz = ir->opts.ngener = 0;
-#ifdef GMX_MPI
-    /* Distribute the data over processors */
-    MPI_Bcast(&natoms,1,MPI_INT,root,MPI_COMM_WORLD);
-    MPI_Bcast(ir,sizeof(*ir),MPI_BYTE,root,MPI_COMM_WORLD);
-    MPI_Bcast(&qtot,1,GMX_MPI_REAL,root,MPI_COMM_WORLD);
-#endif
-
-    /* Call some dedicated communication routines, master sends n-1 times */
-    if (MASTER(cr)) {
-      for(i=1; (i<cr->nnodes); i++) {
-       mv_block(i,&(top.blocks[ebCGS]));
-       mv_block(i,&(top.atoms.excl));
-      }
-    }
-    else {
-      ld_block(root,&(top.blocks[ebCGS]));
-      ld_block(root,&(top.atoms.excl));
-    }
-    if (!MASTER(cr)) {
-      snew(charge,natoms);
-      snew(x,natoms);
-    }
-#ifdef GMX_MPI
-    MPI_Bcast(charge,natoms,GMX_MPI_REAL,root,MPI_COMM_WORLD);
-#endif
-  }
-  ewaldcoeff = calc_ewaldcoeff(ir->rcoulomb,ir->ewald_rtol);
-  
-  
-  if (bVerbose)
-    pr_inputrec(stdlog,0,"Inputrec",ir);
-
-  /* Allocate memory for temp arrays etc. */
-  snew(xbuf,natoms);
-  snew(f,natoms);
-  snew(qbuf,natoms);
-  snew(qqbuf,natoms);
-  snew(index,natoms);
-
-  /* Initialize the PME code */  
-  init_pme(stdlog,cr,ir->nkx,ir->nky,ir->nkz,ir->pme_order,
-          natoms,FALSE,bOptFFT,ewald_geometry);
-          
-  /* MFlops accounting */
-  init_nrnb(&nrnb);
-  
-  /* Initialize the work division */
-  calc_nsb(stdlog,&(top.blocks[ebCGS]),cr->nnodes,nsb,0);
-  nsb->nodeid = cr->nodeid;
-  print_nsb(stdlog,"pmetest",nsb);  
-
-  /* Initiate forcerec */
-  mdatoms = atoms2md(stdlog,&top.atoms,ir->opts.nFreeze,ir->eI,
-                    ir->delta_t,0,ir->opts.tau_t,FALSE,FALSE);
-  snew(fr,1);
-  init_forcerec(stdlog,fr,ir,&top,cr,mdatoms,nsb,box,FALSE,NULL,NULL,FALSE);
-  
-  /* First do PME based on coordinates in tpr file, send them to
-   * other processors if needed.
-   */
-  if (MASTER(cr))
-    fprintf(stdlog,"-----\n"
-           "Results based on tpr file %s\n",ftp2fn(efTPX,NFILE,fnm));
-#ifdef GMX_MPI
-  if (PAR(cr)) {
-    MPI_Bcast(x[0],natoms*DIM,GMX_MPI_REAL,root,MPI_COMM_WORLD);
-    MPI_Bcast(box[0],DIM*DIM,GMX_MPI_REAL,root,MPI_COMM_WORLD);
-    MPI_Bcast(&t,1,GMX_MPI_REAL,root,MPI_COMM_WORLD);
-  }
-#endif
-  do_my_pme(stdlog,0,bVerbose,ir,x,xbuf,f,charge,qbuf,qqbuf,box,bSort,
-           cr,nsb,&nrnb,&(top.atoms.excl),qtot,fr,index,NULL,
-           bGroups ? ir->opts.ngener : 1,mdatoms->cENER);
-
-  /* If we have a trajectry file, we will read the frames in it and compute
-   * the PME energy.
-   */
-  if (ftp2bSet(efTRX,NFILE,fnm)) {
-    fprintf(stdlog,"-----\n"
-           "Results based on trx file %s\n",ftp2fn(efTRX,NFILE,fnm));
-    if (MASTER(cr)) {
-      sfree(x);
-      natoms = read_first_x(&status,ftp2fn(efTRX,NFILE,fnm),&t,&x,box); 
-      if (natoms != top.atoms.nr)
-       gmx_fatal(FARGS,"natoms in trx = %d, in tpr = %d",natoms,top.atoms.nr);
-      fp = xvgropen(ftp2fn(efXVG,NFILE,fnm),"PME Energy","Time (ps)","E (kJ/mol)");
-    }
-    else
-      fp = NULL;
-    do {
-      /* Send coordinates, box and time to the other nodes */
-#ifdef GMX_MPI
-      if (PAR(cr)) {
-       MPI_Bcast(x[0],natoms*DIM,GMX_MPI_REAL,root,MPI_COMM_WORLD);
-       MPI_Bcast(box[0],DIM*DIM,GMX_MPI_REAL,root,MPI_COMM_WORLD);
-       MPI_Bcast(&t,1,GMX_MPI_REAL,root,MPI_COMM_WORLD);
-      }
-#endif
-      rm_pbc(&top.idef,nsb->natoms,box,x,x);
-      /* Call the PME wrapper function */
-      do_my_pme(stdlog,t,bVerbose,ir,x,xbuf,f,charge,qbuf,qqbuf,box,bSort,cr,
-               nsb,&nrnb,&(top.atoms.excl),qtot,fr,index,fp,
-               bGroups ? ir->opts.ngener : 1,mdatoms->cENER);
-      /* Only the master processor reads more data */
-      if (MASTER(cr))
-          bCont = read_next_x(status,&t,natoms,x,box);
-      /* Check whether we need to continue */
-#ifdef GMX_MPI
-      if (PAR(cr))
-          MPI_Bcast(&bCont,1,MPI_INT,root,MPI_COMM_WORLD);
-#endif
-      
-    } while (bCont);
-    
-    /* Finish I/O, close files */
-    if (MASTER(cr)) {
-      close_trx(status);
-      gmx_ffclose(fp);
-    }
-  }
-  
-  if (bVerbose) {
-    /* Do some final I/O about performance, might be useful in debugging */
-    fprintf(stdlog,"-----\n");
-    print_nrnb(stdlog,&nrnb);
-  }
-  
-  /* Finish the parallel stuff */  
-  if (gmx_parallel_env_initialized())
-    gmx_finalize(cr);
-
-  /* Thank the audience, as usual */
-  if (MASTER(cr)) 
-    gmx_thanx(stderr);
-
-  return 0;
-}
-
index 122dff53278d78ecc2636c9f93893b50001393fa..559258e8d889a59eb95aa0d366ad14de13e0bd58 100644 (file)
@@ -194,7 +194,7 @@ static inline int tMPI_Atomic_swap(tMPI_Atomic_t *a, int b)
 static inline void *tMPI_Atomic_ptr_swap(tMPI_Atomic_ptr_t *a, void *b)
 {
     void *volatile *ret = (void* volatile*)b;
-#ifndef __x86_64__
+#ifndef __LP64__
     __asm__ __volatile__("\txchgl %0, %1;"
                          : "+r" (ret), "+m" (a->value)
                          :
index 06f3f7d53b91a187fc0f6d85490d751f3a960f30..871d17e26e179e966b86bac8503e0a71d9d08495 100644 (file)
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8.8)
 
 project(TNG_IO)
 set(PROJECT_VERSION "1.5")
@@ -33,7 +33,7 @@ check_include_file(inttypes.h   HAVE_INTTYPES_H)
 
 add_subdirectory(src)
 
-install(FILES include/tng_io.h DESTINATION include/)
+install(FILES include/tng_io.h include/tng_io_fwd.h DESTINATION include/)
 
 #-- Add an Option to toggle the generation of the API documentation
 option(TNG_BUILD_DOCUMENTATION "Use Doxygen to create the HTML based API documentation" OFF)
index 3efd6bbf4d68d84c1b14569037a4c6c9c2a0f8a5..8bb0220aa729f5e3b8d56413d990900112c04b17 100644 (file)
@@ -7,6 +7,9 @@ if(UNIX)
   target_link_libraries(tng_compress m)
 endif()
 
+# Use GNUInstallDirst to set paths on multiarch systems
+include(GNUInstallDirs)
+
 install(TARGETS tng_compress
-        LIBRARY DESTINATION lib
-        ARCHIVE DESTINATION lib)
+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
index 81b5843e876755b4537f7bc164a01a5a7bcde6a7..838f827c585753b9dc612f45ff42945e1a1da3d0 100644 (file)
@@ -29,6 +29,9 @@ if(TNG_BUILD_WITH_ZLIB)
   target_link_libraries(tng_io ${ZLIB_LIBRARIES})
 endif()
 
+# Use GNUInstallDirst to set paths on multiarch systems
+include(GNUInstallDirs)
+
 install(TARGETS tng_io
-        LIBRARY DESTINATION lib
-        ARCHIVE DESTINATION lib)
+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
index dc985bf87396ad1d857b66ee4ba8e18bf44e535a..51a35a4e6504df6e756144950001baada96a021c 100644 (file)
@@ -155,10 +155,11 @@ else()
 endif()
 set_source_files_properties(selection/scanner.cpp PROPERTIES COMPILE_FLAGS "${_scanner_cpp_compiler_flags}")
 
-target_link_libraries(libgromacs ${GMX_GPU_LIBRARIES}
+target_link_libraries(libgromacs
+                      ${EXTRAE_LIBRARIES}
+                      ${GMX_GPU_LIBRARIES}
                       ${GMX_EXTRA_LIBRARIES}
                       ${GMX_TNG_LIBRARIES}
-                      ${EXTRAE_LIBRARIES}
                       ${FFT_LIBRARIES} ${LINEAR_ALGEBRA_LIBRARIES}
                       ${XML_LIBRARIES}
                       ${THREAD_LIB} ${GMX_SHARED_LINKER_FLAGS})
index eb520c2e1f75feb1db867ea8fa86332403d1d986..6097d0db7b609e1b989d8ca6461343c44d6d810b 100644 (file)
@@ -1443,7 +1443,7 @@ int xdr_xtc_seek_time(real time, FILE *fp, XDR *xdrs, int natoms, gmx_bool bSeek
 
     if (bSeekForwardOnly)
     {
-        low = gmx_ftell(fp);
+        low = gmx_ftell(fp)-header_size;
     }
     if (gmx_fseek(fp, 0, SEEK_END))
     {
index 3b9cab7cab8f5dcdf3c8a927e37977769faf518c..af6709234154b3463b4e4aa9aadd20dfaca803b2 100644 (file)
@@ -78,16 +78,8 @@ static const char *pdbtp[epdbNR] = {
 };
 
 
-/* this is not very good,
-   but these are only used in gmx_trjconv and gmx_editconv */
-static gmx_bool bWideFormat = FALSE;
 #define REMARK_SIM_BOX "REMARK    THIS IS A SIMULATION BOX"
 
-void set_pdb_wide_format(gmx_bool bSet)
-{
-    bWideFormat = bSet;
-}
-
 static void xlate_atomname_pdb2gmx(char *name)
 {
     int  i, length;
@@ -274,10 +266,12 @@ void write_pdbfile_indexed(FILE *out, const char *title,
                            gmx_conect conect, gmx_bool bTerSepChains)
 {
     gmx_conect_t     *gc = (gmx_conect_t *)conect;
-    char              resnm[6], nm[6], pdbform[128], pukestring[100];
+    char              resnm[6], nm[6], pukestring[100];
     atom_id           i, ii;
-    int               resind, resnr, type;
+    int               resind, resnr;
+    enum PDB_record   type;
     unsigned char     resic, ch;
+    char              altloc;
     real              occup, bfac;
     gmx_bool          bOccup;
     int               nlongname = 0;
@@ -291,11 +285,6 @@ void write_pdbfile_indexed(FILE *out, const char *title,
 
     bromacs(pukestring, 99);
     fprintf(out, "TITLE     %s\n", (title && title[0]) ? title : pukestring);
-    if (bWideFormat)
-    {
-        fprintf(out, "REMARK    This file does not adhere to the PDB standard\n");
-        fprintf(out, "REMARK    As a result of, some programs may not like it\n");
-    }
     if (box && ( norm2(box[XX]) || norm2(box[YY]) || norm2(box[ZZ]) ) )
     {
         gmx_write_pdb_box(out, ePBC, box);
@@ -346,7 +335,10 @@ void write_pdbfile_indexed(FILE *out, const char *title,
         }
 
         strncpy(resnm, *atoms->resinfo[resind].name, sizeof(resnm)-1);
+        resnm[sizeof(resnm)-1] = 0;
         strncpy(nm, *atoms->atomname[i], sizeof(nm)-1);
+        nm[sizeof(nm)-1] = 0;
+
         /* rename HG12 to 2HG1, etc. */
         xlate_atomname_gmx2pdb(nm);
         resnr = atoms->resinfo[resind].nr;
@@ -370,53 +362,40 @@ void write_pdbfile_indexed(FILE *out, const char *title,
         }
         if (atoms->pdbinfo)
         {
-            type  = atoms->pdbinfo[i].type;
+            type   = (enum PDB_record)(atoms->pdbinfo[i].type);
+            altloc = atoms->pdbinfo[i].altloc;
+            if (!isalnum(altloc))
+            {
+                altloc = ' ';
+            }
             occup = bOccup ? 1.0 : atoms->pdbinfo[i].occup;
             bfac  = atoms->pdbinfo[i].bfac;
         }
         else
         {
-            type  = 0;
-            occup = 1.0;
-            bfac  = 0.0;
-        }
-        if (bWideFormat)
-        {
-            strcpy(pdbform,
-                   "%-6s%5u %-4.4s %3.3s %c%4d%c   %10.5f%10.5f%10.5f%8.4f%8.4f    %2s\n");
-        }
-        else
-        {
-            /* Check whether atomname is an element name */
-            if ((strlen(nm) < 4) && (gmx_strcasecmp(nm, atoms->atom[i].elem) != 0))
-            {
-                strcpy(pdbform, get_pdbformat());
-            }
-            else
-            {
-                strcpy(pdbform, get_pdbformat4());
-                if (strlen(nm) > 4)
-                {
-                    int maxwln = 20;
-                    if (nlongname < maxwln)
-                    {
-                        fprintf(stderr, "WARNING: Writing out atom name (%s) longer than 4 characters to .pdb file\n", nm);
-                    }
-                    else if (nlongname == maxwln)
-                    {
-                        fprintf(stderr, "WARNING: More than %d long atom names, will not write more warnings\n", maxwln);
-                    }
-                    nlongname++;
-                }
-            }
-            strcat(pdbform, "%6.2f%6.2f          %2s\n");
+            type   = epdbATOM;
+            occup  = 1.0;
+            bfac   = 0.0;
+            altloc = ' ';
         }
-        fprintf(out, pdbform, pdbtp[type], (i+1)%100000, nm, resnm, ch, resnr,
-                (resic == '\0') ? ' ' : resic,
-                10*x[i][XX], 10*x[i][YY], 10*x[i][ZZ], occup, bfac, atoms->atom[i].elem);
+
+        gmx_fprintf_pdb_atomline(out,
+                                 type,
+                                 i+1,
+                                 nm,
+                                 altloc,
+                                 resnm,
+                                 ch,
+                                 resnr,
+                                 resic,
+                                 10*x[i][XX], 10*x[i][YY], 10*x[i][ZZ],
+                                 occup,
+                                 bfac,
+                                 atoms->atom[i].elem);
+
         if (atoms->pdbinfo && atoms->pdbinfo[i].bAnisotropic)
         {
-            fprintf(out, "ANISOU%5u  %-4.4s%3.3s %c%4d%c %7d%7d%7d%7d%7d%7d\n",
+            fprintf(out, "ANISOU%5u  %-4.4s%4.4s%c%4d%c %7d%7d%7d%7d%7d%7d\n",
                     (i+1)%100000, nm, resnm, ch, resnr,
                     (resic == '\0') ? ' ' : resic,
                     atoms->pdbinfo[i].uij[0], atoms->pdbinfo[i].uij[1],
@@ -599,7 +578,7 @@ static int read_atom(t_symtab *symtab,
     t_atom       *atomn;
     int           j, k;
     char          nc = '\0';
-    char          anr[12], anm[12], anm_copy[12], altloc, resnm[12], rnr[12];
+    char          anr[12], anm[12], anm_copy[12], altloc, resnm[12], rnr[12], elem[3];
     char          xc[12], yc[12], zc[12], occup[12], bfac[12];
     unsigned char resic;
     char          chainid;
@@ -682,6 +661,17 @@ static int read_atom(t_symtab *symtab,
     }
     bfac[k] = nc;
 
+    /* 10 blanks */
+    j += 10;
+
+    /* Element name */
+    for (k = 0; (k < 2); k++, j++)
+    {
+        elem[k] = line[j];
+    }
+    elem[k] = nc;
+    trim(elem);
+
     if (atoms->atom)
     {
         atomn = &(atoms->atom[natom]);
@@ -713,7 +703,7 @@ static int read_atom(t_symtab *symtab,
         atomn->m               = 0.0;
         atomn->q               = 0.0;
         atomn->atomnumber      = atomnumber;
-        atomn->elem[0]         = '\0';
+        strncpy(atomn->elem, elem, 4);
     }
     x[natom][XX] = strtod(xc, NULL)*0.1;
     x[natom][YY] = strtod(yc, NULL)*0.1;
@@ -1063,14 +1053,83 @@ gmx_conect gmx_conect_generate(t_topology *top)
     return gc;
 }
 
-const char* get_pdbformat()
+int
+gmx_fprintf_pdb_atomline(FILE *            fp,
+                         enum PDB_record   record,
+                         int               atom_seq_number,
+                         const char *      atom_name,
+                         char              alternate_location,
+                         const char *      res_name,
+                         char              chain_id,
+                         int               res_seq_number,
+                         char              res_insertion_code,
+                         real              x,
+                         real              y,
+                         real              z,
+                         real              occupancy,
+                         real              b_factor,
+                         const char *      element)
 {
-    static const char *pdbformat = "%-6s%5u  %-4.4s%3.3s %c%4d%c   %8.3f%8.3f%8.3f";
-    return pdbformat;
-}
+    char     tmp_atomname[6], tmp_resname[6];
+    gmx_bool start_name_in_col13;
+    int      n;
 
-const char* get_pdbformat4()
-{
-    static const char *pdbformat4 = "%-6s%5u %-4.4s %3.3s %c%4d%c   %8.3f%8.3f%8.3f";
-    return pdbformat4;
+    if (record != epdbATOM && record != epdbHETATM)
+    {
+        gmx_fatal(FARGS, "Can only print PDB atom lines as ATOM or HETATM records");
+    }
+
+    /* Format atom name */
+    if (atom_name != NULL)
+    {
+        /* If the atom name is an element name with two chars, it should start already in column 13.
+         * Otherwise it should start in column 14, unless the name length is 4 chars.
+         */
+        if ( (element != NULL) && (strlen(element) >= 2) && (gmx_strncasecmp(atom_name, element, 2) == 0) )
+        {
+            start_name_in_col13 = TRUE;
+        }
+        else
+        {
+            start_name_in_col13 = (strlen(atom_name) >= 4);
+        }
+        sprintf(tmp_atomname, start_name_in_col13 ? "" : " ");
+        strncat(tmp_atomname, atom_name, 4);
+        tmp_atomname[5] = '\0';
+    }
+    else
+    {
+        tmp_atomname[0] = '\0';
+    }
+
+    /* Format residue name */
+    strncpy(tmp_resname, (res_name != NULL) ? res_name : "", 4);
+    /* Make sure the string is terminated if strlen was > 4 */
+    tmp_resname[4] = '\0';
+    /* String is properly terminated, so now we can use strcat. By adding a
+     * space we can write it right-justified, and if the original name was
+     * three characters or less there will be a space added on the right side.
+     */
+    strcat(tmp_resname, " ");
+
+    /* Truncate integers so they fit */
+    atom_seq_number = atom_seq_number % 100000;
+    res_seq_number  = res_seq_number % 10000;
+
+    n = fprintf(fp,
+                "%-6s%5d %-4.4s%c%4.4s%c%4d%c   %8.3f%8.3f%8.3f%6.2f%6.2f          %2s\n",
+                pdbtp[record],
+                atom_seq_number,
+                tmp_atomname,
+                alternate_location,
+                tmp_resname,
+                chain_id,
+                res_seq_number,
+                res_insertion_code,
+                x, y, z,
+                occupancy,
+                b_factor,
+                (element != NULL) ? element : "");
+
+    return n;
 }
index a8f41a62b384d3a9fb7275fa5fcf05ba25ce974a..241239a8a6aa27039b43b75b254f9682d9a45a9e 100644 (file)
@@ -52,27 +52,41 @@ struct t_topology;
 
 typedef struct gmx_conect_t *gmx_conect;
 
-/* THE pdb format (for ATOM/HETATOM lines) */
-const char* get_pdbformat(void);
-const char* get_pdbformat4(void);
-
 /* Enumerated type for pdb records. The other entries are ignored
  * when reading a pdb file
  */
-enum {
+enum PDB_record {
     epdbATOM,   epdbHETATM, epdbANISOU, epdbCRYST1, epdbCOMPND,
     epdbMODEL,  epdbENDMDL, epdbTER,    epdbHEADER, epdbTITLE, epdbREMARK,
     epdbCONECT, epdbNR
 };
 
+/* Write a PDB line with an ATOM or HETATM record directly to a file pointer.
+ *
+ * Returns the number of characters printed.
+ */
+int
+gmx_fprintf_pdb_atomline(FILE *            fp,
+                         enum PDB_record   record,
+                         int               atom_seq_number,
+                         const char *      atom_name,
+                         char              alternate_location,
+                         const char *      res_name,
+                         char              chain_id,
+                         int               res_seq_number,
+                         char              res_insertion_code,
+                         real              x,
+                         real              y,
+                         real              z,
+                         real              occupancy,
+                         real              b_factor,
+                         const char *      element);
+
 /* Enumerated value for indexing an uij entry (anisotropic temperature factors) */
 enum {
     U11, U22, U33, U12, U13, U23
 };
 
-void set_pdb_wide_format(gmx_bool bSet);
-/* If bSet, use wider format for occupancy and bfactor */
-
 void pdb_use_ter(gmx_bool bSet);
 /* set read_pdbatoms to read upto 'TER' or 'ENDMDL' (default, bSet=FALSE).
    This function is fundamentally broken as far as thread-safety is concerned.*/
index 7a2cb969dac3c8ac159bb30c71b7a8c406c70f18..1220278551bb37e2e4696f55c61e38487cef9eaf 100644 (file)
@@ -192,6 +192,9 @@ static void addTngMoleculeFromTopology(tng_trajectory_t     tng,
                                        gmx_int64_t          numMolecules,
                                        tng_molecule_t      *tngMol)
 {
+    tng_chain_t      tngChain = NULL;
+    tng_residue_t    tngRes   = NULL;
+
     if (tng_molecule_add(tng, moleculeName, tngMol) != TNG_SUCCESS)
     {
         gmx_file("Cannot add molecule to TNG molecular system.");
@@ -208,24 +211,32 @@ static void addTngMoleculeFromTopology(tng_trajectory_t     tng,
         {
             const t_resinfo *resInfo        = &atoms->resinfo[at->resind];
             char             chainName[2]   = {resInfo->chainid, 0};
-            tng_chain_t      tngChain       = NULL;
-            tng_residue_t    tngRes         = NULL;
             tng_atom_t       tngAtom        = NULL;
+            t_atom          *prevAtom;
 
-            if (tng_molecule_chain_find (tng, *tngMol, chainName,
-                                         (gmx_int64_t)-1, &tngChain) !=
-                TNG_SUCCESS)
+            if (atomIndex > 0)
+            {
+                prevAtom = &atoms->atom[atomIndex - 1];
+            }
+            else
             {
-                tng_molecule_chain_add (tng, *tngMol, chainName,
-                                        &tngChain);
+                prevAtom = 0;
             }
 
-            /* FIXME: When TNG supports both residue index and residue
-             * number the latter should be used. Wait for TNG 2.0*/
-            if (tng_chain_residue_find(tng, tngChain, *resInfo->name,
-                                       at->resind + 1, &tngRes)
-                != TNG_SUCCESS)
+            /* If this is the first atom or if the residue changed add the
+             * residue to the TNG molecular system. */
+            if (!prevAtom || resInfo != &atoms->resinfo[prevAtom->resind])
             {
+                /* If this is the first atom or if the chain changed add
+                 * the chain to the TNG molecular system. */
+                if (!prevAtom || resInfo->chainid !=
+                    atoms->resinfo[prevAtom->resind].chainid)
+                {
+                    tng_molecule_chain_add(tng, *tngMol, chainName,
+                                           &tngChain);
+                }
+                /* FIXME: When TNG supports both residue index and residue
+                 * number the latter should be used. Wait for TNG 2.0*/
                 tng_chain_residue_add(tng, tngChain, *resInfo->name, &tngRes);
             }
             tng_residue_atom_add(tng, tngRes, *(atoms->atomname[atomIndex]), *(atoms->atomtype[atomIndex]), &tngAtom);
index 55f5f6a0855d7ab550eafb1384b8f5edf2316bf0..996c4eff51cb1290d5d7d2411796cb9d17556598 100644 (file)
@@ -91,7 +91,8 @@ enum tpxv {
     tpxv_ComputationalElectrophysiology = 96,                /**< support for ion/water position swaps (computational electrophysiology) */
     tpxv_Use64BitRandomSeed,                                 /**< change ld_seed from int to gmx_int64_t */
     tpxv_RestrictedBendingAndCombinedAngleTorsionPotentials, /**< potentials for supporting coarse-grained force fields */
-    tpxv_InteractiveMolecularDynamics                        /**< interactive molecular dynamics (IMD) */
+    tpxv_InteractiveMolecularDynamics,                       /**< interactive molecular dynamics (IMD) */
+    tpxv_RemoveObsoleteParameters1                           /**< remove optimize_fft, dihre_fc, nstcheckpoint */
 };
 
 /*! \brief Version number of the file format written to run input
@@ -105,7 +106,7 @@ enum tpxv {
  *
  * When developing a feature branch that needs to change the run input
  * file format, change tpx_tag instead. */
-static const int tpx_version = tpxv_InteractiveMolecularDynamics;
+static const int tpx_version = tpxv_RemoveObsoleteParameters1;
 
 
 /* This number should only be increased when you edit the TOPOLOGY section
@@ -818,7 +819,7 @@ static void do_inputrec(t_fileio *fio, t_inputrec *ir, gmx_bool bRead,
     int      i, j, k, *tmp, idum = 0;
     real     rdum, bd_temp;
     rvec     vdum;
-    gmx_bool bSimAnn;
+    gmx_bool bSimAnn, bdum = 0;
     real     zerotemptime, finish_t, init_temp, finish_temp;
 
     if (file_version != tpx_version)
@@ -849,6 +850,7 @@ static void do_inputrec(t_fileio *fio, t_inputrec *ir, gmx_bool bRead,
         gmx_fio_do_int(fio, idum);
         ir->nsteps = idum;
     }
+
     if (file_version > 25)
     {
         if (file_version >= 62)
@@ -924,7 +926,7 @@ static void do_inputrec(t_fileio *fio, t_inputrec *ir, gmx_bool bRead,
     }
     gmx_fio_do_int(fio, ir->ns_type);
     gmx_fio_do_int(fio, ir->nstlist);
-    gmx_fio_do_int(fio, ir->ndelta);
+    gmx_fio_do_int(fio, idum); /* used to be ndelta; not used anymore */
     if (file_version < 41)
     {
         gmx_fio_do_int(fio, idum);
@@ -953,13 +955,10 @@ static void do_inputrec(t_fileio *fio, t_inputrec *ir, gmx_bool bRead,
     }
     ir->nstcomm = abs(ir->nstcomm);
 
-    if (file_version > 25)
-    {
-        gmx_fio_do_int(fio, ir->nstcheckpoint);
-    }
-    else
+    /* ignore nstcheckpoint */
+    if (file_version > 25 && file_version < tpxv_RemoveObsoleteParameters1)
     {
-        ir->nstcheckpoint = 0;
+        gmx_fio_do_int(fio, idum);
     }
 
     gmx_fio_do_int(fio, ir->nstcgsteep);
@@ -1184,7 +1183,11 @@ static void do_inputrec(t_fileio *fio, t_inputrec *ir, gmx_bool bRead,
         gmx_fio_do_real(fio, ir->epsilon_surface);
     }
 
-    gmx_fio_do_gmx_bool(fio, ir->bOptFFT);
+    /* ignore bOptFFT */
+    if (file_version < tpxv_RemoveObsoleteParameters1)
+    {
+        gmx_fio_do_gmx_bool(fio, bdum);
+    }
 
     if (file_version >= 93)
     {
@@ -1388,19 +1391,17 @@ static void do_inputrec(t_fileio *fio, t_inputrec *ir, gmx_bool bRead,
         ir->orires_tau  = 0;
         ir->nstorireout = 0;
     }
+
+    /* ignore dihre_fc */
     if (file_version >= 26 && file_version < 79)
     {
-        gmx_fio_do_real(fio, ir->dihre_fc);
+        gmx_fio_do_real(fio, rdum);
         if (file_version < 56)
         {
             gmx_fio_do_real(fio, rdum);
             gmx_fio_do_int(fio, idum);
         }
     }
-    else
-    {
-        ir->dihre_fc = 0;
-    }
 
     gmx_fio_do_real(fio, ir->em_stepsize);
     gmx_fio_do_real(fio, ir->em_tol);
@@ -2383,10 +2384,52 @@ static void do_blocka(t_fileio *fio, t_blocka *block, gmx_bool bRead,
     gmx_fio_ndo_int(fio, block->a, block->nra);
 }
 
+/* This is a primitive routine to make it possible to translate atomic numbers
+ * to element names when reading TPR files, without making the Gromacs library
+ * directory a dependency on mdrun (which is the case if we need elements.dat).
+ */
+static const char *
+atomicnumber_to_element(int atomicnumber)
+{
+    const char * p;
+
+    /* This does not have to be complete, so we only include elements likely
+     * to occur in PDB files.
+     */
+    switch (atomicnumber)
+    {
+        case 1:  p = "H";  break;
+        case 5:  p = "B";  break;
+        case 6:  p = "C";  break;
+        case 7:  p = "N";  break;
+        case 8:  p = "O";  break;
+        case 9:  p = "F";  break;
+        case 11: p = "Na"; break;
+        case 12: p = "Mg"; break;
+        case 15: p = "P";  break;
+        case 16: p = "S";  break;
+        case 17: p = "Cl"; break;
+        case 18: p = "Ar"; break;
+        case 19: p = "K";  break;
+        case 20: p = "Ca"; break;
+        case 25: p = "Mn"; break;
+        case 26: p = "Fe"; break;
+        case 28: p = "Ni"; break;
+        case 29: p = "Cu"; break;
+        case 30: p = "Zn"; break;
+        case 35: p = "Br"; break;
+        case 47: p = "Ag"; break;
+        default: p = "";   break;
+    }
+    return p;
+}
+
+
 static void do_atom(t_fileio *fio, t_atom *atom, int ngrp, gmx_bool bRead,
                     int file_version, gmx_groups_t *groups, int atnr)
 {
-    int i, myngrp;
+    int    i, myngrp;
+    char * p_elem;
 
     gmx_fio_do_real(fio, atom->m);
     gmx_fio_do_real(fio, atom->q);
@@ -2399,6 +2442,15 @@ static void do_atom(t_fileio *fio, t_atom *atom, int ngrp, gmx_bool bRead,
     if (file_version >= 52)
     {
         gmx_fio_do_int(fio, atom->atomnumber);
+        if (bRead)
+        {
+            /* Set element string from atomic number if present.
+             * This routine returns an empty string if the name is not found.
+             */
+            strncpy(atom->elem, atomicnumber_to_element(atom->atomnumber), 4);
+            /* avoid warnings about potentially unterminated string */
+            atom->elem[3] = '\0';
+        }
     }
     else if (bRead)
     {
@@ -2984,8 +3036,8 @@ static void set_disres_npair(gmx_mtop_t *mtop)
 static void do_mtop(t_fileio *fio, gmx_mtop_t *mtop, gmx_bool bRead,
                     int file_version)
 {
-    int      mt, mb, i;
-    t_blocka dumb;
+    int            mt, mb, i;
+    t_blocka       dumb;
 
     if (bRead)
     {
index 85b311473d396015379846941912432ed96ff30d..dbbfc4b94982083210b32698d9d84280c947d8a1 100644 (file)
@@ -63,6 +63,7 @@ typedef struct t_trxframe
     int      natoms;           /* number of atoms (atoms, x, v, f) */
     real     t0;               /* time of the first frame, needed  *
                                 * for skipping frames with -dt     */
+    real     tf;               /* internal frame time - DO NOT CHANGE */
     real     tpf;              /* time of the previous frame, not  */
                                /* the read, but real file frames   */
     real     tppf;             /* time of two frames ago           */
index 4372e7edb182f87d0e31c6dbdc17c0de710f9e76..c96a142e1e707b153a55d53abc710ebd4b4aac51 100644 (file)
@@ -281,6 +281,7 @@ void clear_trxframe(t_trxframe *fr, gmx_bool bFirst)
         fr->bDouble   = FALSE;
         fr->natoms    = -1;
         fr->t0        = 0;
+        fr->tf        = 0;
         fr->tpf       = 0;
         fr->tppf      = 0;
         fr->title     = NULL;
@@ -794,13 +795,13 @@ gmx_bool read_next_frame(const output_env_t oenv, t_trxstatus *status, t_trxfram
     int      ftp;
 
     bRet = FALSE;
-    pt   = fr->time;
+    pt   = fr->tf;
 
     do
     {
         clear_trxframe(fr, FALSE);
         fr->tppf = fr->tpf;
-        fr->tpf  = fr->time;
+        fr->tpf  = fr->tf;
 
         if (status->tng)
         {
@@ -833,7 +834,7 @@ gmx_bool read_next_frame(const output_env_t oenv, t_trxstatus *status, t_trxfram
                 /* DvdS 2005-05-31: this has been fixed along with the increased
                  * accuracy of the control over -b and -e options.
                  */
-                if (bTimeSet(TBEGIN) && (fr->time < rTimeValue(TBEGIN)))
+                if (bTimeSet(TBEGIN) && (fr->tf < rTimeValue(TBEGIN)))
                 {
                     if (xtc_seek_time(status->fio, rTimeValue(TBEGIN), fr->natoms, TRUE))
                     {
@@ -874,6 +875,7 @@ gmx_bool read_next_frame(const output_env_t oenv, t_trxstatus *status, t_trxfram
                           gmx_fio_getname(status->fio));
 #endif
         }
+        fr->tf = fr->time;
 
         if (bRet)
         {
@@ -1043,6 +1045,7 @@ int read_first_frame(const output_env_t oenv, t_trxstatus **status,
 #endif
             break;
     }
+    fr->tf = fr->time;
 
     /* Return FALSE if we read a frame that's past the set ending time. */
     if (!bFirst && (!(fr->flags & TRX_DONT_SKIP) && check_times(fr->time) > 0))
index 98f4b4fd3e0c3093cf8648b0cb971e6a709415ed..116529dc8d61d4b1edca5a1b881ff39bf3f489c7 100644 (file)
@@ -420,7 +420,8 @@ void mk_chi_lookup (int **lookup, int maxchi,
     int i, j, Dih, Chi;
 
     j = 0;
-    for (Dih = 0; (Dih < NONCHI+maxchi); Dih++)
+    /* NONCHI points to chi1, therefore we have to start counting there. */
+    for (Dih = NONCHI; (Dih < NONCHI+maxchi); Dih++)
     {
         for (i = 0; (i < nlist); i++)
         {
@@ -571,9 +572,12 @@ void get_chi_product_traj (real **dih, int nframes, int nlist,
                 sprintf(histitle, "cumulative rotamer distribution for %s", dlist[i].name);
                 fprintf(stderr, "  and %s  ", hisfile);
                 fp = xvgropen(hisfile, histitle, "number", "", oenv);
-                fprintf(fp, "@ xaxis tick on\n");
-                fprintf(fp, "@ xaxis tick major 1\n");
-                fprintf(fp, "@ type xy\n");
+                if (output_env_get_print_xvgr_codes(oenv))
+                {
+                    fprintf(fp, "@ xaxis tick on\n");
+                    fprintf(fp, "@ xaxis tick major 1\n");
+                    fprintf(fp, "@ type xy\n");
+                }
                 for (k = 0; (k < nbin); k++)
                 {
                     if (bNormalize)
@@ -585,7 +589,7 @@ void get_chi_product_traj (real **dih, int nframes, int nlist,
                         fprintf(fp, "%5d  %10d\n", k, chi_prhist[k]);
                     }
                 }
-                fprintf(fp, "&\n");
+                fprintf(fp, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
                 gmx_ffclose(fp);
             }
 
index 2c46a8f7efdc94c88c144b7dba5ec26d7148bc9d..5b7e568afd07c4eb9f2f4b36252b93476b3de52a 100644 (file)
@@ -260,18 +260,12 @@ static void write_xvgr_graphs(const char *file, int ngraphs, int nsetspergraph,
             {
                 if (bSplit && i > 0 && fabs(x[i]) < 1e-5)
                 {
-                    if (output_env_get_print_xvgr_codes(oenv))
-                    {
-                        fprintf(out, "&\n");
-                    }
+                    fprintf(out, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
                 }
                 fprintf(out, "%10.4f %10.5f\n",
                         x[i]*scale_x, y ? y[g][i] : sy[g][s][i]);
             }
-            if (output_env_get_print_xvgr_codes(oenv))
-            {
-                fprintf(out, "&\n");
-            }
+            fprintf(out, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
         }
     }
     gmx_ffclose(out);
@@ -473,8 +467,10 @@ static void overlap(const char *outfile, int natoms,
 
     out = xvgropen(outfile, "Subspace overlap",
                    "Eigenvectors of trajectory 2", "Overlap", oenv);
-    fprintf(out, "@ subtitle \"using %d eigenvectors of trajectory 1\"\n",
-            noutvec);
+    if (output_env_get_print_xvgr_codes(oenv))
+    {
+        fprintf(out, "@ subtitle \"using %d eigenvectors of trajectory 1\"\n", noutvec);
+    }
     overlap = 0;
     for (x = 0; x < nvec2; x++)
     {
@@ -673,7 +669,7 @@ static void project(const char *trajfile, t_topology *top, int ePBC, matrix topb
         {
             if (bSplit && i > 0 && fabs(inprod[noutvec][i]) < 1e-5)
             {
-                fprintf(xvgrout, "&\n");
+                fprintf(xvgrout, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
             }
             fprintf(xvgrout, "%10.5f %10.5f\n", inprod[0][i], inprod[noutvec-1][i]);
         }
@@ -686,7 +682,7 @@ static void project(const char *trajfile, t_topology *top, int ePBC, matrix topb
         rvec       *x;
         real       *b = NULL;
         matrix      box;
-        char       *resnm, *atnm, pdbform[STRLEN];
+        char       *resnm, *atnm;
         gmx_bool    bPDB, b4D;
         FILE       *out;
 
@@ -747,9 +743,6 @@ static void project(const char *trajfile, t_topology *top, int ePBC, matrix topb
         }
         if ( ( b4D || bSplit ) && bPDB)
         {
-            strcpy(pdbform, get_pdbformat());
-            strcat(pdbform, "%8.4f%8.4f\n");
-
             out = gmx_ffopen(threedplotfile, "w");
             fprintf(out, "HEADER    %s\n", str);
             if (b4D)
@@ -764,8 +757,8 @@ static void project(const char *trajfile, t_topology *top, int ePBC, matrix topb
                     fprintf(out, "TER\n");
                     j = 0;
                 }
-                fprintf(out, pdbform, "ATOM", i+1, "C", "PRJ", ' ', j+1,
-                        10*x[i][XX], 10*x[i][YY], 10*x[i][ZZ], 1.0, 10*b[i]);
+                gmx_fprintf_pdb_atomline(out, epdbATOM, i+1, "C", ' ', "PRJ", ' ', j+1, ' ',
+                                         10*x[i][XX], 10*x[i][YY], 10*x[i][ZZ], 1.0, 10*b[i], "");
                 if (j > 0)
                 {
                     fprintf(out, "CONECT%5d%5d\n", i, i+1);
index c84f3edda7d185078475b5db1944ec546caf9bdc..f76ad8aa6128e1b32e986c262eb124e663ca0f9e 100644 (file)
@@ -293,7 +293,7 @@ void histogram(const char *distfile, real binwidth, int n, int nset, real **val,
         }
         if (s < nset-1)
         {
-            fprintf(fp, "&\n");
+            fprintf(fp, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
         }
     }
     gmx_ffclose(fp);
@@ -613,9 +613,16 @@ static void estimate_error(const char *eefile, int nb_min, int resol, int n,
         }
         fprintf(stdout, "Set %3d:  err.est. %g  a %g  tau1 %g  tau2 %g\n",
                 s+1, ee, a, tau1, tau2);
-        fprintf(fp, "@ legend string %d \"av %f\"\n", 2*s, av[s]);
-        fprintf(fp, "@ legend string %d \"ee %6g\"\n",
-                2*s+1, sig[s]*anal_ee_inf(fitparm, n*dt));
+        if (output_env_get_xvg_format(oenv) == exvgXMGR)
+        {
+            fprintf(fp, "@ legend string %d \"av %f\"\n", 2*s, av[s]);
+            fprintf(fp, "@ legend string %d \"ee %6g\"\n", 2*s+1, sig[s]*anal_ee_inf(fitparm, n*dt));
+        }
+        else if (output_env_get_xvg_format(oenv) == exvgXMGRACE)
+        {
+            fprintf(fp, "@ s%d legend \"av %f\"\n", 2*s, av[s]);
+            fprintf(fp, "@ s%d legend \"ee %6g\"\n", 2*s+1, sig[s]*anal_ee_inf(fitparm, n*dt));
+        }
         for (i = 0; i < nbs; i++)
         {
             fprintf(fp, "%g %g %g\n", tbs[i], sig[s]*sqrt(ybs[i]/(n*dt)),
@@ -671,7 +678,7 @@ static void estimate_error(const char *eefile, int nb_min, int resol, int n,
                     s+1, sig[s]*anal_ee_inf(ac_fit, n*dt),
                     ac_fit[1], ac_fit[0], ac_fit[2]);
 
-            fprintf(fp, "&\n");
+            fprintf(fp, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
             for (i = 0; i < nbs; i++)
             {
                 fprintf(fp, "%g %g\n", tbs[i],
@@ -682,7 +689,7 @@ static void estimate_error(const char *eefile, int nb_min, int resol, int n,
         }
         if (s < nset-1)
         {
-            fprintf(fp, "&\n");
+            fprintf(fp, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
         }
     }
     sfree(fitsig);
@@ -1355,7 +1362,7 @@ int gmx_analyze(int argc, char *argv[])
             }
             if (s < nset-1)
             {
-                fprintf(out, "&\n");
+                fprintf(out, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
             }
         }
         gmx_ffclose(out);
index b5c3d7e1a3d7d5c10f46643ec08a1d8e536edc1a..927e15abaf37b5a4415e5c55b71ff529ca1e4ac9 100644 (file)
@@ -443,15 +443,18 @@ int gmx_g_angle(int argc, char *argv[])
         {
             maxstat = max(maxstat, angstat[i]*norm_fac);
         }
-        fprintf(out, "@with g0\n");
-        fprintf(out, "@    world xmin -180\n");
-        fprintf(out, "@    world xmax  180\n");
-        fprintf(out, "@    world ymin 0\n");
-        fprintf(out, "@    world ymax %g\n", maxstat*1.05);
-        fprintf(out, "@    xaxis  tick major 60\n");
-        fprintf(out, "@    xaxis  tick minor 30\n");
-        fprintf(out, "@    yaxis  tick major 0.005\n");
-        fprintf(out, "@    yaxis  tick minor 0.0025\n");
+        if (output_env_get_print_xvgr_codes(oenv))
+        {
+            fprintf(out, "@with g0\n");
+            fprintf(out, "@    world xmin -180\n");
+            fprintf(out, "@    world xmax  180\n");
+            fprintf(out, "@    world ymin 0\n");
+            fprintf(out, "@    world ymax %g\n", maxstat*1.05);
+            fprintf(out, "@    xaxis  tick major 60\n");
+            fprintf(out, "@    xaxis  tick minor 30\n");
+            fprintf(out, "@    yaxis  tick major 0.005\n");
+            fprintf(out, "@    yaxis  tick minor 0.0025\n");
+        }
     }
     for (i = first; (i <= last); i++)
     {
index 82c7ee3dca16e9c3a5335a497b7027927a539791..652834c4a664ebdde590950101dc9268e1f3ce2c 100644 (file)
@@ -764,16 +764,22 @@ static void histogramming(FILE *log, int nbin, gmx_residuetype_t *rt,
                 strcpy(hhisfile, hisfile);
                 strcat(hhisfile, ".xvg");
                 fp = xvgropen(hhisfile, title, "Degrees", "", oenv);
-                fprintf(fp, "@ with g0\n");
+                if (output_env_get_print_xvgr_codes(oenv))
+                {
+                    fprintf(fp, "@ with g0\n");
+                }
                 xvgr_world(fp, -180, 0, 180, 0.1, oenv);
-                fprintf(fp, "# this effort to set graph size fails unless you run with -autoscale none or -autoscale y flags\n");
-                fprintf(fp, "@ xaxis tick on\n");
-                fprintf(fp, "@ xaxis tick major 90\n");
-                fprintf(fp, "@ xaxis tick minor 30\n");
-                fprintf(fp, "@ xaxis ticklabel prec 0\n");
-                fprintf(fp, "@ yaxis tick off\n");
-                fprintf(fp, "@ yaxis ticklabel off\n");
-                fprintf(fp, "@ type xy\n");
+                if (output_env_get_print_xvgr_codes(oenv))
+                {
+                    fprintf(fp, "# this effort to set graph size fails unless you run with -autoscale none or -autoscale y flags\n");
+                    fprintf(fp, "@ xaxis tick on\n");
+                    fprintf(fp, "@ xaxis tick major 90\n");
+                    fprintf(fp, "@ xaxis tick minor 30\n");
+                    fprintf(fp, "@ xaxis ticklabel prec 0\n");
+                    fprintf(fp, "@ yaxis tick off\n");
+                    fprintf(fp, "@ yaxis ticklabel off\n");
+                    fprintf(fp, "@ type xy\n");
+                }
                 if (bSSHisto)
                 {
                     for (k = 0; (k < 3); k++)
@@ -802,13 +808,13 @@ static void histogramming(FILE *log, int nbin, gmx_residuetype_t *rt,
                         }
                     }
                 }
-                fprintf(fp, "&\n");
+                fprintf(fp, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
                 gmx_ffclose(fp);
                 if (bSSHisto)
                 {
                     for (k = 0; (k < 3); k++)
                     {
-                        fprintf(ssfp[k], "&\n");
+                        fprintf(ssfp[k], "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
                         gmx_ffclose(ssfp[k]);
                     }
                 }
@@ -843,30 +849,35 @@ static FILE *rama_file(const char *fn, const char *title, const char *xaxis,
     FILE *fp;
 
     fp = xvgropen(fn, title, xaxis, yaxis, oenv);
-    fprintf(fp, "@ with g0\n");
+    if (output_env_get_print_xvgr_codes(oenv))
+    {
+        fprintf(fp, "@ with g0\n");
+    }
     xvgr_world(fp, -180, -180, 180, 180, oenv);
-    fprintf(fp, "@ xaxis tick on\n");
-    fprintf(fp, "@ xaxis tick major 90\n");
-    fprintf(fp, "@ xaxis tick minor 30\n");
-    fprintf(fp, "@ xaxis ticklabel prec 0\n");
-    fprintf(fp, "@ yaxis tick on\n");
-    fprintf(fp, "@ yaxis tick major 90\n");
-    fprintf(fp, "@ yaxis tick minor 30\n");
-    fprintf(fp, "@ yaxis ticklabel prec 0\n");
-    fprintf(fp, "@    s0 type xy\n");
-    fprintf(fp, "@    s0 symbol 2\n");
-    fprintf(fp, "@    s0 symbol size 0.410000\n");
-    fprintf(fp, "@    s0 symbol fill 1\n");
-    fprintf(fp, "@    s0 symbol color 1\n");
-    fprintf(fp, "@    s0 symbol linewidth 1\n");
-    fprintf(fp, "@    s0 symbol linestyle 1\n");
-    fprintf(fp, "@    s0 symbol center false\n");
-    fprintf(fp, "@    s0 symbol char 0\n");
-    fprintf(fp, "@    s0 skip 0\n");
-    fprintf(fp, "@    s0 linestyle 0\n");
-    fprintf(fp, "@    s0 linewidth 1\n");
-    fprintf(fp, "@ type xy\n");
-
+    if (output_env_get_print_xvgr_codes(oenv))
+    {
+        fprintf(fp, "@ xaxis tick on\n");
+        fprintf(fp, "@ xaxis tick major 90\n");
+        fprintf(fp, "@ xaxis tick minor 30\n");
+        fprintf(fp, "@ xaxis ticklabel prec 0\n");
+        fprintf(fp, "@ yaxis tick on\n");
+        fprintf(fp, "@ yaxis tick major 90\n");
+        fprintf(fp, "@ yaxis tick minor 30\n");
+        fprintf(fp, "@ yaxis ticklabel prec 0\n");
+        fprintf(fp, "@    s0 type xy\n");
+        fprintf(fp, "@    s0 symbol 2\n");
+        fprintf(fp, "@    s0 symbol size 0.410000\n");
+        fprintf(fp, "@    s0 symbol fill 1\n");
+        fprintf(fp, "@    s0 symbol color 1\n");
+        fprintf(fp, "@    s0 symbol linewidth 1\n");
+        fprintf(fp, "@    s0 symbol linestyle 1\n");
+        fprintf(fp, "@    s0 symbol center false\n");
+        fprintf(fp, "@    s0 symbol char 0\n");
+        fprintf(fp, "@    s0 skip 0\n");
+        fprintf(fp, "@    s0 linestyle 0\n");
+        fprintf(fp, "@    s0 linewidth 1\n");
+        fprintf(fp, "@ type xy\n");
+    }
     return fp;
 }
 
@@ -1058,7 +1069,6 @@ static void order_params(FILE *log,
 {
     FILE *fp;
     int   nh[edMax];
-    char  buf[STRLEN];
     int   i, Dih, Xi;
     real  S2Max, S2Min;
 
@@ -1171,11 +1181,10 @@ static void order_params(FILE *log,
         x0 *= 10.0; /* nm -> angstrom */
         y0 *= 10.0; /* nm -> angstrom */
         z0 *= 10.0; /* nm -> angstrom */
-        sprintf(buf, "%s%%6.f%%6.2f\n", get_pdbformat());
         for (i = 0; (i < 10); i++)
         {
-            fprintf(fp, buf, "ATOM  ", atoms->nr+1+i, "CA", "LEG", ' ',
-                    atoms->nres+1, ' ', x0, y0, z0+(1.2*i), 0.0, -0.1*i);
+            gmx_fprintf_pdb_atomline(fp, epdbATOM, atoms->nr+1+i, "CA", ' ', "LEG", ' ', atoms->nres+1, ' ',
+                                     x0, y0, z0+(1.2*i), 0.0, -0.1*i, "");
         }
         gmx_ffclose(fp);
     }
index 765105707b0ff118809a1227c7447aeb7a476a79..1d957c8914c5076487c034653baf3974652e8165 100644 (file)
@@ -1098,9 +1098,12 @@ static void analyze_clusters(int nf, t_clusters *clust, real **rmsd,
     if (clustidfn)
     {
         fp = xvgropen(clustidfn, "Clusters", output_env_get_xvgr_tlabel(oenv), "Cluster #", oenv);
-        fprintf(fp, "@    s0 symbol 2\n");
-        fprintf(fp, "@    s0 symbol size 0.2\n");
-        fprintf(fp, "@    s0 linestyle 0\n");
+        if (output_env_get_print_xvgr_codes(oenv))
+        {
+            fprintf(fp, "@    s0 symbol 2\n");
+            fprintf(fp, "@    s0 symbol size 0.2\n");
+            fprintf(fp, "@    s0 linestyle 0\n");
+        }
         for (i = 0; i < nf; i++)
         {
             fprintf(fp, "%8g %8d\n", time[i], clust->cl[i]);
@@ -1110,7 +1113,10 @@ static void analyze_clusters(int nf, t_clusters *clust, real **rmsd,
     if (sizefn)
     {
         fp = xvgropen(sizefn, "Cluster Sizes", "Cluster #", "# Structures", oenv);
-        fprintf(fp, "@g%d type %s\n", 0, "bar");
+        if (output_env_get_print_xvgr_codes(oenv))
+        {
+            fprintf(fp, "@g%d type %s\n", 0, "bar");
+        }
     }
     snew(structure, nf);
     fprintf(log, "\n%3s | %3s  %4s | %6s %4s | cluster members\n",
index 1cbd6e8ce7f433cba47bd358991fd877738b0b5a..7a657edb5e8daa6f1678bd42aa60e18e69038310 100644 (file)
@@ -133,16 +133,23 @@ int get_electrons(t_electron **eltab, const char *fn)
     return nr;
 }
 
-void center_coords(t_atoms *atoms, matrix box, rvec x0[], int axis)
+void center_coords(t_atoms *atoms, atom_id *index_center, int ncenter,
+                   matrix box, rvec x0[])
 {
-    int  i, m;
+    int  i, k, m;
     real tmass, mm;
     rvec com, shift, box_center;
 
     tmass = 0;
     clear_rvec(com);
-    for (i = 0; (i < atoms->nr); i++)
+    for (k = 0; (k < ncenter); k++)
     {
+        i = index_center[k];
+        if (i >= atoms->nr)
+        {
+            gmx_fatal(FARGS, "Index %d refers to atom %d, which is larger than natoms (%d).",
+                      k+1, i+1, atoms->nr);
+        }
         mm     = atoms->atom[i].m;
         tmass += mm;
         for (m = 0; (m < DIM); m++)
@@ -156,8 +163,8 @@ void center_coords(t_atoms *atoms, matrix box, rvec x0[], int axis)
     }
     calc_box_center(ecenterDEF, box, box_center);
     rvec_sub(box_center, com, shift);
-    shift[axis] -= box_center[axis];
 
+    /* Important - while the center was calculated based on a group, we should move all atoms */
     for (i = 0; (i < atoms->nr); i++)
     {
         rvec_dec(x0[i], shift);
@@ -169,7 +176,8 @@ void calc_electron_density(const char *fn, atom_id **index, int gnx[],
                            int ePBC,
                            int axis, int nr_grps, real *slWidth,
                            t_electron eltab[], int nr, gmx_bool bCenter,
-                           const output_env_t oenv)
+                           atom_id *index_center, int ncenter,
+                           gmx_bool bRelative, const output_env_t oenv)
 {
     rvec        *x0;            /* coordinates without pbc */
     matrix       box;           /* box (3x3) */
@@ -181,6 +189,7 @@ void calc_electron_density(const char *fn, atom_id **index, int gnx[],
                  slice;         /* current slice */
     t_electron  *found;         /* found by bsearch */
     t_electron   sought;        /* thingie thought by bsearch */
+    real         boxSz, aveBox;
     gmx_rmpbc_t  gpbc = NULL;
 
     real         t,
@@ -196,11 +205,13 @@ void calc_electron_density(const char *fn, atom_id **index, int gnx[],
         gmx_fatal(FARGS, "Could not read coordinates from statusfile\n");
     }
 
+    aveBox = 0;
+
     if (!*nslices)
     {
         *nslices = (int)(box[axis][axis] * 10); /* default value */
+        fprintf(stderr, "\nDividing the box in %d slices\n", *nslices);
     }
-    fprintf(stderr, "\nDividing the box in %d slices\n", *nslices);
 
     snew(*slDensity, nr_grps);
     for (i = 0; i < nr_grps; i++)
@@ -214,14 +225,29 @@ void calc_electron_density(const char *fn, atom_id **index, int gnx[],
     {
         gmx_rmpbc(gpbc, natoms, box, x0);
 
+        /* Translate atoms so the com of the center-group is in the
+         * box geometrical center.
+         */
         if (bCenter)
         {
-            center_coords(&top->atoms, box, x0, axis);
+            center_coords(&top->atoms, index_center, ncenter, box, x0);
         }
 
-        *slWidth = box[axis][axis]/(*nslices);
         invvol   = *nslices/(box[XX][XX]*box[YY][YY]*box[ZZ][ZZ]);
 
+        if (bRelative)
+        {
+            *slWidth = 1.0/(*nslices);
+            boxSz    = 1.0;
+        }
+        else
+        {
+            *slWidth = box[axis][axis]/(*nslices);
+            boxSz    = box[axis][axis];
+        }
+
+        aveBox += box[axis][axis];
+
         for (n = 0; n < nr_grps; n++)
         {
             for (i = 0; i < gnx[n]; i++) /* loop over all atoms in index file */
@@ -236,8 +262,20 @@ void calc_electron_density(const char *fn, atom_id **index, int gnx[],
                     z -= box[axis][axis];
                 }
 
+                if (bRelative)
+                {
+                    z = z/box[axis][axis];
+                }
+
                 /* determine which slice atom is in */
-                slice           = (z / (*slWidth));
+                if (bCenter)
+                {
+                    slice = floor( (z-(boxSz/2.0)) / (*slWidth) ) + *nslices/2;
+                }
+                else
+                {
+                    slice = (z / (*slWidth));
+                }
                 sought.nr_el    = 0;
                 sought.atomname = strdup(*(top->atoms.atomname[index[n][i]]));
 
@@ -275,6 +313,12 @@ void calc_electron_density(const char *fn, atom_id **index, int gnx[],
     fprintf(stderr, "\nRead %d frames from trajectory. Counting electrons\n",
             nr_frames);
 
+    if (bRelative)
+    {
+        aveBox  /= nr_frames;
+        *slWidth = aveBox/(*nslices);
+    }
+
     for (n = 0; n < nr_grps; n++)
     {
         for (i = 0; i < *nslices; i++)
@@ -289,21 +333,22 @@ void calc_electron_density(const char *fn, atom_id **index, int gnx[],
 void calc_density(const char *fn, atom_id **index, int gnx[],
                   double ***slDensity, int *nslices, t_topology *top, int ePBC,
                   int axis, int nr_grps, real *slWidth, gmx_bool bCenter,
-                  const output_env_t oenv)
+                  atom_id *index_center, int ncenter,
+                  gmx_bool bRelative, const output_env_t oenv)
 {
-    rvec        *x0;      /* coordinates without pbc */
-    matrix       box;     /* box (3x3) */
+    rvec        *x0;            /* coordinates without pbc */
+    matrix       box;           /* box (3x3) */
     double       invvol;
-    int          natoms;  /* nr. atoms in trj */
+    int          natoms;        /* nr. atoms in trj */
     t_trxstatus *status;
-    int        **slCount, /* nr. of atoms in one slice for a group */
-                 i, j, n, /* loop indices */
-                 teller    = 0,
+    int        **slCount,       /* nr. of atoms in one slice for a group */
+                 i, j, n,       /* loop indices */
                  ax1       = 0, ax2 = 0,
                  nr_frames = 0, /* number of frames */
                  slice;         /* current slice */
     real         t,
                  z;
+    real         boxSz, aveBox;
     char        *buf;    /* for tmp. keeping atomname */
     gmx_rmpbc_t  gpbc = NULL;
 
@@ -317,6 +362,8 @@ void calc_density(const char *fn, atom_id **index, int gnx[],
         gmx_fatal(FARGS, "Could not read coordinates from statusfile\n");
     }
 
+    aveBox = 0;
+
     if (!*nslices)
     {
         *nslices = (int)(box[axis][axis] * 10); /* default value */
@@ -335,14 +382,28 @@ void calc_density(const char *fn, atom_id **index, int gnx[],
     {
         gmx_rmpbc(gpbc, natoms, box, x0);
 
+        /* Translate atoms so the com of the center-group is in the
+         * box geometrical center.
+         */
         if (bCenter)
         {
-            center_coords(&top->atoms, box, x0, axis);
+            center_coords(&top->atoms, index_center, ncenter, box, x0);
         }
 
-        *slWidth = box[axis][axis]/(*nslices);
         invvol   = *nslices/(box[XX][XX]*box[YY][YY]*box[ZZ][ZZ]);
-        teller++;
+
+        if (bRelative)
+        {
+            *slWidth = 1.0/(*nslices);
+            boxSz    = 1.0;
+        }
+        else
+        {
+            *slWidth = box[axis][axis]/(*nslices);
+            boxSz    = box[axis][axis];
+        }
+
+        aveBox += box[axis][axis];
 
         for (n = 0; n < nr_grps; n++)
         {
@@ -358,8 +419,34 @@ void calc_density(const char *fn, atom_id **index, int gnx[],
                     z -= box[axis][axis];
                 }
 
+                if (bRelative)
+                {
+                    z = z/box[axis][axis];
+                }
+
                 /* determine which slice atom is in */
-                slice                   = (int)(z / (*slWidth));
+                if (bCenter)
+                {
+                    slice = floor( (z-(boxSz/2.0)) / (*slWidth) ) + *nslices/2;
+                }
+                else
+                {
+                    slice = floor(z / (*slWidth));
+                }
+
+                /* Slice should already be 0<=slice<nslices, but we just make
+                 * sure we are not hit by IEEE rounding errors since we do
+                 * math operations after applying PBC above.
+                 */
+                if (slice < 0)
+                {
+                    slice += *nslices;
+                }
+                else if (slice >= *nslices)
+                {
+                    slice -= *nslices;
+                }
+
                 (*slDensity)[n][slice] += top->atoms.atom[index[n][i]].m*invvol;
             }
         }
@@ -378,6 +465,12 @@ void calc_density(const char *fn, atom_id **index, int gnx[],
     fprintf(stderr, "\nRead %d frames from trajectory. Calculating density\n",
             nr_frames);
 
+    if (bRelative)
+    {
+        aveBox  /= nr_frames;
+        *slWidth = aveBox/(*nslices);
+    }
+
     for (n = 0; n < nr_grps; n++)
     {
         for (i = 0; i < *nslices; i++)
@@ -392,12 +485,29 @@ void calc_density(const char *fn, atom_id **index, int gnx[],
 void plot_density(double *slDensity[], const char *afile, int nslices,
                   int nr_grps, char *grpname[], real slWidth,
                   const char **dens_opt,
-                  gmx_bool bSymmetrize, const output_env_t oenv)
+                  gmx_bool bCenter, gmx_bool bRelative, gmx_bool bSymmetrize,
+                  const output_env_t oenv)
 {
     FILE       *den;
+    const char *title  = NULL;
+    const char *xlabel = NULL;
     const char *ylabel = NULL;
     int         slice, n;
     real        ddd;
+    real        axispos;
+
+    title = bSymmetrize ? "Symmetrized partial density" : "Partial density";
+
+    if (bCenter)
+    {
+        xlabel = bRelative ?
+            "Average relative position from center (nm)" :
+            "Relative position from center (nm)";
+    }
+    else
+    {
+        xlabel = bRelative ? "Average coordinate (nm)" : "Coordinate (nm)";
+    }
 
     switch (dens_opt[0][0])
     {
@@ -407,13 +517,22 @@ void plot_density(double *slDensity[], const char *afile, int nslices,
         case 'e': ylabel = "Electron density (e nm\\S-3\\N)"; break;
     }
 
-    den = xvgropen(afile, "Partial densities", "Box (nm)", ylabel, oenv);
+    den = xvgropen(afile,
+                   title, xlabel, ylabel, oenv);
 
     xvgr_legend(den, nr_grps, (const char**)grpname, oenv);
 
     for (slice = 0; (slice < nslices); slice++)
     {
-        fprintf(den, "%12g  ", slice * slWidth);
+        if (bCenter)
+        {
+            axispos = (slice - nslices/2.0 + 0.5) * slWidth;
+        }
+        else
+        {
+            axispos = (slice + 0.5) * slWidth;
+        }
+        fprintf(den, "%12g  ", axispos);
         for (n = 0; (n < nr_grps); n++)
         {
             if (bSymmetrize)
@@ -445,6 +564,22 @@ int gmx_density(int argc, char *argv[])
         "[THISMODULE] computes partial densities across the box, using an index file.[PAR]",
         "For the total density of NPT simulations, use [gmx-energy] instead.",
         "[PAR]",
+
+        "Option [TT]-center[tt] performs the histogram binning relative to the center",
+        "of an arbitrary group, in absolute box coordinates. If you are calculating",
+        "profiles along the Z axis box dimension bZ, output would be from -bZ/2 to",
+        "bZ/2 if you center based on the entire system.",
+        "Note that this behaviour has changed in Gromacs 5.0; earlier versions",
+        "merely performed a static binning in (0,bZ) and shifted the output. Now",
+        "we compute the center for each frame and bin in (-bZ/2,bZ/2).[PAR]",
+
+        "Option [TT]-symm[tt] symmetrizes the output around the center. This will",
+        "automatically turn on [TT]-center[tt] too.",
+
+        "Option [TT]-relative[tt] performs the binning in relative instead of absolute",
+        "box coordinates, and scales the final output with the average box dimension",
+        "along the output axis. This can be used in combination with [TT]-center[tt].[PAR]",
+
         "Densities are in kg/m^3, and number densities or electron densities can also be",
         "calculated. For electron densities, a file describing the number of",
         "electrons for each type of atom should be provided using [TT]-ei[tt].",
@@ -455,7 +590,38 @@ int gmx_density(int argc, char *argv[])
         "The first line contains the number of lines to read from the file.",
         "There should be one line for each unique atom name in your system.",
         "The number of electrons for each atom is modified by its atomic",
-        "partial charge."
+        "partial charge.[PAR]",
+
+        "IMPORTANT CONSIDERATIONS FOR BILAYERS[PAR]",
+        "One of the most common usage scenarios is to calculate the density of various",
+        "groups across a lipid bilayer, typically with the z axis being the normal",
+        "direction. For short simulations, small systems, and fixed box sizes this",
+        "will work fine, but for the more general case lipid bilayers can be complicated.",
+        "The first problem that while both proteins and lipids have low volume",
+        "compressibility, lipids have quite high area compressiblity. This means the",
+        "shape of the box (thickness and area/lipid) will fluctuate substantially even",
+        "for a fully relaxed system. Since Gromacs places the box between the origin",
+        "and positive coordinates, this in turn means that a bilayer centered in the",
+        "box will move a bit up/down due to these fluctuations, and smear out your",
+        "profile. The easiest way to fix this (if you want pressure coupling) is",
+        "to use the [TT]-center[tt] option that calculates the density profile with",
+        "respect to the center of the box. Note that you can still center on the",
+        "bilayer part even if you have a complex non-symmetric system with a bilayer",
+        "and, say, membrane proteins - then our output will simply have more values",
+        "on one side of the (center) origin reference.[PAR]",
+
+        "Even the centered calculation will lead to some smearing out the output",
+        "profiles, as lipids themselves are compressed and expanded. In most cases",
+        "you probably want this (since it corresponds to macroscopic experiments),",
+        "but if you want to look at molecular details you can use the [TT]-relative[tt]",
+        "option to attempt to remove even more of the effects of volume fluctuations.[PAR]",
+
+        "Finally, large bilayers that are not subject to a surface tension will exhibit",
+        "undulatory fluctuations, where there are 'waves' forming in the system.",
+        "This is a fundamental property of the biological system, and if you are",
+        "comparing against experiments you likely want to include the undulation",
+        "smearing effect.",
+        "",
     };
 
     output_env_t       oenv;
@@ -467,6 +633,8 @@ int gmx_density(int argc, char *argv[])
     static int         ngrps       = 1;  /* nr. of groups              */
     static gmx_bool    bSymmetrize = FALSE;
     static gmx_bool    bCenter     = FALSE;
+    static gmx_bool    bRelative   = FALSE;
+
     t_pargs            pa[]        = {
         { "-d", FALSE, etSTR, {&axtitle},
           "Take the normal on the membrane in direction X, Y or Z." },
@@ -476,25 +644,30 @@ int gmx_density(int argc, char *argv[])
           "Density"},
         { "-ng",       FALSE, etINT, {&ngrps},
           "Number of groups of which to compute densities." },
-        { "-symm",    FALSE, etBOOL, {&bSymmetrize},
+        { "-center",   FALSE, etBOOL, {&bCenter},
+          "Perform the binning relative to the center of the (changing) box. Useful for bilayers." },
+        { "-symm",     FALSE, etBOOL, {&bSymmetrize},
           "Symmetrize the density along the axis, with respect to the center. Useful for bilayers." },
-        { "-center",  FALSE, etBOOL, {&bCenter},
-          "Shift the center of mass along the axis to zero. This means if your axis is Z and your box is bX, bY, bZ, the center of mass will be at bX/2, bY/2, 0."}
+        { "-relative", FALSE, etBOOL, {&bRelative},
+          "Use relative coordinates for changing boxes and scale output by average dimensions." }
     };
 
     const char        *bugs[] = {
         "When calculating electron densities, atomnames are used instead of types. This is bad.",
     };
 
-    double           **density;      /* density per slice          */
-    real               slWidth;      /* width of one slice         */
-    char             **grpname;      /* groupnames                 */
-    int                nr_electrons; /* nr. electrons              */
-    int               *ngx;          /* sizes of groups            */
-    t_electron        *el_tab;       /* tabel with nr. of electrons*/
-    t_topology        *top;          /* topology               */
+    double           **density;        /* density per slice          */
+    real               slWidth;        /* width of one slice         */
+    char              *grpname_center; /* centering group name     */
+    char             **grpname;        /* groupnames                 */
+    int                nr_electrons;   /* nr. electrons              */
+    int                ncenter;        /* size of centering group    */
+    int               *ngx;            /* sizes of groups            */
+    t_electron        *el_tab;         /* tabel with nr. of electrons*/
+    t_topology        *top;            /* topology               */
     int                ePBC;
-    atom_id          **index;        /* indices for all groups     */
+    atom_id           *index_center;   /* index for centering group  */
+    atom_id          **index;          /* indices for all groups     */
     int                i;
 
     t_filenm           fnm[] = { /* files for g_density       */
@@ -542,6 +715,22 @@ int gmx_density(int argc, char *argv[])
     snew(index, ngrps);
     snew(ngx, ngrps);
 
+    if (bCenter)
+    {
+        fprintf(stderr,
+                "\nNote: that the center of mass is calculated inside the box without applying\n"
+                "any special periodicity. If necessary, it is your responsibility to first use\n"
+                "trjconv to make sure atoms in this group are placed in the right periodicity.\n\n"
+                "Select the group to center density profiles around:\n");
+        get_index(&top->atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &ncenter,
+                  &index_center, &grpname_center);
+    }
+    else
+    {
+        ncenter = 0;
+    }
+
+    fprintf(stderr, "\nSelect %d group%s to calculate density for:\n", ngrps, (ngrps > 1) ? "s" : "");
     get_index(&top->atoms, ftp2fn_null(efNDX, NFILE, fnm), ngrps, ngx, index, grpname);
 
     if (dens_opt[0][0] == 'e')
@@ -551,17 +740,19 @@ int gmx_density(int argc, char *argv[])
 
         calc_electron_density(ftp2fn(efTRX, NFILE, fnm), index, ngx, &density,
                               &nslices, top, ePBC, axis, ngrps, &slWidth, el_tab,
-                              nr_electrons, bCenter, oenv);
+                              nr_electrons, bCenter, index_center, ncenter,
+                              bRelative, oenv);
     }
     else
     {
         calc_density(ftp2fn(efTRX, NFILE, fnm), index, ngx, &density, &nslices, top,
-                     ePBC, axis, ngrps, &slWidth, bCenter, oenv);
+                     ePBC, axis, ngrps, &slWidth, bCenter, index_center, ncenter,
+                     bRelative, oenv);
     }
 
     plot_density(density, opt2fn("-o", NFILE, fnm),
                  nslices, ngrps, grpname, slWidth, dens_opt,
-                 bSymmetrize, oenv);
+                 bCenter, bRelative, bSymmetrize, oenv);
 
     do_view(oenv, opt2fn("-o", NFILE, fnm), "-nxy");  /* view xvgr file */
     return 0;
index c695cbe1fb9e042ae66852c8f4d04e62cc347602..b40be00dc43ca0e42b5451ab0f3ec42ba06fd07b 100644 (file)
@@ -223,8 +223,11 @@ static void dump_fy(output_env_t oenv, real toler)
     DD = pow(10.0, 0.125);
     fp = xvgropen("fy.xvg", "Fig. 2, Lin2003a", "Delta", "y or fy", oenv);
     xvgr_legend(fp, asize(leg), leg, oenv);
-    fprintf(fp, "@    world 1e-05, 0, 1000, 1\n");
-    fprintf(fp, "@    xaxes scale Logarithmic\n");
+    if (output_env_get_print_xvgr_codes(oenv))
+    {
+        fprintf(fp, "@    world 1e-05, 0, 1000, 1\n");
+        fprintf(fp, "@    xaxes scale Logarithmic\n");
+    }
     for (Delta = 1e-5; (Delta <= 1000); Delta *= DD)
     {
         f = calc_fluidicity(Delta, toler);
index 1c1d18c702266071ad63bb54904eeb84775e9162..7d457f6d2ace1416926a61bbcb66ceecf6e33e3d 100644 (file)
@@ -427,10 +427,8 @@ void visualize_box(FILE *out, int a0, int r0, matrix box, rvec gridsize)
 
         for (i = 0; i < nat; i++)
         {
-            fprintf(out, get_pdbformat(), "ATOM", a0 + i, "C", "BOX", 'K' + i
-                    / NCUCVERT, r0 + i, 10 * vert[i][XX], 10 * vert[i][YY], 10
-                    * vert[i][ZZ]);
-            fprintf(out, "\n");
+            gmx_fprintf_pdb_atomline(out, epdbATOM, a0 + i, "C", ' ', "BOX", 'K' + i / NCUCVERT, r0 + i, ' ',
+                                     10*vert[i][XX], 10*vert[i][YY], 10*vert[i][ZZ], 1.0, 0.0, "");
         }
 
         edge = compact_unitcell_edges();
@@ -454,10 +452,8 @@ void visualize_box(FILE *out, int a0, int r0, matrix box, rvec gridsize)
             {
                 for (x = 0; x <= 1; x++)
                 {
-                    fprintf(out, get_pdbformat(), "ATOM", a0 + i, "C", "BOX", 'K' + i
-                            / 8, r0 + i, x * 10 * box[XX][XX],
-                            y * 10 * box[YY][YY], z * 10 * box[ZZ][ZZ]);
-                    fprintf(out, "\n");
+                    gmx_fprintf_pdb_atomline(out, epdbATOM, a0 + i, "C", ' ', "BOX", 'K' + i/8, r0+i, ' ',
+                                             x * 10 * box[XX][XX], y * 10 * box[YY][YY], z * 10 * box[ZZ][ZZ], 1.0, 0.0, "");
                     i++;
                 }
             }
@@ -1294,7 +1290,6 @@ int gmx_editconf(int argc, char *argv[])
             out = gmx_ffopen(outfile, "w");
             if (bMead)
             {
-                set_pdb_wide_format(TRUE);
                 fprintf(out, "REMARK    "
                         "The B-factors in this file hold atomic radii\n");
                 fprintf(out, "REMARK    "
index 2089b90bb8b4c15d9967304a3910d00680a72441..a9a499aca35684ee3d4eab80c3afb7a4366dbd21 100644 (file)
@@ -513,39 +513,55 @@ int gmx_enemat(int argc, char *argv[])
                        oenv);
         xvgr_legend(out, 0, NULL, oenv);
         j = 0;
-        for (m = 0; (m < egNR+egSP); m++)
+        if (output_env_get_print_xvgr_codes(oenv))
         {
-            if (egrp_use[m])
+            char str1[STRLEN], str2[STRLEN];
+            if (output_env_get_xvg_format(oenv) == exvgXMGR)
             {
-                fprintf(out, "@ legend string %d \"%s\"\n", j++, egrp_nm[m]);
+                sprintf(str1, "@ legend string ");
+                sprintf(str2, " ");
             }
-        }
-        if (bFree)
-        {
-            fprintf(out, "@ legend string %d \"%s\"\n", j++, "Free");
-        }
-        if (bFree)
-        {
-            fprintf(out, "@ legend string %d \"%s\"\n", j++, "Diff");
-        }
-        fprintf(out, "@TYPE xy\n");
-        fprintf(out, "#%3s", "grp");
-        for (m = 0; (m < egNR+egSP); m++)
-        {
-            if (egrp_use[m])
+            else
             {
-                fprintf(out, " %9s", egrp_nm[m]);
+                sprintf(str1, "@ s");
+                sprintf(str2, " legend ");
             }
+
+            for (m = 0; (m < egNR+egSP); m++)
+            {
+                if (egrp_use[m])
+                {
+                    fprintf(out, "%s%d%s \"%s\"\n", str1, j++, str2, egrp_nm[m]);
+                }
+            }
+            if (bFree)
+            {
+                fprintf(out, "%s%d%s \"%s\"\n", str1, j++, str2, "Free");
+            }
+            if (bFree)
+            {
+                fprintf(out, "%s%d%s \"%s\"\n", str1, j++, str2, "Diff");
+            }
+            fprintf(out, "@TYPE xy\n");
+            fprintf(out, "#%3s", "grp");
+
+            for (m = 0; (m < egNR+egSP); m++)
+            {
+                if (egrp_use[m])
+                {
+                    fprintf(out, " %9s", egrp_nm[m]);
+                }
+            }
+            if (bFree)
+            {
+                fprintf(out, " %9s", "Free");
+            }
+            if (bFree)
+            {
+                fprintf(out, " %9s", "Diff");
+            }
+            fprintf(out, "\n");
         }
-        if (bFree)
-        {
-            fprintf(out, " %9s", "Free");
-        }
-        if (bFree)
-        {
-            fprintf(out, " %9s", "Diff");
-        }
-        fprintf(out, "\n");
         for (i = 0; (i < ngroups); i++)
         {
             fprintf(out, "%3.0f", groupnr[i]);
index 4ffec6be5d7f73780a1508b15fdd1e463cc4c3c3..983e96c0358dec56d7155196481cb50906f1844e 100644 (file)
@@ -2254,7 +2254,7 @@ int gmx_energy(int argc, char *argv[])
                 {
                     fort = xvgropen(opt2fn("-ort", NFILE, fnm), "Calculated orientations",
                                     "Time (ps)", "", oenv);
-                    if (bOrinst)
+                    if (bOrinst && output_env_get_print_xvgr_codes(oenv))
                     {
                         fprintf(fort, "%s", orinst_sub);
                     }
@@ -2265,7 +2265,7 @@ int gmx_energy(int argc, char *argv[])
                     fodt = xvgropen(opt2fn("-odt", NFILE, fnm),
                                     "Orientation restraint deviation",
                                     "Time (ps)", "", oenv);
-                    if (bOrinst)
+                    if (bOrinst && output_env_get_print_xvgr_codes(oenv))
                     {
                         fprintf(fodt, "%s", orinst_sub);
                     }
@@ -2731,7 +2731,7 @@ int gmx_energy(int argc, char *argv[])
         out = xvgropen(opt2fn("-ora", NFILE, fnm),
                        "Average calculated orientations",
                        "Restraint label", "", oenv);
-        if (bOrinst)
+        if (bOrinst && output_env_get_print_xvgr_codes(oenv))
         {
             fprintf(out, "%s", orinst_sub);
         }
@@ -2746,7 +2746,7 @@ int gmx_energy(int argc, char *argv[])
         out = xvgropen(opt2fn("-oda", NFILE, fnm),
                        "Average restraint deviation",
                        "Restraint label", "", oenv);
-        if (bOrinst)
+        if (bOrinst && output_env_get_print_xvgr_codes(oenv))
         {
             fprintf(out, "%s", orinst_sub);
         }
@@ -2761,7 +2761,7 @@ int gmx_energy(int argc, char *argv[])
         out = xvgropen(opt2fn("-odr", NFILE, fnm),
                        "RMS orientation restraint deviations",
                        "Restraint label", "", oenv);
-        if (bOrinst)
+        if (bOrinst && output_env_get_print_xvgr_codes(oenv))
         {
             fprintf(out, "%s", orinst_sub);
         }
index 4d2891cc13a7aaebb1ccd8f8b6f332a42955798b..f9980b85ee789c8d49a32ddf5205b5857142030e 100644 (file)
@@ -232,7 +232,7 @@ int gmx_genpr(int argc, char *argv[])
                         hi = d+dd;
                         fprintf(out, "%5d %5d %1d %5d %10d %10g %10g %10g %10g\n",
                                 ind_grp[i]+1, ind_grp[j]+1, 1, k, 1,
-                                lo, hi, hi+1, 1.0);
+                                lo, hi, hi+disre_up2, 1.0);
                     }
                 }
             }
index 46ea9a0a7abe0aed39a2c68c43de3fa41c4e4d76..2918ce8d3afe73ac2f9bf03bdc22ead187210817 100644 (file)
@@ -367,20 +367,22 @@ int gmx_mdmat(int argc, char *argv[])
 
     if (bCalcN)
     {
+        char **legend;
+
+        snew(legend, 5);
+        for (i = 0; i < 5; i++)
+        {
+            snew(legend[i], STRLEN);
+        }
         tot_nmat(nres, natoms, nframes, totnmat, tot_n, mean_n);
         fp = xvgropen(ftp2fn(efXVG, NFILE, fnm),
                       "Increase in number of contacts", "Residue", "Ratio", oenv);
-        fprintf(fp, "@ legend on\n");
-        fprintf(fp, "@ legend box on\n");
-        fprintf(fp, "@ legend loctype view\n");
-        fprintf(fp, "@ legend 0.75, 0.8\n");
-        fprintf(fp, "@ legend string 0 \"Total/mean\"\n");
-        fprintf(fp, "@ legend string 1 \"Total\"\n");
-        fprintf(fp, "@ legend string 2 \"Mean\"\n");
-        fprintf(fp, "@ legend string 3 \"# atoms\"\n");
-        fprintf(fp, "@ legend string 4 \"Mean/# atoms\"\n");
-        fprintf(fp, "#%3s %8s  %3s  %8s  %3s  %8s\n",
-                "res", "ratio", "tot", "mean", "natm", "mean/atm");
+        sprintf(legend[0], "Total/mean");
+        sprintf(legend[1], "Total");
+        sprintf(legend[2], "Mean");
+        sprintf(legend[3], "# atoms");
+        sprintf(legend[4], "Mean/# atoms");
+        xvgr_legend(fp, 5, (const char**)legend, oenv);
         for (i = 0; (i < nres); i++)
         {
             if (mean_n[i] == 0)
index c13e907598c98bf30bd0796a7bf1a2b901ae70fd..6897befaa0437f0852e6772de446896d645f0e96 100644 (file)
 #include "gromacs/fileio/trxio.h"
 #include "gromacs/pbcutil/rmpbc.h"
 #include "gmx_ana.h"
+#include "names.h"
 
 
-static void periodic_dist(matrix box, rvec x[], int n, atom_id index[],
+static void periodic_dist(int ePBC,
+                          matrix box, rvec x[], int n, atom_id index[],
                           real *rmin, real *rmax, int *min_ind)
 {
-#define NSHIFT 26
-    int  sx, sy, sz, i, j, s;
+#define NSHIFT_MAX 26
+    int  nsz, nshift, sx, sy, sz, i, j, s;
     real sqr_box, r2min, r2max, r2;
-    rvec shift[NSHIFT], d0, d;
+    rvec shift[NSHIFT_MAX], d0, d;
 
-    sqr_box = sqr(min(norm(box[XX]), min(norm(box[YY]), norm(box[ZZ]))));
+    sqr_box = min(norm2(box[XX]), norm2(box[YY]));
+    if (ePBC == epbcXYZ)
+    {
+        sqr_box = min(sqr_box, norm2(box[ZZ]));
+        nsz     = 1;
+    }
+    else if (ePBC == epbcXY)
+    {
+        nsz = 0;
+    }
+    else
+    {
+        gmx_fatal(FARGS, "pbc = %s is not supported by g_mindist",
+                  epbc_names[ePBC]);
+        nsz = 0; /* Keep compilers quiet */
+    }
 
-    s = 0;
-    for (sz = -1; sz <= 1; sz++)
+    nshift = 0;
+    for (sz = -nsz; sz <= nsz; sz++)
     {
         for (sy = -1; sy <= 1; sy++)
         {
@@ -79,9 +96,10 @@ static void periodic_dist(matrix box, rvec x[], int n, atom_id index[],
                 {
                     for (i = 0; i < DIM; i++)
                     {
-                        shift[s][i] = sx*box[XX][i]+sy*box[YY][i]+sz*box[ZZ][i];
+                        shift[nshift][i] =
+                            sx*box[XX][i] + sy*box[YY][i] + sz*box[ZZ][i];
                     }
-                    s++;
+                    nshift++;
                 }
             }
         }
@@ -100,7 +118,7 @@ static void periodic_dist(matrix box, rvec x[], int n, atom_id index[],
             {
                 r2max = r2;
             }
-            for (s = 0; s < NSHIFT; s++)
+            for (s = 0; s < nshift; s++)
             {
                 rvec_add(d0, shift[s], d);
                 r2 = norm2(d);
@@ -162,7 +180,7 @@ static void periodic_mindist_plot(const char *trxfn, const char *outfn,
             gmx_rmpbc(gpbc, natoms, box, x);
         }
 
-        periodic_dist(box, x, n, index, &rmin, &rmax, ind_min);
+        periodic_dist(ePBC, box, x, n, index, &rmin, &rmax, ind_min);
         if (rmin < rmint)
         {
             rmint    = rmin;
@@ -172,7 +190,7 @@ static void periodic_mindist_plot(const char *trxfn, const char *outfn,
         }
         if (bSplit && !bFirst && fabs(t/output_env_get_time_factor(oenv)) < 1e-5)
         {
-            fprintf(out, "&\n");
+            fprintf(out, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
         }
         fprintf(out, "\t%g\t%6.3f %6.3f %6.3f %6.3f %6.3f\n",
                 output_env_conv_time(oenv, t), rmin, rmax, norm(box[0]), norm(box[1]), norm(box[2]));
@@ -423,14 +441,14 @@ void dist_plot(const char *fn, const char *afile, const char *dfile,
     {
         if (bSplit && !bFirst && fabs(t/output_env_get_time_factor(oenv)) < 1e-5)
         {
-            fprintf(dist, "&\n");
+            fprintf(dist, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
             if (num)
             {
-                fprintf(num, "&\n");
+                fprintf(num, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
             }
             if (atm)
             {
-                fprintf(atm, "&\n");
+                fprintf(atm, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
             }
         }
         fprintf(dist, "%12e", output_env_conv_time(oenv, t));
index 7d6cacd7aede7f285a943534165f871685af13b9..c00fdca9bd036cb916f05969143032e6270bb2c8 100644 (file)
@@ -493,7 +493,10 @@ int gmx_polystat(int argc, char *argv[])
     /* Handle printing of internal distances. */
     if (outi)
     {
-        fprintf(outi, "@    xaxes scale Logarithmic\n");
+        if (output_env_get_print_xvgr_codes(oenv))
+        {
+            fprintf(outi, "@    xaxes scale Logarithmic\n");
+        }
         ymax = -1;
         ymin = 1e300;
         j    = index[molind[1]-1] - index[molind[0]]; /* Polymer length -1. */
index 8e9a2d46299b51c0cb7271d092e2121fc17422ec..b0ee02ca013400f53eb043bf160b85f59102d8b9 100644 (file)
@@ -53,6 +53,7 @@
 #include "txtdump.h"
 #include "gromacs/fileio/tpxio.h"
 #include "gromacs/fileio/trxio.h"
+#include "gromacs/fileio/xvgr.h"
 #include "gstat.h"
 #include "gmx_ana.h"
 
@@ -104,16 +105,16 @@ int gmx_principal(int argc, char *argv[])
     matrix          axes, box;
     output_env_t    oenv;
     gmx_rmpbc_t     gpbc = NULL;
+    char **         legend;
 
-
-    t_filenm fnm[] = {
+    t_filenm        fnm[] = {
         { efTRX, "-f",   NULL,       ffREAD },
         { efTPS, NULL,   NULL,       ffREAD },
         { efNDX, NULL,   NULL,       ffOPTRD },
-        { efDAT, "-a1",  "paxis1",   ffWRITE },
-        { efDAT, "-a2",  "paxis2",   ffWRITE },
-        { efDAT, "-a3",  "paxis3",   ffWRITE },
-        { efDAT, "-om",  "moi",      ffWRITE }
+        { efXVG, "-a1",  "paxis1",   ffWRITE },
+        { efXVG, "-a2",  "paxis2",   ffWRITE },
+        { efXVG, "-a3",  "paxis3",   ffWRITE },
+        { efXVG, "-om",  "moi",      ffWRITE }
     };
 #define NFILE asize(fnm)
 
@@ -124,10 +125,38 @@ int gmx_principal(int argc, char *argv[])
         return 0;
     }
 
-    axis1 = gmx_ffopen(opt2fn("-a1", NFILE, fnm), "w");
-    axis2 = gmx_ffopen(opt2fn("-a2", NFILE, fnm), "w");
-    axis3 = gmx_ffopen(opt2fn("-a3", NFILE, fnm), "w");
-    fmoi  = gmx_ffopen(opt2fn("-om", NFILE, fnm), "w");
+    snew(legend, DIM);
+    for (i = 0; i < DIM; i++)
+    {
+        snew(legend[i], STRLEN);
+        sprintf(legend[i], "%c component", 'X'+i);
+    }
+
+    axis1 = xvgropen(opt2fn("-a1", NFILE, fnm), "Principal axis 1 (major axis)",
+                     output_env_get_xvgr_tlabel(oenv), "Component (nm)", oenv);
+    xvgr_legend(axis1, DIM, (const char **)legend, oenv);
+
+    axis2 = xvgropen(opt2fn("-a2", NFILE, fnm), "Principal axis 2 (middle axis)",
+                     output_env_get_xvgr_tlabel(oenv), "Component (nm)", oenv);
+    xvgr_legend(axis2, DIM, (const char **)legend, oenv);
+
+    axis3 = xvgropen(opt2fn("-a3", NFILE, fnm), "Principal axis 3 (minor axis)",
+                     output_env_get_xvgr_tlabel(oenv), "Component (nm)", oenv);
+    xvgr_legend(axis3, DIM, (const char **)legend, oenv);
+
+    sprintf(legend[XX], "Axis 1 (major)");
+    sprintf(legend[YY], "Axis 2 (middle)");
+    sprintf(legend[ZZ], "Axis 3 (minor)");
+
+    fmoi  = xvgropen(opt2fn("-om", NFILE, fnm), "Moments of inertia around inertial axes",
+                     output_env_get_xvgr_tlabel(oenv), "I (au nm\\S2\\N)", oenv);
+    xvgr_legend(fmoi, DIM, (const char **)legend, oenv);
+
+    for (i = 0; i < DIM; i++)
+    {
+        sfree(legend[i]);
+    }
+    sfree(legend);
 
     read_tps_conf(ftp2fn(efTPS, NFILE, fnm), title, &top, &ePBC, NULL, NULL, box, TRUE);
 
@@ -152,12 +181,12 @@ int gmx_principal(int argc, char *argv[])
 
     gmx_rmpbc_done(gpbc);
 
-
     close_trj(status);
-    gmx_ffclose(axis1);
-    gmx_ffclose(axis2);
-    gmx_ffclose(axis3);
-    gmx_ffclose(fmoi);
+
+    xvgrclose(axis1);
+    xvgrclose(axis2);
+    xvgrclose(axis3);
+    xvgrclose(fmoi);
 
     return 0;
 }
index ab57c674cc4b4d5b3857057d4b460ebb3e887fcc..888b2523ecdfebd2bb50ecc669208147bd4fe719 100644 (file)
@@ -101,10 +101,12 @@ int gmx_rama(int argc, char *argv[])
     xvgr_line_props(out, 0, elNone, ecFrank, oenv);
     xvgr_view(out, 0.2, 0.2, 0.8, 0.8, oenv);
     xvgr_world(out, -180, -180, 180, 180, oenv);
-    fprintf(out, "@    xaxis  tick on\n@    xaxis  tick major 60\n@    xaxis  tick minor 30\n");
-    fprintf(out, "@    yaxis  tick on\n@    yaxis  tick major 60\n@    yaxis  tick minor 30\n");
-    fprintf(out, "@ s0 symbol 2\n@ s0 symbol size 0.4\n@ s0 symbol fill 1\n");
-
+    if (output_env_get_print_xvgr_codes(oenv))
+    {
+        fprintf(out, "@    xaxis  tick on\n@    xaxis  tick major 60\n@    xaxis  tick minor 30\n");
+        fprintf(out, "@    yaxis  tick on\n@    yaxis  tick major 60\n@    yaxis  tick minor 30\n");
+        fprintf(out, "@ s0 symbol 2\n@ s0 symbol size 0.4\n@ s0 symbol fill 1\n");
+    }
     j = 0;
     do
     {
index 9776ea4af52cba557fd44923083b6bd688add3fb..064eb5b61a0c91337355d070b0eec7acdf237e25 100644 (file)
@@ -324,6 +324,8 @@ int gmx_rms(int argc, char *argv[])
     bPrev = (prev > 0);
     if (bPrev)
     {
+        fprintf(stderr, "WARNING: using option -prev with large trajectories will\n"
+                "         require a lot of memory and could lead to crashes\n");
         prev = abs(prev);
         if (freq != 1)
         {
@@ -1139,7 +1141,7 @@ int gmx_rms(int argc, char *argv[])
         if (bSplit && i > 0 &&
             fabs(time[bPrev ? freq*i : i]/output_env_get_time_factor(oenv)) < 1e-5)
         {
-            fprintf(fp, "&\n");
+            fprintf(fp, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
         }
         fprintf(fp, "%12.7f", time[bPrev ? freq*i : i]);
         for (j = 0; (j < nrms); j++)
@@ -1181,7 +1183,7 @@ int gmx_rms(int argc, char *argv[])
         {
             if (bSplit && i > 0 && fabs(time[i]) < 1e-5)
             {
-                fprintf(fp, "&\n");
+                fprintf(fp, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
             }
             fprintf(fp, "%12.7f", time[i]);
             for (j = 0; (j < nrms); j++)
index 8435a86280b0a5272ed68afc4b92e49c47895d5a..f425ca2c214be2b867ad38c88988bcf251c9706b 100644 (file)
@@ -184,20 +184,23 @@ static void process_tcaf(int nframes, real dt, int nkc, real **tc, rvec *kfac,
                 tcafc[kc][i] /= tcafc[kc][0];
                 fprintf(fp_cub, "%g %g\n", i*dt, tcafc[kc][i]);
             }
-            fprintf(fp_cub, "&\n");
+            fprintf(fp_cub, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
             tcafc[kc][0] = 1.0;
         }
     }
 
     fp_vk = xvgropen(fn_vk, "Fits", "k (nm\\S-1\\N)",
                      "\\8h\\4 (10\\S-3\\N kg m\\S-1\\N s\\S-1\\N)", oenv);
-    fprintf(fp_vk, "@    s0 symbol 2\n");
-    fprintf(fp_vk, "@    s0 symbol color 1\n");
-    fprintf(fp_vk, "@    s0 linestyle 0\n");
-    if (fn_cub)
+    if (output_env_get_print_xvgr_codes(oenv))
     {
-        fprintf(fp_vk, "@    s1 symbol 3\n");
-        fprintf(fp_vk, "@    s1 symbol color 2\n");
+        fprintf(fp_vk, "@    s0 symbol 2\n");
+        fprintf(fp_vk, "@    s0 symbol color 1\n");
+        fprintf(fp_vk, "@    s0 linestyle 0\n");
+        if (fn_cub)
+        {
+            fprintf(fp_vk, "@    s1 symbol 3\n");
+            fprintf(fp_vk, "@    s1 symbol color 2\n");
+        }
     }
     fp = xvgropen(fn_tcf, "TCAF Fits", "Time (ps)", "", oenv);
     for (k = 0; k < nk; k++)
@@ -216,7 +219,7 @@ static void process_tcaf(int nframes, real dt, int nkc, real **tc, rvec *kfac,
         {
             fprintf(fp, "%g %g\n", i*dt, fit_function(effnVAC, fitparms, i*dt));
         }
-        fprintf(fp, "&\n");
+        fprintf(fp, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
     }
     gmx_ffclose(fp);
     do_view(oenv, fn_tcf, "-nxy");
@@ -224,7 +227,7 @@ static void process_tcaf(int nframes, real dt, int nkc, real **tc, rvec *kfac,
     if (fn_cub)
     {
         fprintf(stdout, "Averaged over k-vectors:\n");
-        fprintf(fp_vk, "&\n");
+        fprintf(fp_vk, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
         for (k = 0; k < nkc; k++)
         {
             tcafc[k][0]  = 1.0;
@@ -242,9 +245,9 @@ static void process_tcaf(int nframes, real dt, int nkc, real **tc, rvec *kfac,
             {
                 fprintf(fp_cub, "%g %g\n", i*dt, fit_function(effnVAC, fitparms, i*dt));
             }
-            fprintf(fp_cub, "&\n");
+            fprintf(fp_cub, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
         }
-        fprintf(fp_vk, "&\n");
+        fprintf(fp_vk, "%s\n", output_env_get_print_xvgr_codes(oenv) ? "&" : "");
         gmx_ffclose(fp_cub);
         do_view(oenv, fn_cub, "-nxy");
     }
index b0182605931669faf01b0af86fc533db9c5607d2..91e4fa238803cfc2ac425f572cca5f791d3e27f5 100644 (file)
@@ -904,6 +904,12 @@ int gmx_traj(int argc, char *argv[])
 
     read_first_frame(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &fr, flags);
 
+
+    if ((bOV || bOF) && fn2ftp(ftp2fn(efTRX, NFILE, fnm)) == efXTC)
+    {
+        gmx_fatal(FARGS, "Cannot extract velocities or forces since your input XTC file does not contain them.");
+    }
+
     if (bCV || bCF)
     {
         snew(sumx, fr.natoms);
index 2c52f8e85efcb906681d831f5dd1087bca73d6f6..19f6f8b5300abf893354b11fc1ea8eb4689761d1 100644 (file)
@@ -1250,14 +1250,20 @@ int gmx_trjconv(int argc, char *argv[])
         /* Make atoms struct for output in GRO or PDB files */
         if ((ftp == efGRO) || ((ftp == efG96) && bTPS) || (ftp == efPDB))
         {
-            /* get memory for stuff to go in .pdb file */
-            init_t_atoms(&useatoms, atoms->nr, FALSE);
+            /* get memory for stuff to go in .pdb file, and initialize
+             * the pdbinfo structure part if the input has it.
+             */
+            init_t_atoms(&useatoms, atoms->nr, (atoms->pdbinfo != NULL));
             sfree(useatoms.resinfo);
             useatoms.resinfo = atoms->resinfo;
             for (i = 0; (i < nout); i++)
             {
                 useatoms.atomname[i] = atoms->atomname[index[i]];
                 useatoms.atom[i]     = atoms->atom[index[i]];
+                if (atoms->pdbinfo != NULL)
+                {
+                    useatoms.pdbinfo[i]  = atoms->pdbinfo[index[i]];
+                }
                 useatoms.nres        = max(useatoms.nres, useatoms.atom[i].resind+1);
             }
             useatoms.nr = nout;
index 8d773d91099e59ea2800426d2566e10da651e98c..d58a46bb3b1c78a48f08950558fd43ef774a96de 100644 (file)
@@ -437,7 +437,10 @@ int gmx_vanhove(int argc, char *argv[])
     if (orfile)
     {
         fp = xvgropen(orfile, "Van Hove function", "r (nm)", "G (nm\\S-1\\N)", oenv);
-        fprintf(fp, "@ subtitle \"for particles in group %s\"\n", grpname);
+        if (output_env_get_print_xvgr_codes(oenv))
+        {
+            fprintf(fp, "@ subtitle \"for particles in group %s\"\n", grpname);
+        }
         snew(legend, nr);
         for (fbin = 0; fbin < nr; fbin++)
         {
@@ -462,7 +465,10 @@ int gmx_vanhove(int argc, char *argv[])
     {
         sprintf(buf, "Probability of moving less than %g nm", rint);
         fp = xvgropen(otfile, buf, "t (ps)", "", oenv);
-        fprintf(fp, "@ subtitle \"for particles in group %s\"\n", grpname);
+        if (output_env_get_print_xvgr_codes(oenv))
+        {
+            fprintf(fp, "@ subtitle \"for particles in group %s\"\n", grpname);
+        }
         for (f = 0; f <= ftmax; f++)
         {
             fprintf(fp, "%g %g\n", f*dt, (real)pt[f]/(tcount[f]*isize));
index effa95af84972b002d162ec4153b3f5cfc6d60d9..a817f9c425b4b2fc498253415292e47ac689d9db 100644 (file)
@@ -1718,13 +1718,16 @@ void do_bootstrapping(const char *fnres, const char* fnprof, const char *fnhist,
             bsProfiles_av2[i] += tmp*tmp;
             fprintf(fp, "%e\t%e\n", (i+0.5)*opt->dz+opt->min, tmp);
         }
-        fprintf(fp, "&\n");
+        fprintf(fp, "%s\n", output_env_get_print_xvgr_codes(opt->oenv) ? "&" : "");
     }
     gmx_ffclose(fp);
 
     /* write average and stddev */
     fp = xvgropen(fnres, "Average and stddev from bootstrapping", "z", ylabel, opt->oenv);
-    fprintf(fp, "@TYPE xydy\n");
+    if (output_env_get_print_xvgr_codes(opt->oenv))
+    {
+        fprintf(fp, "@TYPE xydy\n");
+    }
     for (i = 0; i < opt->bins; i++)
     {
         bsProfiles_av [i] /= opt->nBootStrap;
@@ -2685,7 +2688,7 @@ void calcIntegratedAutocorrelationTimes(t_UmbrellaWindow *window, int nwins,
                 {
                     fprintf(fpcorr, "%g  %g\n", k*dt, corr[k]);
                 }
-                fprintf(fpcorr, "&\n");
+                fprintf(fpcorr, "%s\n", output_env_get_print_xvgr_codes(opt->oenv) ? "&" : "");
             }
 
             /* esimate integrated correlation time, fitting is too unstable */
@@ -2713,16 +2716,19 @@ void calcIntegratedAutocorrelationTimes(t_UmbrellaWindow *window, int nwins,
 
     /* plot IACT along reaction coordinate */
     fp = xvgropen(fn, "Integrated autocorrelation times", "z", "IACT [ps]", opt->oenv);
-    fprintf(fp, "@    s0 symbol 1\n@    s0 symbol size 0.5\n@    s0 line linestyle 0\n");
-    fprintf(fp, "#  WIN   tau(gr1)  tau(gr2) ...\n");
-    for (i = 0; i < nwins; i++)
+    if (output_env_get_print_xvgr_codes(opt->oenv))
     {
-        fprintf(fp, "# %3d   ", i);
-        for (ig = 0; ig < window[i].nPull; ig++)
+        fprintf(fp, "@    s0 symbol 1\n@    s0 symbol size 0.5\n@    s0 line linestyle 0\n");
+        fprintf(fp, "#  WIN   tau(gr1)  tau(gr2) ...\n");
+        for (i = 0; i < nwins; i++)
         {
-            fprintf(fp, " %11g", window[i].tau[ig]);
+            fprintf(fp, "# %3d   ", i);
+            for (ig = 0; ig < window[i].nPull; ig++)
+            {
+                fprintf(fp, " %11g", window[i].tau[ig]);
+            }
+            fprintf(fp, "\n");
         }
-        fprintf(fp, "\n");
     }
     for (i = 0; i < nwins; i++)
     {
@@ -2737,8 +2743,12 @@ void calcIntegratedAutocorrelationTimes(t_UmbrellaWindow *window, int nwins,
                opt->sigSmoothIact);
         /* smooth IACT along reaction coordinate and overwrite g=1+2tau */
         smoothIact(window, nwins, opt);
-        fprintf(fp, "&\n@    s1 symbol 1\n@    s1 symbol size 0.5\n@    s1 line linestyle 0\n");
-        fprintf(fp, "@    s1 symbol color 2\n");
+        fprintf(fp, "%s\n", output_env_get_print_xvgr_codes(opt->oenv) ? "&" : "");
+        if (output_env_get_print_xvgr_codes(opt->oenv))
+        {
+            fprintf(fp, "@    s1 symbol 1\n@    s1 symbol size 0.5\n@    s1 line linestyle 0\n");
+            fprintf(fp, "@    s1 symbol color 2\n");
+        }
         for (i = 0; i < nwins; i++)
         {
             for (ig = 0; ig < window[i].nPull; ig++)
index d4834aa3acf0cf1829c56ad7dd0496f38d80488f..ff84e8834172c2e833d2a783cf72d9275f3fbcb7 100644 (file)
@@ -734,7 +734,8 @@ real water_pol(int nbonds,
      * a shell connected to a dummy with spring constant that differ in the
      * three spatial dimensions in the molecular frame.
      */
-    int  i, m, aO, aH1, aH2, aD, aS, type, type0;
+    int  i, m, aO, aH1, aH2, aD, aS, type, type0, ki;
+    ivec dt;
     rvec dOH1, dOH2, dHH, dOD, dDS, nW, kk, dx, kdx, proj;
 #ifdef DEBUG
     rvec df;
@@ -777,11 +778,11 @@ real water_pol(int nbonds,
             aS   = forceatoms[i+5];
 
             /* Compute vectors describing the water frame */
-            rvec_sub(x[aH1], x[aO], dOH1);
-            rvec_sub(x[aH2], x[aO], dOH2);
-            rvec_sub(x[aH2], x[aH1], dHH);
-            rvec_sub(x[aD], x[aO], dOD);
-            rvec_sub(x[aS], x[aD], dDS);
+            pbc_rvec_sub(pbc, x[aH1], x[aO], dOH1);
+            pbc_rvec_sub(pbc, x[aH2], x[aO], dOH2);
+            pbc_rvec_sub(pbc, x[aH2], x[aH1], dHH);
+            pbc_rvec_sub(pbc, x[aD], x[aO], dOD);
+            ki = pbc_rvec_sub(pbc, x[aS], x[aD], dDS);
             cprod(dOH1, dOH2, nW);
 
             /* Compute inverse length of normal vector
@@ -836,6 +837,13 @@ real water_pol(int nbonds,
             kdx[YY] = kk[YY]*dx[YY];
             kdx[ZZ] = kk[ZZ]*dx[ZZ];
             vtot   += iprod(dx, kdx);
+
+            if (g)
+            {
+                ivec_sub(SHIFT_IVEC(g, aS), SHIFT_IVEC(g, aD), dt);
+                ki = IVEC2IS(dt);
+            }
+
             for (m = 0; (m < DIM); m++)
             {
                 /* This is a tensor operation but written out for speed */
@@ -846,8 +854,10 @@ real water_pol(int nbonds,
 #ifdef DEBUG
                 df[m] = fij;
 #endif
-                f[aS][m] += fij;
-                f[aD][m] -= fij;
+                f[aS][m]           += fij;
+                f[aD][m]           -= fij;
+                fshift[ki][m]      += fij;
+                fshift[CENTRAL][m] -= fij;
             }
 #ifdef DEBUG
             if (debug)
@@ -2423,7 +2433,7 @@ real posres(int nbonds,
             vtot       += 0.5*kk*dx[m]*dx[m];
             *dvdlambda +=
                 0.5*(pr->posres.fcB[m] - pr->posres.fcA[m])*dx[m]*dx[m]
-                -fm*dpdl[m];
+                fm*dpdl[m];
 
             /* Here we correct for the pbc_dx which included rdist */
             if (bForceValid)
index 5cb9a23cdc827fc8abe7417e04b0969fb62f47ce..05edae309621284e92bdac2e981c4e7284c056b0 100644 (file)
@@ -1780,11 +1780,26 @@ static void check_match(FILE *fplog,
                         ivec dd_nc, ivec dd_nc_f)
 {
     int      npp;
-    gmx_bool mm;
-
-    mm = FALSE;
+    gmx_bool mm                 = FALSE;
+    gmx_bool patchlevel_differs = FALSE;
+    gmx_bool version_differs    = FALSE;
 
     check_string(fplog, "Version", gmx_version(), version, &mm);
+    patchlevel_differs = mm;
+
+    if (patchlevel_differs)
+    {
+        /* Gromacs should be able to continue from checkpoints between
+         * different patch level versions, but we do not guarantee
+         * compatibility between different major/minor versions - check this.
+         */
+        int   gmx_major, gmx_minor;
+        int   cpt_major, cpt_minor;
+        sscanf(gmx_version(), "VERSION %5d.%5d", &gmx_major, &gmx_minor);
+        sscanf(version, "VERSION %5d.%5d", &cpt_major, &cpt_minor);
+        version_differs = (gmx_major != cpt_major || gmx_minor != cpt_minor);
+    }
+
     check_string(fplog, "Build time", BUILD_TIME, btime, &mm);
     check_string(fplog, "Build user", BUILD_USER, buser, &mm);
     check_string(fplog, "Build host", BUILD_HOST, bhost, &mm);
@@ -1811,16 +1826,39 @@ static void check_match(FILE *fplog,
 
     if (mm)
     {
-        fprintf(stderr,
-                "Gromacs binary or parallel settings not identical to previous run.\n"
-                "Continuation is exact, but is not guaranteed to be binary identical%s.\n\n",
-                fplog ? ",\n see the log file for details" : "");
+        const char msg_version_difference[] =
+            "The current Gromacs major & minor version are not identical to those that\n"
+            "generated the checkpoint file. In principle Gromacs does not support\n"
+            "continuation from checkpoints between different versions, so we advise\n"
+            "against this. If you still want to try your luck we recommend that you use\n"
+            "the -noappend flag to keep your output files from the two versions separate.\n"
+            "This might also work around errors where the output fields in the energy\n"
+            "file have changed between the different major & minor versions.\n";
 
-        if (fplog)
+        const char msg_mismatch_notice[] =
+            "Gromacs patchlevel, binary or parallel settings differ from previous run.\n"
+            "Continuation is exact, but not guaranteed to be binary identical.\n";
+
+        const char msg_logdetails[] =
+            "See the log file for details.\n";
+
+        if (version_differs)
         {
-            fprintf(fplog,
-                    "Gromacs binary or parallel settings not identical to previous run.\n"
-                    "Continuation is exact, but is not guaranteed to be binary identical.\n\n");
+            fprintf(stderr, "%s%s\n", msg_version_difference, fplog ? msg_logdetails : "");
+
+            if (fplog)
+            {
+                fprintf(fplog, "%s\n", msg_version_difference);
+            }
+        }
+        else
+        {
+            /* Major & minor versions match at least, but something is different. */
+            fprintf(stderr, "%s%s\n", msg_mismatch_notice, fplog ? msg_logdetails : "");
+            if (fplog)
+            {
+                fprintf(fplog, "%s\n", msg_mismatch_notice);
+            }
         }
     }
 }
@@ -2579,7 +2617,7 @@ gmx_bool read_checkpoint_simulation_part(const char *filename, int *simulation_p
                     }
                     fprintf(stderr, "\n");
 
-                    gmx_fatal(FARGS, "File appending requested, but only %d of the %d output files are present", nexist, nfiles);
+                    gmx_fatal(FARGS, "File appending requested, but %d of the %d output files are not present or are named differently", nfiles-nexist, nfiles);
                 }
             }
 
index 5414c668c6936a22a2238e2a079fba88c91e34ae..bba7805fb74a88edb74174ec5c280092130a7797 100644 (file)
@@ -74,7 +74,7 @@ gmx_nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
     real          Vvdw6, Vvdw12, vvtot;
     real          ix, iy, iz, fix, fiy, fiz;
     real          dx, dy, dz, rsq, rinv;
-    real          c6[NSTATES], c12[NSTATES], c6grid[NSTATES];
+    real          c6[NSTATES], c12[NSTATES], c6grid;
     real          LFC[NSTATES], LFV[NSTATES], DLF[NSTATES];
     double        dvdl_coul, dvdl_vdw;
     real          lfac_coul[NSTATES], dlfac_coul[NSTATES], lfac_vdw[NSTATES], dlfac_vdw[NSTATES];
@@ -111,16 +111,27 @@ gmx_nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
     real *        Vv;
     real *        Vc;
     gmx_bool      bDoForces, bDoShiftForces, bDoPotential;
-    real          rcoulomb, sh_ewald;
-    real          rvdw, sh_invrc6;
-    gmx_bool      bExactElecCutoff, bExactVdwCutoff, bExactCutoffAll, bEwald;
+    real          rcoulomb, rvdw, sh_invrc6;
+    gmx_bool      bExactElecCutoff, bExactVdwCutoff, bExactCutoffAll;
+    gmx_bool      bEwald, bEwaldLJ;
     real          rcutoff_max2;
-    real          rcutoff, rcutoff2, rswitch, d, d2, swV3, swV4, swV5, swF2, swF3, swF4, sw, dsw, rinvcorr;
-    const real *  tab_ewald_F;
-    const real *  tab_ewald_V;
     const real *  tab_ewald_F_lj;
     const real *  tab_ewald_V_lj;
-    real          tab_ewald_scale, tab_ewald_halfsp;
+    real          d, d2, sw, dsw, rinvcorr;
+    real          elec_swV3, elec_swV4, elec_swV5, elec_swF2, elec_swF3, elec_swF4;
+    real          vdw_swV3, vdw_swV4, vdw_swV5, vdw_swF2, vdw_swF3, vdw_swF4;
+    gmx_bool      bConvertEwaldToCoulomb, bConvertLJEwaldToLJ6;
+    gmx_bool      bComputeVdwInteraction, bComputeElecInteraction;
+    const real *  ewtab;
+    int           ewitab;
+    real          ewrt, eweps, ewtabscale, ewtabhalfspace, sh_ewald;
+
+    sh_ewald            = fr->ic->sh_ewald;
+    ewtab               = fr->ic->tabq_coul_FDV0;
+    ewtabscale          = fr->ic->tabq_scale;
+    ewtabhalfspace      = 0.5/ewtabscale;
+    tab_ewald_F_lj      = fr->ic->tabq_vdw_F;
+    tab_ewald_V_lj      = fr->ic->tabq_vdw_V;
 
     x                   = xx[0];
     f                   = ff[0];
@@ -164,41 +175,39 @@ gmx_nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
     bDoPotential        = kernel_data->flags & GMX_NONBONDED_DO_POTENTIAL;
 
     rcoulomb            = fr->rcoulomb;
-    sh_ewald            = fr->ic->sh_ewald;
     rvdw                = fr->rvdw;
     sh_invrc6           = fr->ic->sh_invrc6;
 
-    /* Ewald (PME) reciprocal force and energy quadratic spline tables */
-    tab_ewald_F         = fr->ic->tabq_coul_F;
-    tab_ewald_V         = fr->ic->tabq_coul_V;
-    tab_ewald_scale     = fr->ic->tabq_scale;
-    tab_ewald_F_lj      = fr->ic->tabq_vdw_F;
-    tab_ewald_V_lj      = fr->ic->tabq_vdw_V;
-    tab_ewald_halfsp    = 0.5/tab_ewald_scale;
+    if (fr->coulomb_modifier == eintmodPOTSWITCH)
+    {
+        d               = fr->rcoulomb-fr->rcoulomb_switch;
+        elec_swV3       = -10.0/(d*d*d);
+        elec_swV4       =  15.0/(d*d*d*d);
+        elec_swV5       =  -6.0/(d*d*d*d*d);
+        elec_swF2       = -30.0/(d*d*d);
+        elec_swF3       =  60.0/(d*d*d*d);
+        elec_swF4       = -30.0/(d*d*d*d*d);
+    }
+    else
+    {
+        /* Avoid warnings from stupid compilers (looking at you, Clang!) */
+        elec_swV3 = elec_swV4 = elec_swV5 = elec_swF2 = elec_swF3 = elec_swF4 = 0.0;
+    }
 
-    if (fr->coulomb_modifier == eintmodPOTSWITCH || fr->vdw_modifier == eintmodPOTSWITCH)
+    if (fr->vdw_modifier == eintmodPOTSWITCH)
     {
-        rcutoff         = (fr->coulomb_modifier == eintmodPOTSWITCH) ? fr->rcoulomb : fr->rvdw;
-        rcutoff2        = rcutoff*rcutoff;
-        rswitch         = (fr->coulomb_modifier == eintmodPOTSWITCH) ? fr->rcoulomb_switch : fr->rvdw_switch;
-        d               = rcutoff-rswitch;
-        swV3            = -10.0/(d*d*d);
-        swV4            =  15.0/(d*d*d*d);
-        swV5            =  -6.0/(d*d*d*d*d);
-        swF2            = -30.0/(d*d*d);
-        swF3            =  60.0/(d*d*d*d);
-        swF4            = -30.0/(d*d*d*d*d);
+        d               = fr->rvdw-fr->rvdw_switch;
+        vdw_swV3        = -10.0/(d*d*d);
+        vdw_swV4        =  15.0/(d*d*d*d);
+        vdw_swV5        =  -6.0/(d*d*d*d*d);
+        vdw_swF2        = -30.0/(d*d*d);
+        vdw_swF3        =  60.0/(d*d*d*d);
+        vdw_swF4        = -30.0/(d*d*d*d*d);
     }
     else
     {
-        /* Stupid compilers dont realize these variables will not be used */
-        rswitch         = 0.0;
-        swV3            = 0.0;
-        swV4            = 0.0;
-        swV5            = 0.0;
-        swF2            = 0.0;
-        swF3            = 0.0;
-        swF4            = 0.0;
+        /* Avoid warnings from stupid compilers (looking at you, Clang!) */
+        vdw_swV3 = vdw_swV4 = vdw_swV5 = vdw_swF2 = vdw_swF3 = vdw_swF4 = 0.0;
     }
 
     if (fr->cutoff_scheme == ecutsVERLET)
@@ -242,6 +251,26 @@ gmx_nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
     rcutoff_max2    = rcutoff_max2*rcutoff_max2;
 
     bEwald          = (icoul == GMX_NBKERNEL_ELEC_EWALD);
+    bEwaldLJ        = (ivdw == GMX_NBKERNEL_VDW_LJEWALD);
+
+    /* For Ewald/PME interactions we cannot easily apply the soft-core component to
+     * reciprocal space. When we use vanilla (not switch/shift) Ewald interactions, we
+     * can apply the small trick of subtracting the _reciprocal_ space contribution
+     * in this kernel, and instead apply the free energy interaction to the 1/r
+     * (standard coulomb) interaction.
+     *
+     * However, we cannot use this approach for switch-modified since we would then
+     * effectively end up evaluating a significantly different interaction here compared to the
+     * normal (non-free-energy) kernels, either by applying a cutoff at a different
+     * position than what the user requested, or by switching different
+     * things (1/r rather than short-range Ewald). For these settings, we just
+     * use the traditional short-range Ewald interaction in that case.
+     */
+    bConvertEwaldToCoulomb = (bEwald && (fr->coulomb_modifier != eintmodPOTSWITCH));
+    /* For now the below will always be true (since LJ-PME only works with Shift in Gromacs-5.0),
+     * but writing it this way means we stay in sync with coulomb, and it avoids future bugs.
+     */
+    bConvertLJEwaldToLJ6   = (bEwaldLJ && (fr->vdw_modifier   != eintmodPOTSWITCH));
 
     /* fix compiler warnings */
     nj1   = 0;
@@ -376,12 +405,6 @@ gmx_nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
             tj[STATE_A]      = ntiA+2*typeA[jnr];
             tj[STATE_B]      = ntiB+2*typeB[jnr];
 
-            if (ivdw == GMX_NBKERNEL_VDW_LJEWALD)
-            {
-                c6grid[STATE_A] = nbfp_grid[tj[STATE_A]];
-                c6grid[STATE_B] = nbfp_grid[tj[STATE_B]];
-            }
-
             if (nlist->excl_fep == NULL || nlist->excl_fep[k])
             {
                 c6[STATE_A]      = nbfp[tj[STATE_A]];
@@ -473,14 +496,15 @@ gmx_nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
                             n1V        = tab_elemsize*n0;
                         }
 
-                        /* With Ewald and soft-core we should put the cut-off on r,
-                         * not on the soft-cored rC, as the real-space and
-                         * reciprocal space contributions should (almost) cancel.
+                        /* Only process the coulomb interactions if we have charges,
+                         * and if we either include all entries in the list (no cutoff
+                         * used in the kernel), or if we are within the cutoff.
                          */
-                        if (qq[i] != 0 &&
-                            !(bExactElecCutoff &&
-                              ((!bEwald && rC >= rcoulomb) ||
-                               (bEwald && r >= rcoulomb))))
+                        bComputeElecInteraction = !bExactElecCutoff ||
+                            ( bConvertEwaldToCoulomb && r < rcoulomb) ||
+                            (!bConvertEwaldToCoulomb && rC < rcoulomb);
+
+                        if ( (qq[i] != 0) && bComputeElecInteraction)
                         {
                             switch (icoul)
                             {
@@ -488,12 +512,10 @@ gmx_nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
                                     /* simple cutoff */
                                     Vcoul[i]   = qq[i]*rinvC;
                                     FscalC[i]  = Vcoul[i];
-                                    break;
-
-                                case GMX_NBKERNEL_ELEC_EWALD:
-                                    /* Ewald FEP is done only on the 1/r part */
-                                    Vcoul[i]   = qq[i]*(rinvC - sh_ewald);
-                                    FscalC[i]  = Vcoul[i];
+                                    /* The shift for the Coulomb potential is stored in
+                                     * the RF parameter c_rf, which is 0 without shift
+                                     */
+                                    Vcoul[i]  -= qq[i]*fr->ic->c_rf;
                                     break;
 
                                 case GMX_NBKERNEL_ELEC_REACTIONFIELD:
@@ -520,6 +542,26 @@ gmx_nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
                                     gmx_fatal(FARGS, "Free energy and GB not implemented.\n");
                                     break;
 
+                                case GMX_NBKERNEL_ELEC_EWALD:
+                                    if (bConvertEwaldToCoulomb)
+                                    {
+                                        /* Ewald FEP is done only on the 1/r part */
+                                        Vcoul[i]   = qq[i]*(rinvC-sh_ewald);
+                                        FscalC[i]  = qq[i]*rinvC;
+                                    }
+                                    else
+                                    {
+                                        ewrt      = rC*ewtabscale;
+                                        ewitab    = (int) ewrt;
+                                        eweps     = ewrt-ewitab;
+                                        ewitab    = 4*ewitab;
+                                        FscalC[i] = ewtab[ewitab]+eweps*ewtab[ewitab+1];
+                                        rinvcorr  = rinvC-sh_ewald;
+                                        Vcoul[i]  = qq[i]*(rinvcorr-(ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+FscalC[i])));
+                                        FscalC[i] = qq[i]*(rinvC-rC*FscalC[i]);
+                                    }
+                                    break;
+
                                 case GMX_NBKERNEL_ELEC_NONE:
                                     FscalC[i]  = 0.0;
                                     Vcoul[i]   = 0.0;
@@ -532,21 +574,29 @@ gmx_nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
 
                             if (fr->coulomb_modifier == eintmodPOTSWITCH)
                             {
-                                d                = rC-rswitch;
+                                d                = rC-fr->rcoulomb_switch;
                                 d                = (d > 0.0) ? d : 0.0;
                                 d2               = d*d;
-                                sw               = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
-                                dsw              = d2*(swF2+d*(swF3+d*swF4));
+                                sw               = 1.0+d2*d*(elec_swV3+d*(elec_swV4+d*elec_swV5));
+                                dsw              = d2*(elec_swF2+d*(elec_swF3+d*elec_swF4));
+
+                                FscalC[i]        = FscalC[i]*sw - rC*Vcoul[i]*dsw;
+                                Vcoul[i]        *= sw;
 
-                                Vcoul[i]  *= sw;
-                                FscalC[i]  = FscalC[i]*sw + Vcoul[i]*dsw;
+                                FscalC[i]        = (rC < rcoulomb) ? FscalC[i] : 0.0;
+                                Vcoul[i]         = (rC < rcoulomb) ? Vcoul[i] : 0.0;
                             }
                         }
 
-                        if ((c6[i] != 0 || c12[i] != 0) &&
-                            !(bExactVdwCutoff &&
-                              ((ivdw != GMX_NBKERNEL_VDW_LJEWALD && rV >= rvdw) ||
-                               (ivdw == GMX_NBKERNEL_VDW_LJEWALD && r >= rvdw))))
+                        /* Only process the VDW interactions if we have
+                         * some non-zero parameters, and if we either
+                         * include all entries in the list (no cutoff used
+                         * in the kernel), or if we are within the cutoff.
+                         */
+                        bComputeVdwInteraction = !bExactVdwCutoff ||
+                            ( bConvertLJEwaldToLJ6 && r < rvdw) ||
+                            (!bConvertLJEwaldToLJ6 && rV < rvdw);
+                        if ((c6[i] != 0 || c12[i] != 0) && bComputeVdwInteraction)
                         {
                             switch (ivdw)
                             {
@@ -617,14 +667,14 @@ gmx_nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
 
                             if (fr->vdw_modifier == eintmodPOTSWITCH)
                             {
-                                d          = rV-rswitch;
-                                d          = (d > 0.0) ? d : 0.0;
-                                d2         = d*d;
-                                sw         = 1.0+d2*d*(swV3+d*(swV4+d*swV5));
-                                dsw        = d2*(swF2+d*(swF3+d*swF4));
+                                d                = rV-fr->rvdw_switch;
+                                d                = (d > 0.0) ? d : 0.0;
+                                d2               = d*d;
+                                sw               = 1.0+d2*d*(vdw_swV3+d*(vdw_swV4+d*vdw_swV5));
+                                dsw              = d2*(vdw_swF2+d*(vdw_swF3+d*vdw_swF4));
 
-                                Vvdw[i]   *= sw;
-                                FscalV[i]  = FscalV[i]*sw + Vvdw[i]*dsw;
+                                FscalV[i]        = FscalV[i]*sw - rV*Vvdw[i]*dsw;
+                                Vvdw[i]         *= sw;
 
                                 FscalV[i]  = (rV < rvdw) ? FscalV[i] : 0.0;
                                 Vvdw[i]    = (rV < rvdw) ? Vvdw[i] : 0.0;
@@ -677,54 +727,80 @@ gmx_nb_free_energy_kernel(const t_nblist * gmx_restrict    nlist,
                 }
             }
 
-            if (icoul == GMX_NBKERNEL_ELEC_EWALD &&
-                !(bExactElecCutoff && r >= rcoulomb))
+            if (bConvertEwaldToCoulomb && ( !bExactElecCutoff || r < rcoulomb ) )
             {
-                /* Because we compute the soft-core normally,
-                 * we have to remove the Ewald short range portion.
-                 * Done outside of the states loop because this part
-                 * doesn't depend on the scaled R.
+                /* See comment in the preamble. When using Ewald interactions
+                 * (unless we use a switch modifier) we subtract the reciprocal-space
+                 * Ewald component here which made it possible to apply the free
+                 * energy interaction to 1/r (vanilla coulomb short-range part)
+                 * above. This gets us closer to the ideal case of applying
+                 * the softcore to the entire electrostatic interaction,
+                 * including the reciprocal-space component.
                  */
-                real rs, frac, f_lr;
-                int  ri;
+                real v_lr, f_lr;
 
-                rs     = rsq*rinv*tab_ewald_scale;
-                ri     = (int)rs;
-                frac   = rs - ri;
-                f_lr   = (1 - frac)*tab_ewald_F[ri] + frac*tab_ewald_F[ri+1];
-                FF     = f_lr*rinv;
-                VV     = tab_ewald_V[ri] - tab_ewald_halfsp*frac*(tab_ewald_F[ri] + f_lr);
+                ewrt      = r*ewtabscale;
+                ewitab    = (int) ewrt;
+                eweps     = ewrt-ewitab;
+                ewitab    = 4*ewitab;
+                f_lr      = ewtab[ewitab]+eweps*ewtab[ewitab+1];
+                v_lr      = (ewtab[ewitab+2]-ewtabhalfspace*eweps*(ewtab[ewitab]+f_lr));
+                f_lr     *= rinv;
 
                 if (ii == jnr)
                 {
-                    VV   *= 0.5;
+                    /* If we get here, the i particle (ii) has itself (jnr)
+                     * in its neighborlist. This can only happen with the Verlet
+                     * scheme, and corresponds to a self-interaction that will
+                     * occur twice. Scale it down by 50% to only include it once.
+                     */
+                    v_lr *= 0.5;
                 }
 
                 for (i = 0; i < NSTATES; i++)
                 {
-                    vctot      -= LFC[i]*qq[i]*VV;
-                    Fscal      -= LFC[i]*qq[i]*FF;
-                    dvdl_coul  -= (DLF[i]*qq[i])*VV;
+                    vctot      -= LFC[i]*qq[i]*v_lr;
+                    Fscal      -= LFC[i]*qq[i]*f_lr;
+                    dvdl_coul  -= (DLF[i]*qq[i])*v_lr;
                 }
             }
 
-            if (ivdw == GMX_NBKERNEL_VDW_LJEWALD &&
-                !(bExactVdwCutoff && r >= rvdw))
+            if (bConvertLJEwaldToLJ6 && (!bExactVdwCutoff || r < rvdw))
             {
+                /* See comment in the preamble. When using LJ-Ewald interactions
+                 * (unless we use a switch modifier) we subtract the reciprocal-space
+                 * Ewald component here which made it possible to apply the free
+                 * energy interaction to r^-6 (vanilla LJ6 short-range part)
+                 * above. This gets us closer to the ideal case of applying
+                 * the softcore to the entire VdW interaction,
+                 * including the reciprocal-space component.
+                 */
                 real rs, frac, f_lr;
                 int  ri;
 
-                rs     = rsq*rinv*tab_ewald_scale;
+                rs     = rsq*rinv*ewtabscale;
                 ri     = (int)rs;
                 frac   = rs - ri;
                 f_lr   = (1 - frac)*tab_ewald_F_lj[ri] + frac*tab_ewald_F_lj[ri+1];
                 FF     = f_lr*rinv;
-                VV     = tab_ewald_V_lj[ri] - tab_ewald_halfsp*frac*(tab_ewald_F_lj[ri] + f_lr);
+                VV     = tab_ewald_V_lj[ri] - ewtabhalfspace*frac*(tab_ewald_F_lj[ri] + f_lr);
+
+                if (ii == jnr)
+                {
+                    /* If we get here, the i particle (ii) has itself (jnr)
+                     * in its neighborlist. This can only happen with the Verlet
+                     * scheme, and corresponds to a self-interaction that will
+                     * occur twice. Scale it down by 50% to only include it once.
+                     */
+                    VV *= 0.5;
+                }
+
                 for (i = 0; i < NSTATES; i++)
                 {
-                    vvtot      += LFV[i]*c6grid[i]*VV*(1.0/6.0);
-                    Fscal      += LFV[i]*c6grid[i]*FF*(1.0/6.0);
-                    dvdl_vdw   += (DLF[i]*c6grid[i])*VV*(1.0/6.0);
+                    c6grid      = nbfp_grid[tj[i]];
+                    vvtot      += LFV[i]*c6grid*VV*(1.0/6.0);
+                    Fscal      += LFV[i]*c6grid*FF*(1.0/6.0);
+                    dvdl_vdw   += (DLF[i]*c6grid)*VV*(1.0/6.0);
                 }
 
             }
index 8ea9d42ffc28823ad189858ec08ddade60996c5c..951b8d4b610925648544dbda10c3352760f8e5a6 100644 (file)
@@ -418,7 +418,7 @@ gmx_nb_generic_kernel(t_nblist *                nlist,
                         fvdw             = (vvdw_rep - vvdw_disp - c6grid*(1.0/6.0)*exponent*ewclj6)*rinvsq;
                         if (fr->vdw_modifier == eintmodPOTSHIFT)
                         {
-                            vvdw             = (vvdw_rep + c12*sh_repulsion)/12.0 - (vvdw_disp + c6*sh_dispersion + c6grid*sh_lj_ewald)/6.0;
+                            vvdw             = (vvdw_rep + c12*sh_repulsion)/12.0 - (vvdw_disp + c6*sh_dispersion - c6grid*sh_lj_ewald)/6.0;
                         }
                         else
                         {
index eefd0e992a60fd1cabeab2d28f42cc0fc620bbd2..40244b7be6cc74673687dac51aedda3885cf7490 100644 (file)
@@ -165,7 +165,7 @@ gmx_nonbonded_setup(t_forcerec *   fr,
 
 
 void
-gmx_nonbonded_set_kernel_pointers(FILE *log, t_nblist *nl)
+gmx_nonbonded_set_kernel_pointers(FILE *log, t_nblist *nl, gmx_bool bElecAndVdwSwitchDiffers)
 {
     const char *     elec;
     const char *     elec_mod;
@@ -286,9 +286,28 @@ gmx_nonbonded_set_kernel_pointers(FILE *log, t_nblist *nl)
             }
         }
 
-        /* Give up. If this was a water kernel, leave the pointer as NULL, which
-         * will disable water optimization in NS. If it is a particle kernel, set
-         * the pointer to the generic NB kernel.
+        /* For now, the accelerated kernels cannot handle the combination of switch functions for both
+         * electrostatics and VdW that use different switch radius or switch cutoff distances
+         * (both of them enter in the switch function calculation). This would require
+         * us to evaluate two completely separate switch functions for every interaction.
+         * Instead, we disable such kernels by setting the pointer to NULL.
+         * This will cause the generic kernel (which can handle it) to be called instead.
+         *
+         * Note that we typically already enable tabulated coulomb interactions for this case,
+         * so this is mostly a safe-guard to make sure we call the generic kernel if the
+         * tables are disabled.
+         */
+        if ((nl->ielec != GMX_NBKERNEL_ELEC_NONE) && (nl->ielecmod == eintmodPOTSWITCH) &&
+            (nl->ivdw  != GMX_NBKERNEL_VDW_NONE)  && (nl->ivdwmod  == eintmodPOTSWITCH) &&
+            bElecAndVdwSwitchDiffers)
+        {
+            nl->kernelptr_vf = NULL;
+            nl->kernelptr_f  = NULL;
+        }
+
+        /* Give up, pick a generic one instead.
+         * We only do this for particle-particle kernels; by leaving the water-optimized kernel
+         * pointers to NULL, the water optimization will automatically be disabled for this interaction.
          */
         if (nl->kernelptr_vf == NULL && !gmx_strcasecmp_min(geom, "Particle-Particle"))
         {
@@ -300,13 +319,11 @@ gmx_nonbonded_set_kernel_pointers(FILE *log, t_nblist *nl)
                 fprintf(debug,
                         "WARNING - Slow generic NB kernel used for neighborlist with\n"
                         "    Elec: '%s', Modifier: '%s'\n"
-                        "    Vdw:  '%s', Modifier: '%s'\n"
-                        "    Geom: '%s', Other: '%s'\n\n",
-                        elec, elec_mod, vdw, vdw_mod, geom, other);
+                        "    Vdw:  '%s', Modifier: '%s'\n",
+                        elec, elec_mod, vdw, vdw_mod);
             }
         }
     }
-
     return;
 }
 
@@ -419,6 +436,10 @@ void do_nonbonded(t_forcerec *fr,
                     {
                         (*kernelptr)(&(nlist[i]), x, f, fr, mdatoms, &kernel_data, nrnb);
                     }
+                    else
+                    {
+                        gmx_fatal(FARGS, "Non-empty neighborlist does not have any kernel pointer assigned.");
+                    }
                 }
             }
         }
index 2d45b2754606959545ffbbba894d764ad4c81383..efb5cf0d9677657c8df800fbdb31a7483cecec6b 100644 (file)
@@ -450,11 +450,11 @@ void pr_qm_opts(FILE *fp, int indent, const char *title, t_grpopts *opts)
         pr_ivec(fp, indent, "QMbasis", opts->QMbasis, opts->ngQM, FALSE);
         pr_ivec(fp, indent, "QMcharge", opts->QMcharge, opts->ngQM, FALSE);
         pr_ivec(fp, indent, "QMmult", opts->QMmult, opts->ngQM, FALSE);
-        pr_bvec(fp, indent, "bSH", opts->bSH, opts->ngQM, FALSE);
+        pr_bvec(fp, indent, "SH", opts->bSH, opts->ngQM, FALSE);
         pr_ivec(fp, indent, "CASorbitals", opts->CASorbitals, opts->ngQM, FALSE);
         pr_ivec(fp, indent, "CASelectrons", opts->CASelectrons, opts->ngQM, FALSE);
         pr_rvec(fp, indent, "SAon", opts->SAon, opts->ngQM, FALSE);
-        pr_rvec(fp, indent, "SAon", opts->SAon, opts->ngQM, FALSE);
+        pr_rvec(fp, indent, "SAoff", opts->SAoff, opts->ngQM, FALSE);
         pr_ivec(fp, indent, "SAsteps", opts->SAsteps, opts->ngQM, FALSE);
         pr_bvec(fp, indent, "bOPT", opts->bOPT, opts->ngQM, FALSE);
         pr_bvec(fp, indent, "bTS", opts->bTS, opts->ngQM, FALSE);
@@ -496,14 +496,14 @@ static void pr_grp_opts(FILE *out, int indent, const char *title, t_grpopts *opt
     fprintf(out, "\n");
 
     /* Pretty-print the simulated annealing info */
-    fprintf(out, "anneal%s", bMDPformat ? " = " : ":");
+    fprintf(out, "annealing%s", bMDPformat ? " = " : ":");
     for (i = 0; (i < opts->ngtc); i++)
     {
         fprintf(out, "  %10s", EANNEAL(opts->annealing[i]));
     }
     fprintf(out, "\n");
 
-    fprintf(out, "ann-npoints%s", bMDPformat ? " = " : ":");
+    fprintf(out, "annealing-npoints%s", bMDPformat ? " = " : ":");
     for (i = 0; (i < opts->ngtc); i++)
     {
         fprintf(out, "  %10d", opts->anneal_npoints[i]);
@@ -514,13 +514,13 @@ static void pr_grp_opts(FILE *out, int indent, const char *title, t_grpopts *opt
     {
         if (opts->anneal_npoints[i] > 0)
         {
-            fprintf(out, "ann. times [%d]:\t", i);
+            fprintf(out, "annealing-time [%d]:\t", i);
             for (j = 0; (j < opts->anneal_npoints[i]); j++)
             {
                 fprintf(out, "  %10.1f", opts->anneal_time[i][j]);
             }
             fprintf(out, "\n");
-            fprintf(out, "ann. temps [%d]:\t", i);
+            fprintf(out, "annealing-temp [%d]:\t", i);
             for (j = 0; (j < opts->anneal_npoints[i]); j++)
             {
                 fprintf(out, "  %10.1f", opts->anneal_temp[i][j]);
@@ -646,9 +646,9 @@ static void pr_pull_coord(FILE *fp, int indent, int c, t_pull_coord *pcrd)
 
 static void pr_simtempvals(FILE *fp, int indent, t_simtemp *simtemp, int n_lambda)
 {
-    PR("simtemp_low", simtemp->simtemp_low);
-    PR("simtemp_high", simtemp->simtemp_high);
     PS("simulated-tempering-scaling", ESIMTEMP(simtemp->eSimTempScale));
+    PR("sim-temp-low", simtemp->simtemp_low);
+    PR("sim-temp-high", simtemp->simtemp_high);
     pr_rvec(fp, indent, "simulated tempering temperatures", simtemp->temperatures, n_lambda, TRUE);
 }
 
@@ -656,21 +656,8 @@ static void pr_expandedvals(FILE *fp, int indent, t_expanded *expand, int n_lamb
 {
 
     PI("nstexpanded", expand->nstexpanded);
-    PS("lambda-stats", elamstats_names[expand->elamstats]);
-    PS("lambda-mc-move", elmcmove_names[expand->elmcmove]);
-    PI("lmc-repeats", expand->lmc_repeats);
-    PI("lmc-gibbsdelta", expand->gibbsdeltalam);
-    PI("lmc-nstart", expand->lmc_forced_nstart);
-    PS("symmetrized-transition-matrix", EBOOL(expand->bSymmetrizedTMatrix));
-    PI("nst-transition-matrix", expand->nstTij);
-    PI("mininum-var-min", expand->minvarmin); /*default is reasonable */
-    PI("weight-c-range", expand->c_range);    /* default is just C=0 */
-    PR("wl-scale", expand->wl_scale);
-    PR("init-wl-delta", expand->init_wl_delta);
-    PR("wl-ratio", expand->wl_ratio);
-    PS("bWLoneovert", EBOOL(expand->bWLoneovert));
-    PI("lmc-seed", expand->lmc_seed);
-    PR("mc-temperature", expand->mc_temp);
+    PS("lmc-stats", elamstats_names[expand->elamstats]);
+    PS("lmc-move", elmcmove_names[expand->elmcmove]);
     PS("lmc-weights-equil", elmceq_names[expand->elmceq]);
     if (expand->elmceq == elmceqNUMATLAM)
     {
@@ -692,6 +679,19 @@ static void pr_expandedvals(FILE *fp, int indent, t_expanded *expand, int n_lamb
     {
         PR("weight-equil-count-ratio", expand->equil_ratio);
     }
+    PI("lmc-seed", expand->lmc_seed);
+    PR("mc-temperature", expand->mc_temp);
+    PI("lmc-repeats", expand->lmc_repeats);
+    PI("lmc-gibbsdelta", expand->gibbsdeltalam);
+    PI("lmc-forced-nstart", expand->lmc_forced_nstart);
+    PS("symmetrized-transition-matrix", EBOOL(expand->bSymmetrizedTMatrix));
+    PI("nst-transition-matrix", expand->nstTij);
+    PI("mininum-var-min", expand->minvarmin); /*default is reasonable */
+    PI("weight-c-range", expand->c_range);    /* default is just C=0 */
+    PR("wl-scale", expand->wl_scale);
+    PR("wl-ratio", expand->wl_ratio);
+    PR("init-wl-delta", expand->init_wl_delta);
+    PS("wl-oneovert", EBOOL(expand->bWLoneovert));
 
     pr_indent(fp, indent);
     pr_rvec(fp, indent, "init-lambda-weights", expand->init_lambda_weights, n_lambda, TRUE);
@@ -702,10 +702,11 @@ static void pr_fepvals(FILE *fp, int indent, t_lambda *fep, gmx_bool bMDPformat)
 {
     int i, j;
 
-    PI("nstdhdl", fep->nstdhdl);
-    PI("init-lambda-state", fep->init_fep_state);
     PR("init-lambda", fep->init_lambda);
+    PI("init-lambda-state", fep->init_fep_state);
     PR("delta-lambda", fep->delta_lambda);
+    PI("nstdhdl", fep->nstdhdl);
+
     if (!bMDPformat)
     {
         PI("n-lambdas", fep->n_lambda);
@@ -739,18 +740,17 @@ static void pr_fepvals(FILE *fp, int indent, t_lambda *fep, gmx_bool bMDPformat)
         }
     }
     PI("calc-lambda-neighbors", fep->lambda_neighbors);
-
+    PS("dhdl-print-energy", EBOOL(fep->bPrintEnergy));
     PR("sc-alpha", fep->sc_alpha);
-    PS("bScCoul", EBOOL(fep->bScCoul));
-    PS("bScPrintEnergy", EBOOL(fep->bPrintEnergy));
     PI("sc-power", fep->sc_power);
     PR("sc-r-power", fep->sc_r_power);
     PR("sc-sigma", fep->sc_sigma);
     PR("sc-sigma-min", fep->sc_sigma_min);
-    PS("separate-dhdl-file", SEPDHDLFILETYPE(fep->separate_dhdl_file));
-    PS("dhdl-derivatives", DHDLDERIVATIVESTYPE(fep->dhdl_derivatives));
+    PS("sc-coul", EBOOL(fep->bScCoul));
     PI("dh-hist-size", fep->dh_hist_size);
     PD("dh-hist-spacing", fep->dh_hist_spacing);
+    PS("separate-dhdl-file", SEPDHDLFILETYPE(fep->separate_dhdl_file));
+    PS("dhdl-derivatives", DHDLDERIVATIVESTYPE(fep->dhdl_derivatives));
 };
 
 static void pr_pull(FILE *fp, int indent, t_pull *pull)
@@ -762,15 +762,15 @@ static void pr_pull(FILE *fp, int indent, t_pull *pull)
     PR("pull-r1", pull->cyl_r1);
     PR("pull-r0", pull->cyl_r0);
     PR("pull-constr-tol", pull->constr_tol);
-    PS("pull-bPrintRef", EBOOL(pull->bPrintRef));
+    PS("pull-print-reference", EBOOL(pull->bPrintRef));
     PI("pull-nstxout", pull->nstxout);
     PI("pull-nstfout", pull->nstfout);
-    PI("pull-ngroup", pull->ngroup);
+    PI("pull-ngroups", pull->ngroup);
     for (g = 0; g < pull->ngroup; g++)
     {
         pr_pull_group(fp, indent, g, &pull->group[g]);
     }
-    PI("pull-ncoord", pull->ncoord);
+    PI("pull-ncoords", pull->ncoord);
     for (g = 0; g < pull->ncoord; g++)
     {
         pr_pull_coord(fp, indent, g, &pull->coord[g]);
@@ -780,31 +780,31 @@ static void pr_pull(FILE *fp, int indent, t_pull *pull)
 static void pr_rotgrp(FILE *fp, int indent, int g, t_rotgrp *rotg)
 {
     pr_indent(fp, indent);
-    fprintf(fp, "rotation_group %d:\n", g);
+    fprintf(fp, "rot-group %d:\n", g);
     indent += 2;
-    PS("type", EROTGEOM(rotg->eType));
-    PS("massw", EBOOL(rotg->bMassW));
+    PS("rot-type", EROTGEOM(rotg->eType));
+    PS("rot-massw", EBOOL(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);
+    pr_rvecs(fp, indent, "x-ref", rotg->x_ref, rotg->nat);
+    pr_rvec(fp, indent, "rot-vec", rotg->vec, DIM, TRUE);
+    pr_rvec(fp, indent, "rot-pivot", rotg->pivot, DIM, TRUE);
+    PR("rot-rate", rotg->rate);
+    PR("rot-k", rotg->k);
+    PR("rot-slab-dist", rotg->slab_dist);
+    PR("rot-min-gauss", rotg->min_gaussian);
+    PR("rot-eps", rotg->eps);
+    PS("rot-fit-method", EROTFIT(rotg->eFittype));
+    PI("rot_potfit_nstep", rotg->PotAngle_nstep);
+    PR("rot_potfit_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);
+    PI("rot-nstrout", rot->nstrout);
+    PI("rot-nstsout", rot->nstsout);
+    PI("rot-ngroups", rot->ngrp);
     for (g = 0; g < rot->ngrp; g++)
     {
         pr_rotgrp(fp, indent, g, &rot->grp[g]);
@@ -818,37 +818,37 @@ static void pr_swap(FILE *fp, int indent, t_swapcoords *swap)
     char str[STRLEN];
 
 
-    PI("frequency", swap->nstswap);
-    for (j = 0; j < 2; j++)
-    {
-        sprintf(str, "nanions%c", j+'A');
-        PI(str, swap->nanions[j]);
-        sprintf(str, "ncations%c", j+'A');
-        PI(str, swap->ncations[j]);
-    }
-    PI("coupling_steps", swap->nAverage);
-    PR("threshold", swap->threshold);
+    PI("swap-frequency", swap->nstswap);
     for (j = 0; j < 2; j++)
     {
-        sprintf(str, "splitgroup%d_massw", j);
+        sprintf(str, "massw_split%d", j);
         PS(str, EBOOL(swap->massw_split[j]));
         sprintf(str, "split atoms group %d", j);
         pr_ivec_block(fp, indent, str, swap->ind_split[j], swap->nat_split[j], TRUE);
     }
     pr_ivec_block(fp, indent, "swap atoms", swap->ind, swap->nat, TRUE);
     pr_ivec_block(fp, indent, "solvent atoms", swap->ind_sol, swap->nat_sol, TRUE);
-    PR("cyl0_radius", swap->cyl0r);
-    PR("cyl0_upper", swap->cyl0u);
-    PR("cyl0_lower", swap->cyl0l);
-    PR("cyl1_radius", swap->cyl1r);
-    PR("cyl1_upper", swap->cyl1u);
-    PR("cyl1_lower", swap->cyl1l);
+    PR("cyl0-r", swap->cyl0r);
+    PR("cyl0-up", swap->cyl0u);
+    PR("cyl0-down", swap->cyl0l);
+    PR("cyl1-r", swap->cyl1r);
+    PR("cyl1-up", swap->cyl1u);
+    PR("cyl1-down", swap->cyl1l);
+    PI("coupl-steps", swap->nAverage);
+    for (j = 0; j < 2; j++)
+    {
+        sprintf(str, "anions%c", j+'A');
+        PI(str, swap->nanions[j]);
+        sprintf(str, "cations%c", j+'A');
+        PI(str, swap->ncations[j]);
+    }
+    PR("threshold", swap->threshold);
 }
 
 
 static void pr_imd(FILE *fp, int indent, t_IMD *imd)
 {
-    PI("IMD_atoms", imd->nat);
+    PI("IMD-atoms", imd->nat);
     pr_ivec_block(fp, indent, "atom", imd->ind, imd->nat, TRUE);
 }
 
@@ -865,85 +865,60 @@ void pr_inputrec(FILE *fp, int indent, const char *title, t_inputrec *ir,
         {
             indent = pr_title(fp, indent, title);
         }
-        /* This strings do not all have a direct correspondence to
-           .mdp entries, but we should follow the same convention of
-           using hyphens in the names users read and write. */
+        /* Try to make this list appear in the same order as the
+         * options are written in the default mdout.mdp, and with
+         * the same user-exposed names to facilitate debugging.
+         */
         PS("integrator", EI(ir->eI));
+        PR("tinit", ir->init_t);
+        PR("dt", ir->delta_t);
         PSTEP("nsteps", ir->nsteps);
         PSTEP("init-step", ir->init_step);
-        PS("cutoff-scheme", ECUTSCHEME(ir->cutoff_scheme));
-        PS("ns-type", ENS(ir->ns_type));
-        PI("nstlist", ir->nstlist);
-        PI("ndelta", ir->ndelta);
-        PI("nstcomm", ir->nstcomm);
+        PI("simulation-part", ir->simulation_part);
         PS("comm-mode", ECOM(ir->comm_mode));
-        PI("nstlog", ir->nstlog);
+        PI("nstcomm", ir->nstcomm);
+
+        /* Langevin dynamics */
+        PR("bd-fric", ir->bd_fric);
+        PSTEP("ld-seed", ir->ld_seed);
+
+        /* Energy minimization */
+        PR("emtol", ir->em_tol);
+        PR("emstep", ir->em_stepsize);
+        PI("niter", ir->niter);
+        PR("fcstep", ir->fc_stepsize);
+        PI("nstcgsteep", ir->nstcgsteep);
+        PI("nbfgscorr", ir->nbfgscorr);
+
+        /* Test particle insertion */
+        PR("rtpi", ir->rtpi);
+
+        /* Output control */
         PI("nstxout", ir->nstxout);
         PI("nstvout", ir->nstvout);
         PI("nstfout", ir->nstfout);
+        PI("nstlog", ir->nstlog);
         PI("nstcalcenergy", ir->nstcalcenergy);
         PI("nstenergy", ir->nstenergy);
         PI("nstxout-compressed", ir->nstxout_compressed);
-        PR("init-t", ir->init_t);
-        PR("delta-t", ir->delta_t);
+        PR("compressed-x-precision", ir->x_compression_precision);
 
-        PR("x-compression-precision", ir->x_compression_precision);
-        PR("fourierspacing", ir->fourier_spacing);
-        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-rtol-lj", ir->ewald_rtol_lj);
-        PR("ewald-geometry", ir->ewald_geometry);
-        PR("epsilon-surface", ir->epsilon_surface);
-        PS("optimize-fft", EBOOL(ir->bOptFFT));
-        PS("lj-pme-comb-rule", ELJPMECOMBNAMES(ir->ljpme_combination_rule));
-        PS("ePBC", EPBC(ir->ePBC));
-        PS("bPeriodicMols", EBOOL(ir->bPeriodicMols));
-        PS("bContinuation", EBOOL(ir->bContinuation));
-        PS("bShakeSOR", EBOOL(ir->bShakeSOR));
-        PS("etc", ETCOUPLTYPE(ir->etc));
-        PS("bPrintNHChains", EBOOL(ir->bPrintNHChains));
-        PI("nsttcouple", ir->nsttcouple);
-        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_matrix(fp, indent, "compress", ir->compress, bMDPformat);
-        PS("refcoord-scaling", EREFSCALINGTYPE(ir->refcoord_scaling));
-        if (bMDPformat)
-        {
-            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);
-        }
-        if (bMDPformat)
-        {
-            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);
-        }
+        /* Neighborsearching parameters */
+        PS("cutoff-scheme", ECUTSCHEME(ir->cutoff_scheme));
+        PI("nstlist", ir->nstlist);
+        PS("ns-type", ENS(ir->ns_type));
+        PS("pbc", EPBC(ir->ePBC));
+        PS("periodic-molecules", EBOOL(ir->bPeriodicMols));
         PR("verlet-buffer-tolerance", ir->verletbuf_tol);
         PR("rlist", ir->rlist);
         PR("rlistlong", ir->rlistlong);
         PR("nstcalclr", ir->nstcalclr);
-        PR("rtpi", ir->rtpi);
+
+        /* Options for electrostatics and VdW */
         PS("coulombtype", EELTYPE(ir->coulombtype));
         PS("coulomb-modifier", INTMODIFIER(ir->coulomb_modifier));
         PR("rcoulomb-switch", ir->rcoulomb_switch);
         PR("rcoulomb", ir->rcoulomb);
-        PS("vdwtype", EVDWTYPE(ir->vdwtype));
-        PS("vdw-modifier", INTMODIFIER(ir->vdw_modifier));
-        PR("rvdw-switch", ir->rvdw_switch);
-        PR("rvdw", ir->rvdw);
         if (ir->epsilon_r != 0)
         {
             PR("epsilon-r", ir->epsilon_r);
@@ -960,12 +935,32 @@ void pr_inputrec(FILE *fp, int indent, const char *title, t_inputrec *ir,
         {
             PS("epsilon-rf", infbuf);
         }
-        PR("tabext", ir->tabext);
+        PS("vdw-type", EVDWTYPE(ir->vdwtype));
+        PS("vdw-modifier", INTMODIFIER(ir->vdw_modifier));
+        PR("rvdw-switch", ir->rvdw_switch);
+        PR("rvdw", ir->rvdw);
+        PS("DispCorr", EDISPCORR(ir->eDispCorr));
+        PR("table-extension", ir->tabext);
+
+        PR("fourierspacing", ir->fourier_spacing);
+        PI("fourier-nx", ir->nkx);
+        PI("fourier-ny", ir->nky);
+        PI("fourier-nz", ir->nkz);
+        PI("pme-order", ir->pme_order);
+        PR("ewald-rtol", ir->ewald_rtol);
+        PR("ewald-rtol-lj", ir->ewald_rtol_lj);
+        PS("lj-pme-comb-rule", ELJPMECOMBNAMES(ir->ljpme_combination_rule));
+        PR("ewald-geometry", ir->ewald_geometry);
+        PR("epsilon-surface", ir->epsilon_surface);
+
+        /* Implicit solvent */
         PS("implicit-solvent", EIMPLICITSOL(ir->implicit_solvent));
+
+        /* Generalized born electrostatics */
         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-epsilon-solvent", ir->gb_epsilon_solvent);
         PR("gb-saltconc", ir->gb_saltconc);
         PR("gb-obc-alpha", ir->gb_obc_alpha);
         PR("gb-obc-beta", ir->gb_obc_beta);
@@ -973,77 +968,134 @@ void pr_inputrec(FILE *fp, int indent, const char *title, t_inputrec *ir,
         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("bSimTemp", EBOOL(ir->bSimTemp));
-        if (ir->bSimTemp)
-        {
-            pr_simtempvals(fp, indent, ir->simtempvals, ir->fepvals->n_lambda);
-        }
-        PS("free-energy", EFEPTYPE(ir->efep));
-        if (ir->efep != efepNO || ir->bSimTemp)
+
+        /* Options for weak coupling algorithms */
+        PS("tcoupl", ETCOUPLTYPE(ir->etc));
+        PI("nsttcouple", ir->nsttcouple);
+        PI("nh-chain-length", ir->opts.nhchainlength);
+        PS("print-nose-hoover-chain-variables", EBOOL(ir->bPrintNHChains));
+
+        PS("pcoupl", EPCOUPLTYPE(ir->epc));
+        PS("pcoupltype", EPCOUPLTYPETYPE(ir->epct));
+        PI("nstpcouple", ir->nstpcouple);
+        PR("tau-p", ir->tau_p);
+        pr_matrix(fp, indent, "compressibility", ir->compress, bMDPformat);
+        pr_matrix(fp, indent, "ref-p", ir->ref_p, bMDPformat);
+        PS("refcoord-scaling", EREFSCALINGTYPE(ir->refcoord_scaling));
+
+        if (bMDPformat)
         {
-            pr_fepvals(fp, indent, ir->fepvals, bMDPformat);
+            fprintf(fp, "posres-com  = %g %g %g\n", ir->posres_com[XX],
+                    ir->posres_com[YY], ir->posres_com[ZZ]);
+            fprintf(fp, "posres-comB = %g %g %g\n", ir->posres_comB[XX],
+                    ir->posres_comB[YY], ir->posres_comB[ZZ]);
         }
-        if (ir->bExpanded)
+        else
         {
-            pr_expandedvals(fp, indent, ir->expandedvals, ir->fepvals->n_lambda);
+            pr_rvec(fp, indent, "posres-com", ir->posres_com, DIM, TRUE);
+            pr_rvec(fp, indent, "posres-comB", ir->posres_comB, DIM, TRUE);
         }
 
+        /* QMMM */
+        PS("QMMM", EBOOL(ir->bQMMM));
+        PI("QMconstraints", ir->QMconstraints);
+        PI("QMMMscheme", ir->QMMMscheme);
+        PR("MMChargeScaleFactor", ir->scalefactor);
+        pr_qm_opts(fp, indent, "qm-opts", &(ir->opts));
+
+        /* CONSTRAINT OPTIONS */
+        PS("constraint-algorithm", ECONSTRTYPE(ir->eConstrAlg));
+        PS("continuation", EBOOL(ir->bContinuation));
+
+        PS("Shake-SOR", EBOOL(ir->bShakeSOR));
+        PR("shake-tol", ir->shake_tol);
+        PI("lincs-order", ir->nProjOrder);
+        PI("lincs-iter", ir->nLincsIter);
+        PR("lincs-warnangle", ir->LincsWarnAngle);
+
+        /* Walls */
         PI("nwall", ir->nwall);
         PS("wall-type", EWALLTYPE(ir->wall_type));
+        PR("wall-r-linpot", ir->wall_r_linpot);
+        /* wall-atomtype */
         PI("wall-atomtype[0]", ir->wall_atomtype[0]);
         PI("wall-atomtype[1]", ir->wall_atomtype[1]);
+        /* wall-density */
         PR("wall-density[0]", ir->wall_density[0]);
         PR("wall-density[1]", ir->wall_density[1]);
         PR("wall-ewald-zfac", ir->wall_ewald_zfac);
 
+        /* COM PULLING */
         PS("pull", EPULLTYPE(ir->ePull));
         if (ir->ePull != epullNO)
         {
             pr_pull(fp, indent, ir->pull);
         }
 
+        /* ENFORCED ROTATION */
         PS("rotation", EBOOL(ir->bRot));
         if (ir->bRot)
         {
             pr_rot(fp, indent, ir->rot);
         }
 
+        /* INTERACTIVE MD */
         PS("interactiveMD", EBOOL(ir->bIMD));
         if (ir->bIMD)
         {
             pr_imd(fp, indent, ir->imd);
         }
 
+        /* NMR refinement stuff */
         PS("disre", EDISRETYPE(ir->eDisre));
         PS("disre-weighting", EDISREWEIGHTING(ir->eDisreWeighting));
         PS("disre-mixed", EBOOL(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("nstorireout", ir->nstorireout);
 
-        PR("dihre-fc", ir->dihre_fc);
+        PR("orire-fc", ir->orires_fc);
+        PR("orire-tau", ir->orires_tau);
+        PR("nstorireout", ir->nstorireout);
 
-        PR("em-stepsize", ir->em_stepsize);
-        PR("em-tol", ir->em_tol);
-        PI("niter", ir->niter);
-        PR("fc-stepsize", ir->fc_stepsize);
-        PI("nstcgsteep", ir->nstcgsteep);
-        PI("nbfgscorr", ir->nbfgscorr);
+        /* FREE ENERGY VARIABLES */
+        PS("free-energy", EFEPTYPE(ir->efep));
+        if (ir->efep != efepNO || ir->bSimTemp)
+        {
+            pr_fepvals(fp, indent, ir->fepvals, bMDPformat);
+        }
+        if (ir->bExpanded)
+        {
+            pr_expandedvals(fp, indent, ir->expandedvals, ir->fepvals->n_lambda);
+        }
 
-        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);
-        PSTEP("ld-seed", ir->ld_seed);
-        PR("cos-accel", ir->cos_accel);
+        /* NON-equilibrium MD stuff */
+        PR("cos-acceleration", ir->cos_accel);
         pr_matrix(fp, indent, "deform", ir->deform, bMDPformat);
 
+        /* SIMULATED TEMPERING */
+        PS("simulated-tempering", EBOOL(ir->bSimTemp));
+        if (ir->bSimTemp)
+        {
+            pr_simtempvals(fp, indent, ir->simtempvals, ir->fepvals->n_lambda);
+        }
+
+        /* ELECTRIC FIELDS */
+        pr_cosine(fp, indent, "E-x", &(ir->ex[XX]), bMDPformat);
+        pr_cosine(fp, indent, "E-xt", &(ir->et[XX]), bMDPformat);
+        pr_cosine(fp, indent, "E-y", &(ir->ex[YY]), bMDPformat);
+        pr_cosine(fp, indent, "E-yt", &(ir->et[YY]), bMDPformat);
+        pr_cosine(fp, indent, "E-z", &(ir->ex[ZZ]), bMDPformat);
+        pr_cosine(fp, indent, "E-zt", &(ir->et[ZZ]), bMDPformat);
+
+        /* ION/WATER SWAPPING FOR COMPUTATIONAL ELECTROPHYSIOLOGY */
+        PS("swapcoords", ESWAPTYPE(ir->eSwapCoords));
+        if (ir->eSwapCoords != eswapNO)
+        {
+            pr_swap(fp, indent, ir->swap);
+        }
+
+        /* AdResS PARAMETERS */
         PS("adress", EBOOL(ir->bAdress));
         if (ir->bAdress)
         {
@@ -1051,13 +1103,14 @@ void pr_inputrec(FILE *fp, int indent, const char *title, t_inputrec *ir,
             PR("adress-const-wf", ir->adress->const_wf);
             PR("adress-ex-width", ir->adress->ex_width);
             PR("adress-hy-width", ir->adress->hy_width);
+            PR("adress-ex-forcecap", ir->adress->ex_forcecap);
             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", EBOOL(ir->adress->do_hybridpairs));
-
             pr_rvec(fp, indent, "adress-reference-coords", ir->adress->refs, DIM, TRUE);
+            PS("adress-do-hybridpairs", EBOOL(ir->adress->do_hybridpairs));
         }
+
+        /* USER-DEFINED THINGIES */
         PI("userint1", ir->userint1);
         PI("userint2", ir->userint2);
         PI("userint3", ir->userint3);
@@ -1066,23 +1119,8 @@ void pr_inputrec(FILE *fp, int indent, const char *title, t_inputrec *ir,
         PR("userreal2", ir->userreal2);
         PR("userreal3", ir->userreal3);
         PR("userreal4", ir->userreal4);
+
         pr_grp_opts(fp, indent, "grpopts", &(ir->opts), bMDPformat);
-        pr_cosine(fp, indent, "efield-x", &(ir->ex[XX]), bMDPformat);
-        pr_cosine(fp, indent, "efield-xt", &(ir->et[XX]), bMDPformat);
-        pr_cosine(fp, indent, "efield-y", &(ir->ex[YY]), bMDPformat);
-        pr_cosine(fp, indent, "efield-yt", &(ir->et[YY]), bMDPformat);
-        pr_cosine(fp, indent, "efield-z", &(ir->ex[ZZ]), bMDPformat);
-        pr_cosine(fp, indent, "efield-zt", &(ir->et[ZZ]), bMDPformat);
-        PS("eSwapCoords", ESWAPTYPE(ir->eSwapCoords));
-        if (ir->eSwapCoords != eswapNO)
-        {
-            pr_swap(fp, indent, ir->swap);
-        }
-        PS("bQMMM", EBOOL(ir->bQMMM));
-        PI("QMconstraints", ir->QMconstraints);
-        PI("QMMMscheme", ir->QMMMscheme);
-        PR("scalefactor", ir->scalefactor);
-        pr_qm_opts(fp, indent, "qm-opts", &(ir->opts));
     }
 }
 #undef PS
index e5ac010016c89f260bb96ef36cd7feb0fdaf885c..8fa4484f6694a3111f0308e725b2b17cb58beb93 100644 (file)
@@ -265,7 +265,6 @@ static void do_nsgrid(FILE *fp, gmx_bool bVerbose,
     ir->vdw_modifier     = eintmodNONE;
     ir->coulombtype      = eelCUT;
     ir->vdwtype          = evdwCUT;
-    ir->ndelta           = 2;
     ir->ns_type          = ensGRID;
     snew(ir->opts.egp_flags, 1);
 
index 2eef5b7b63baf691e67e63330d927c7fda4ff653..1aab6bf4eafd20121076baa7e910c71554bf55db 100644 (file)
@@ -79,6 +79,7 @@
 #include "calc_verletbuf.h"
 #include "tomorse.h"
 #include "gromacs/imd/imd.h"
+#include "gromacs/utility/cstringutil.h"
 
 #include "gromacs/commandline/pargs.h"
 #include "gromacs/pbcutil/pbc.h"
@@ -369,6 +370,41 @@ static void check_vel(gmx_mtop_t *mtop, rvec v[])
     }
 }
 
+static void check_shells_inputrec(gmx_mtop_t *mtop,
+                                  t_inputrec *ir,
+                                  warninp_t   wi)
+{
+    gmx_mtop_atomloop_all_t aloop;
+    t_atom                 *atom;
+    int                     a, nshells = 0;
+    char                    warn_buf[STRLEN];
+
+    aloop = gmx_mtop_atomloop_all_init(mtop);
+    while (gmx_mtop_atomloop_all_next(aloop, &a, &atom))
+    {
+        if (atom->ptype == eptShell ||
+            atom->ptype == eptBond)
+        {
+            nshells++;
+        }
+    }
+    if (IR_TWINRANGE(*ir) && (nshells > 0))
+    {
+        snprintf(warn_buf, STRLEN,
+                 "The combination of using shells and a twin-range cut-off is not supported");
+        warning_error(wi, warn_buf);
+    }
+    if ((nshells > 0) && (ir->nstcalcenergy != 1))
+    {
+        set_warning_line(wi, "unknown", -1);
+        snprintf(warn_buf, STRLEN,
+                 "There are %d shells, changing nstcalcenergy from %d to 1",
+                 nshells, ir->nstcalcenergy);
+        ir->nstcalcenergy = 1;
+        warning(wi, warn_buf);
+    }
+}
+
 static gmx_bool nint_ftype(gmx_mtop_t *mtop, t_molinfo *mi, int ftype)
 {
     int nint, mb;
@@ -949,10 +985,10 @@ static void gen_posres(gmx_mtop_t *mtop, t_molinfo *mi,
     int i, j;
 
     read_posres  (mtop, mi, FALSE, fnA, rc_scaling, ePBC, com, wi);
-    if (strcmp(fnA, fnB) != 0)
-    {
-        read_posres(mtop, mi, TRUE, fnB, rc_scaling, ePBC, comB, wi);
-    }
+    /* It is safer to simply read the b-state posres rather than trying
+     * to be smart and copy the positions.
+     */
+    read_posres(mtop, mi, TRUE, fnB, rc_scaling, ePBC, comB, wi);
 }
 
 static void set_wall_atomtype(gpp_atomtype_t at, t_gromppopts *opts,
@@ -1724,10 +1760,10 @@ int gmx_grompp(int argc, char *argv[])
     }
 
     /* If we are using CMAP, setup the pre-interpolation grid */
-    if (plist->ncmap > 0)
+    if (plist[F_CMAP].ncmap > 0)
     {
-        init_cmap_grid(&sys->ffparams.cmap_grid, plist->nc, plist->grid_spacing);
-        setup_cmap(plist->grid_spacing, plist->nc, plist->cmap, &sys->ffparams.cmap_grid);
+        init_cmap_grid(&sys->ffparams.cmap_grid, plist[F_CMAP].nc, plist[F_CMAP].grid_spacing);
+        setup_cmap(plist[F_CMAP].grid_spacing, plist[F_CMAP].nc, plist[F_CMAP].cmap, &sys->ffparams.cmap_grid);
     }
 
     set_wall_atomtype(atype, opts, ir, wi);
@@ -1784,6 +1820,9 @@ int gmx_grompp(int argc, char *argv[])
         check_vel(sys, state.v);
     }
 
+    /* check for shells and inpurecs */
+    check_shells_inputrec(sys, ir, wi);
+
     /* check masses */
     check_mol(sys, wi);
 
index e65a8d9b8053e4a05e9cbae2e8738ea2e3bdc247..c7919872c1786e63e063223499e88cc63bc7b08f 100644 (file)
@@ -195,6 +195,33 @@ static gmx_bool contains_char(t_rbonded *s, char c)
     return bRet;
 }
 
+gmx_bool rbonded_atoms_exist_in_list(t_rbonded *b, t_rbonded blist[], int nlist, int natoms)
+{
+    int      i, k;
+    gmx_bool matchFound = FALSE;
+    gmx_bool atomsMatch;
+
+    for (i = 0; i < nlist && !matchFound; i++)
+    {
+        atomsMatch = TRUE;
+        for (k = 0; k < natoms && atomsMatch; k++)
+        {
+            atomsMatch = atomsMatch && !strcmp(b->a[k], blist[i].a[k]);
+        }
+        /* Try reverse if forward match did not work */
+        if (!atomsMatch)
+        {
+            atomsMatch = TRUE;
+            for (k = 0; k < natoms && atomsMatch; k++)
+            {
+                atomsMatch = atomsMatch && !strcmp(b->a[k], blist[i].a[natoms-1-k]);
+            }
+        }
+        matchFound = atomsMatch;
+    }
+    return matchFound;
+}
+
 gmx_bool merge_t_bondeds(t_rbondeds s[], t_rbondeds d[], gmx_bool bMin, gmx_bool bPlus)
 {
     int      i, j;
@@ -209,20 +236,26 @@ gmx_bool merge_t_bondeds(t_rbondeds s[], t_rbondeds d[], gmx_bool bMin, gmx_bool
             srenew(d[i].b, d[i].nb + s[i].nb);
             for (j = 0; j < s[i].nb; j++)
             {
-                if (!(bMin && contains_char(&s[i].b[j], '-'))
-                    && !(bPlus && contains_char(&s[i].b[j], '+')))
+                /* Check if this bonded string already exists before adding.
+                 * We are merging from the main rtp to the hackblocks, so this
+                 * will mean the hackblocks overwrite the man rtp, as intended.
+                 */
+                if (!rbonded_atoms_exist_in_list(&s[i].b[j], d[i].b, d[i].nb, btsNiatoms[i]))
                 {
-                    copy_t_rbonded(&s[i].b[j], &d[i].b[ d[i].nb ]);
-                    d[i].nb++;
-                }
-                else if (i == ebtsBONDS)
-                {
-                    bBondsRemoved = TRUE;
+                    if (!(bMin && contains_char(&s[i].b[j], '-'))
+                        && !(bPlus && contains_char(&s[i].b[j], '+')))
+                    {
+                        copy_t_rbonded(&s[i].b[j], &d[i].b[ d[i].nb ]);
+                        d[i].nb++;
+                    }
+                    else if (i == ebtsBONDS)
+                    {
+                        bBondsRemoved = TRUE;
+                    }
                 }
             }
         }
     }
-
     return bBondsRemoved;
 }
 
index 5cead8e6c684e0f0d0e0b21adae01473e697ee34..3dec90d2eed8456594757a3a801d67f26b121130 100644 (file)
@@ -1716,7 +1716,7 @@ int gmx_pdb2gmx(int argc, char *argv[])
     printf("There are %d chains and %d blocks of water and "
            "%d residues with %d atoms\n",
            nch-nwaterchain, nwaterchain,
-           pdba_all.resinfo[pdba_all.atom[natom-1].resind].nr, natom);
+           pdba_all.nres, natom);
 
     printf("\n  %5s  %4s %6s\n", "chain", "#res", "#atoms");
     for (i = 0; (i < nch); i++)
index 9a688ce2dbe8ea6b08a96e181a8f7f5701bcb2fd..7b08b863c42bc69caf7e78d21223ceba7401bb0b 100644 (file)
@@ -441,7 +441,7 @@ void choose_watermodel(const char *wmsel, const char *ffdir,
     sfree(model);
 }
 
-static int name2type(t_atoms *at, int **cgnr, gpp_atomtype_t atype,
+static int name2type(t_atoms *at, int **cgnr,
                      t_restp restp[], gmx_residuetype_t *rt)
 {
     int         i, j, prevresind, resind, i0, prevcg, cg, curcg;
@@ -491,9 +491,8 @@ static int name2type(t_atoms *at, int **cgnr, gpp_atomtype_t atype,
             j                = search_jtype(&restp[resind], name, bNterm);
             at->atom[i].type = restp[resind].atom[j].type;
             at->atom[i].q    = restp[resind].atom[j].q;
-            at->atom[i].m    = get_atomtype_massA(restp[resind].atom[j].type,
-                                                  atype);
-            cg = restp[resind].cgnr[j];
+            at->atom[i].m    = restp[resind].atom[j].m;
+            cg               = restp[resind].cgnr[j];
             /* A charge group number -1 signals a separate charge group
              * for this atom.
              */
@@ -1561,7 +1560,7 @@ void pdb2top(FILE *top_file, char *posre_fn, char *molname,
                atoms, nssbonds, ssbonds,
                bAllowMissing);
 
-    nmissat = name2type(atoms, &cgnr, atype, restp, rt);
+    nmissat = name2type(atoms, &cgnr, restp, rt);
     if (nmissat)
     {
         if (bAllowMissing)
index 24710003bc11ceaf89e4e1a6db2cecca56c0f186..dfb68be749c4ceeb184575c65d8603568fe61bcb 100644 (file)
@@ -553,6 +553,11 @@ void check_ir(const char *mdparin, t_inputrec *ir, t_gromppopts *opts,
         }
     }
 
+    if (ir->nsteps == 0 && !ir->bContinuation)
+    {
+        warning_note(wi, "For a correct single-point energy evaluation with nsteps = 0, use continuation = yes to avoid constraining the input coordinates.");
+    }
+
     /* LD STUFF */
     if ((EI_SD(ir->eI) || ir->eI == eiBD) &&
         ir->bContinuation && ir->ld_seed != -1)
@@ -1124,6 +1129,19 @@ void check_ir(const char *mdparin, t_inputrec *ir, t_gromppopts *opts,
         }
     }
 
+    if (ir->coulombtype == eelSWITCH || ir->coulombtype == eelSHIFT)
+    {
+        sprintf(err_buf,
+                "Explicit switch/shift coulomb interactions cannot be used in combination with a secondary coulomb-modifier.");
+        CHECK( ir->coulomb_modifier != eintmodNONE);
+    }
+    if (ir->vdwtype == evdwSWITCH || ir->vdwtype == evdwSHIFT)
+    {
+        sprintf(err_buf,
+                "Explicit switch/shift vdw interactions cannot be used in combination with a secondary vdw-modifier.");
+        CHECK( ir->vdw_modifier != eintmodNONE);
+    }
+
     if (ir->coulombtype == eelSWITCH || ir->coulombtype == eelSHIFT ||
         ir->vdwtype == evdwSWITCH || ir->vdwtype == evdwSHIFT)
     {
@@ -1138,7 +1156,7 @@ void check_ir(const char *mdparin, t_inputrec *ir, t_gromppopts *opts,
         if (ir->rcoulomb_switch/ir->rcoulomb < 0.9499)
         {
             real percentage  = 100*(ir->rcoulomb-ir->rcoulomb_switch)/ir->rcoulomb;
-            sprintf(warn_buf, "The switching range for should be 5%% or less (currently %.2f%% using a switching range of %4f-%4f) for accurate electrostatic energies, energy conservation will be good regardless, since ewald_rtol = %g.",
+            sprintf(warn_buf, "The switching range should be 5%% or less (currently %.2f%% using a switching range of %4f-%4f) for accurate electrostatic energies, energy conservation will be good regardless, since ewald_rtol = %g.",
                     percentage, ir->rcoulomb_switch, ir->rcoulomb, ir->ewald_rtol);
             warning(wi, warn_buf);
         }
@@ -1774,7 +1792,7 @@ void get_ir(const char *mdparin, const char *mdparout,
         warning_note(wi, warn_buf);
     }
 
-    /* remove the following deprecated commands */
+    /* ignore the following deprecated commands */
     REM_TYPE("title");
     REM_TYPE("cpp");
     REM_TYPE("domain-decomposition");
@@ -1784,6 +1802,7 @@ void get_ir(const char *mdparin, const char *mdparout,
     REM_TYPE("dihre-tau");
     REM_TYPE("nstdihreout");
     REM_TYPE("nstcheckpoint");
+    REM_TYPE("optimize-fft");
 
     /* replace the following commands with the clearer new versions*/
     REPL_TYPE("unconstrained-start", "continuation");
@@ -1844,7 +1863,6 @@ void get_ir(const char *mdparin, const char *mdparout,
     ITYPE ("nstxout", ir->nstxout,    0);
     ITYPE ("nstvout", ir->nstvout,    0);
     ITYPE ("nstfout", ir->nstfout,    0);
-    ir->nstcheckpoint = 1000;
     CTYPE ("Output frequency for energies to log file and energy file");
     ITYPE ("nstlog",  ir->nstlog, 1000);
     ITYPE ("nstcalcenergy", ir->nstcalcenergy, 100);
@@ -1867,8 +1885,6 @@ void get_ir(const char *mdparin, const char *mdparout,
     ITYPE ("nstlist", ir->nstlist,    10);
     CTYPE ("ns algorithm (simple or grid)");
     EETYPE("ns-type",     ir->ns_type,    ens_names);
-    /* set ndelta to the optimal value of 2 */
-    ir->ndelta = 2;
     CTYPE ("Periodic boundary conditions: xyz, no, xy");
     EETYPE("pbc",         ir->ePBC,       epbc_names);
     EETYPE("periodic-molecules", ir->bPeriodicMols, yesno_names);
@@ -1917,7 +1933,6 @@ void get_ir(const char *mdparin, const char *mdparout,
     EETYPE("lj-pme-comb-rule", ir->ljpme_combination_rule, eljpme_names);
     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);
@@ -2338,7 +2353,7 @@ void get_ir(const char *mdparin, const char *mdparout,
         }
         else
         {
-            warning(wi, "Can not couple a molecule with free_energy = no");
+            warning_note(wi, "Free energy is turned off, so we will not decouple the molecule listed in your input.");
         }
     }
     /* FREE ENERGY AND EXPANDED ENSEMBLE OPTIONS */
index 0e9706a7aea58d90b1f12e3b280bfe377b2b3ee2..9e2d0ab8156c4ffadfaf3d44ab01a746261eb7e9 100644 (file)
@@ -145,7 +145,7 @@ char **read_pullparams(int *ninp_p, t_inpfile **inp_p,
     RTYPE("pull-r1",          pull->cyl_r1, 1.0);
     CTYPE("Switch from r1 to r0 in case of dynamic reaction force");
     RTYPE("pull-r0",          pull->cyl_r0, 1.5);
-    RTYPE("pull_constr_tol",  pull->constr_tol, 1E-6);
+    RTYPE("pull-constr-tol",  pull->constr_tol, 1E-6);
     EETYPE("pull-start",      *bStart, yesno_names);
     EETYPE("pull-print-reference", pull->bPrintRef, yesno_names);
     ITYPE("pull-nstxout",     pull->nstxout, 10);
@@ -248,6 +248,11 @@ void make_pull_groups(t_pull *pull,
     {
         pgrp = &pull->group[g];
 
+        if (strcmp(pgnames[g], "") == 0)
+        {
+            gmx_fatal(FARGS, "Group pull_group%d required by grompp was undefined.", g);
+        }
+
         ig        = search_string(pgnames[g], grps->nr, gnames);
         pgrp->nat = grps->index[ig+1] - grps->index[ig];
 
index 78124c50fb1ef6a21d2ccaef7c78719b7dcdaa11..b8e88b149c6f0b9078adf40ead0341424472e503 100644 (file)
@@ -613,8 +613,8 @@ static char **read_topol(const char *infile, const char *outfile,
     comb     = 0;
 
     /* Init the number of CMAP torsion angles  and grid spacing */
-    plist->grid_spacing = 0;
-    plist->nc           = 0;
+    plist[F_CMAP].grid_spacing = 0;
+    plist[F_CMAP].nc           = 0;
 
     bWarn_copy_A_B = bFEP;
 
index 73fe406051b6889870de1f823cd811e84d552bcf..541985dcb36e5eea560cfdd25209eea6ed8bef74 100644 (file)
@@ -96,7 +96,7 @@ void generate_nbparams(int comb, int ftype, t_params *plist, gpp_atomtype_t atyp
                     break;
 
                 case eCOMB_ARITHMETIC:
-                    /* c0 and c1 are epsilon and sigma */
+                    /* c0 and c1 are sigma and epsilon */
                     for (i = k = 0; (i < nr); i++)
                     {
                         for (j = 0; (j < nr); j++, k++)
@@ -105,14 +105,21 @@ void generate_nbparams(int comb, int ftype, t_params *plist, gpp_atomtype_t atyp
                             cj0                  = get_atomtype_nbparam(j, 0, atype);
                             ci1                  = get_atomtype_nbparam(i, 1, atype);
                             cj1                  = get_atomtype_nbparam(j, 1, atype);
-                            plist->param[k].c[0] = (ci0+cj0)*0.5;
+                            plist->param[k].c[0] = (fabs(ci0) + fabs(cj0))*0.5;
+                            /* Negative sigma signals that c6 should be set to zero later,
+                             * so we need to propagate that through the combination rules.
+                             */
+                            if (ci0 < 0 || cj0 < 0)
+                            {
+                                plist->param[k].c[0] *= -1;
+                            }
                             plist->param[k].c[1] = sqrt(ci1*cj1);
                         }
                     }
 
                     break;
                 case eCOMB_GEOM_SIG_EPS:
-                    /* c0 and c1 are epsilon and sigma */
+                    /* c0 and c1 are sigma and epsilon */
                     for (i = k = 0; (i < nr); i++)
                     {
                         for (j = 0; (j < nr); j++, k++)
@@ -121,7 +128,14 @@ void generate_nbparams(int comb, int ftype, t_params *plist, gpp_atomtype_t atyp
                             cj0                  = get_atomtype_nbparam(j, 0, atype);
                             ci1                  = get_atomtype_nbparam(i, 1, atype);
                             cj1                  = get_atomtype_nbparam(j, 1, atype);
-                            plist->param[k].c[0] = sqrt(ci0*cj0);
+                            plist->param[k].c[0] = sqrt(fabs(ci0*cj0));
+                            /* Negative sigma signals that c6 should be set to zero later,
+                             * so we need to propagate that through the combination rules.
+                             */
+                            if (ci0 < 0 || cj0 < 0)
+                            {
+                                plist->param[k].c[0] *= -1;
+                            }
                             plist->param[k].c[1] = sqrt(ci1*cj1);
                         }
                     }
@@ -1114,8 +1128,8 @@ push_cmaptype(directive d, t_params bt[], int nral, gpp_atomtype_t at,
     nrfp   = nrfpA+nrfpB;
 
     /* Allocate memory for the CMAP grid */
-    bt->ncmap += nrfp;
-    srenew(bt->cmap, bt->ncmap);
+    bt[F_CMAP].ncmap += nrfp;
+    srenew(bt[F_CMAP].cmap, bt[F_CMAP].ncmap);
 
     /* Read in CMAP parameters */
     sl = 0;
@@ -1127,7 +1141,7 @@ push_cmaptype(directive d, t_params bt[], int nral, gpp_atomtype_t at,
         }
         nn  = sscanf(line+start+sl, " %s ", s);
         sl += strlen(s);
-        bt->cmap[i+(bt->ncmap)-nrfp] = strtod(s, NULL);
+        bt[F_CMAP].cmap[i+(bt[F_CMAP].ncmap)-nrfp] = strtod(s, NULL);
 
         if (nn == 1)
         {
@@ -1145,7 +1159,7 @@ push_cmaptype(directive d, t_params bt[], int nral, gpp_atomtype_t at,
     {
         for (i = 0; i < ncmap; i++)
         {
-            bt->cmap[i+ncmap] = bt->cmap[i];
+            bt[F_CMAP].cmap[i+ncmap] = bt[F_CMAP].cmap[i];
         }
     }
     else
@@ -1168,12 +1182,12 @@ push_cmaptype(directive d, t_params bt[], int nral, gpp_atomtype_t at,
     /* Set grid spacing and the number of grids (we assume these numbers to be the same for all grids
      * so we can safely assign them each time
      */
-    bt->grid_spacing = nxcmap;     /* Or nycmap, they need to be equal */
-    bt->nc           = bt->nc + 1; /* Since we are incrementing here, we need to subtract later, see (*****) */
-    nct              = (nral+1) * bt->nc;
+    bt[F_CMAP].grid_spacing = nxcmap;            /* Or nycmap, they need to be equal */
+    bt[F_CMAP].nc           = bt[F_CMAP].nc + 1; /* Since we are incrementing here, we need to subtract later, see (*****) */
+    nct                     = (nral+1) * bt[F_CMAP].nc;
 
     /* Allocate memory for the cmap_types information */
-    srenew(bt->cmap_types, nct);
+    srenew(bt[F_CMAP].cmap_types, nct);
 
     for (i = 0; (i < nral); i++)
     {
@@ -1187,16 +1201,16 @@ push_cmaptype(directive d, t_params bt[], int nral, gpp_atomtype_t at,
         }
 
         /* Assign a grid number to each cmap_type */
-        bt->cmap_types[bt->nct++] = get_bond_atomtype_type(alc[i], bat);
+        bt[F_CMAP].cmap_types[bt[F_CMAP].nct++] = get_bond_atomtype_type(alc[i], bat);
     }
 
     /* Assign a type number to this cmap */
-    bt->cmap_types[bt->nct++] = bt->nc-1; /* Since we inremented earlier, we need to subtrac here, to get the types right (****) */
+    bt[F_CMAP].cmap_types[bt[F_CMAP].nct++] = bt[F_CMAP].nc-1; /* Since we inremented earlier, we need to subtrac here, to get the types right (****) */
 
     /* Check for the correct number of atoms (again) */
-    if (bt->nct != nct)
+    if (bt[F_CMAP].nct != nct)
     {
-        gmx_fatal(FARGS, "Incorrect number of atom types (%d) in cmap type %d\n", nct, bt->nc);
+        gmx_fatal(FARGS, "Incorrect number of atom types (%d) in cmap type %d\n", nct, bt[F_CMAP].nc);
     }
 
     /* Is this correct?? */
@@ -1534,7 +1548,7 @@ static gmx_bool default_cmap_params(t_params bondtype[],
     ct           = 0;
 
     /* Match the current cmap angle against the list of cmap_types */
-    for (i = 0; i < bondtype->nct && !bFound; i += 6)
+    for (i = 0; i < bondtype[F_CMAP].nct && !bFound; i += 6)
     {
         if (bB)
         {
@@ -1543,15 +1557,15 @@ static gmx_bool default_cmap_params(t_params bondtype[],
         else
         {
             if (
-                (get_atomtype_batype(at->atom[p->a[0]].type, atype) == bondtype->cmap_types[i])   &&
-                (get_atomtype_batype(at->atom[p->a[1]].type, atype) == bondtype->cmap_types[i+1]) &&
-                (get_atomtype_batype(at->atom[p->a[2]].type, atype) == bondtype->cmap_types[i+2]) &&
-                (get_atomtype_batype(at->atom[p->a[3]].type, atype) == bondtype->cmap_types[i+3]) &&
-                (get_atomtype_batype(at->atom[p->a[4]].type, atype) == bondtype->cmap_types[i+4]))
+                (get_atomtype_batype(at->atom[p->a[0]].type, atype) == bondtype[F_CMAP].cmap_types[i])   &&
+                (get_atomtype_batype(at->atom[p->a[1]].type, atype) == bondtype[F_CMAP].cmap_types[i+1]) &&
+                (get_atomtype_batype(at->atom[p->a[2]].type, atype) == bondtype[F_CMAP].cmap_types[i+2]) &&
+                (get_atomtype_batype(at->atom[p->a[3]].type, atype) == bondtype[F_CMAP].cmap_types[i+3]) &&
+                (get_atomtype_batype(at->atom[p->a[4]].type, atype) == bondtype[F_CMAP].cmap_types[i+4]))
             {
                 /* Found cmap torsion */
                 bFound       = TRUE;
-                ct           = bondtype->cmap_types[i+5];
+                ct           = bondtype[F_CMAP].cmap_types[i+5];
                 nparam_found = 1;
             }
         }
index 28bb1546da615042a78e0e7e7693853c94b3155b..172e231e50ddecc6303d9660c4d0dcc0f3dd73b2 100644 (file)
@@ -148,6 +148,7 @@ void rename_atoms(const char *xlfile, const char *ffdir,
     char        **f;
     char          c, *rnm, atombuf[32], *ptr0, *ptr1;
     gmx_bool      bReorderedNum, bRenamed, bMatch;
+    gmx_bool      bStartTerm, bEndTerm;
 
     nxlate = 0;
     xlatom = NULL;
@@ -173,6 +174,10 @@ void rename_atoms(const char *xlfile, const char *ffdir,
     for (a = 0; (a < atoms->nr); a++)
     {
         resind = atoms->atom[a].resind;
+
+        bStartTerm = (resind == 0) || atoms->resinfo[resind].chainnum != atoms->resinfo[resind-1].chainnum;
+        bEndTerm   = (resind >= atoms->nres-1) || atoms->resinfo[resind].chainnum != atoms->resinfo[resind+1].chainnum;
+
         if (bResname)
         {
             rnm = *(atoms->resinfo[resind].name);
@@ -206,6 +211,10 @@ void rename_atoms(const char *xlfile, const char *ffdir,
             {
                 /* Match the residue name */
                 bMatch = (xlatom[i].res == NULL ||
+                          (gmx_strcasecmp("protein-nterm", xlatom[i].res) == 0 &&
+                           gmx_residuetype_is_protein(rt, rnm) && bStartTerm) ||
+                          (gmx_strcasecmp("protein-cterm", xlatom[i].res) == 0 &&
+                           gmx_residuetype_is_protein(rt, rnm) && bEndTerm) ||
                           (gmx_strcasecmp("protein", xlatom[i].res) == 0 &&
                            gmx_residuetype_is_protein(rt, rnm)) ||
                           (gmx_strcasecmp("DNA", xlatom[i].res) == 0 &&
index 17152451bb4d3efaf237adf06f65f16b758c60f6..cf2b6456cef73f95edf6c07611ac6c2df1eaf076 100644 (file)
@@ -64,7 +64,8 @@ gmx_nonbonded_setup(t_forcerec *   fr,
 
 void
 gmx_nonbonded_set_kernel_pointers(FILE *       fplog,
-                                  t_nblist *   nl);
+                                  t_nblist *   nl,
+                                  gmx_bool     bElecAndVdwSwitchDiffers);
 
 
 
index efd24f896e8cdc0f6a7ef6df7ee05ab8102b418f..c8fdf66b7a05f59ebc42b3fc3df3cf5b1c2c6f3f 100644 (file)
@@ -96,7 +96,7 @@ real output_env_get_time_factor(const output_env_t oenv);
 /* return time conversion factor from ps (i.e. 1e-3 for ps->ns) */
 
 real output_env_get_time_invfactor(const output_env_t oenv);
-/* return inverse time conversion factor from ps (i.e. 1e3 for ps->ns) */
+/* return inverse time conversion factor to ps (i.e. 1e3 for ns->ps) */
 
 real output_env_conv_time(const output_env_t oenv, real time);
 /* return converted time */
index 9e4807207f3c14398230e436f3940f49274cd863..358decc6bd8370ec11446eaa52a0c1e7d72ed684 100644 (file)
@@ -50,7 +50,6 @@ struct t_graph;
  * If x!=NULL, the shells are predict for the global coordinates x.
  */
 gmx_shellfc_t init_shell_flexcon(FILE *fplog,
-                                 gmx_bool bCutoffSchemeIsVerlet,
                                  gmx_mtop_t *mtop, int nflexcon,
                                  rvec *x);
 
index affbf51ac9e0b300324eebc9a01082fb11c3a269..b16abe9141e9d5427073880cdef23ae63697f26a 100644 (file)
@@ -53,7 +53,7 @@ void table_spline3_fill_ewald_lr(real                                 *table_F,
                                  real                                 *table_V,
                                  real                                 *table_FDV0,
                                  int                                   ntab,
-                                 real                                  dx,
+                                 double                                dx,
                                  real                                  beta,
                                  real_space_grid_contribution_computer v_lr);
 /* Fill tables of ntab points with spacing dr with the ewald long-range
index 3380b12b50f13b677fb6a0c7923eb1b8ad612731..10eb0a74492302de10612e7352b69c2f39421839 100644 (file)
@@ -337,9 +337,8 @@ typedef struct {
     int             nstlist;                 /* number of steps before pairlist is generated   */
     int             ndelta;                  /* number of cells per rlong                      */
     int             nstcomm;                 /* number of steps after which center of mass     */
-    /* motion is removed                               */
+                                             /* motion is removed                              */
     int             comm_mode;               /* Center of mass motion removal algorithm      */
-    int             nstcheckpoint;           /* checkpointing frequency                      */
     int             nstlog;                  /* number of steps after which print to logfile   */
     int             nstxout;                 /* number of steps after which X is output        */
     int             nstvout;                 /* id. for V                                      */
@@ -358,7 +357,6 @@ typedef struct {
     real            ewald_rtol_lj;           /* Real space tolerance for LJ-Ewald            */
     int             ewald_geometry;          /* normal/3d ewald, or pseudo-2d LR corrections */
     real            epsilon_surface;         /* Epsilon for PME dipole correction            */
-    gmx_bool        bOptFFT;                 /* optimize the fft plan at start               */
     int             ljpme_combination_rule;  /* Type of combination rule in LJ-PME          */
     int             ePBC;                    /* Type of periodic boundary conditions           */
     int             bPeriodicMols;           /* Periodic molecules                           */
@@ -422,7 +420,6 @@ typedef struct {
     real            orires_fc;               /* force constant for orientational restraints  */
     real            orires_tau;              /* time constant for memory function in orires    */
     int             nstorireout;             /* frequency of writing tr(SD) to enx           */
-    real            dihre_fc;                /* force constant for dihedral restraints (obsolete)      */
     real            em_stepsize;             /* The stepsize for updating                      */
     real            em_tol;                  /* The tolerance                          */
     int             niter;                   /* Number of iterations for convergence of      */
index dcf8bd47b5fceb0cab93753fba5d985fc4aa0ad2..2aa97ffd231ef0fcbc3739a95e9430791313c927 100644 (file)
@@ -220,7 +220,7 @@ static void write_constr_pdb(const char *fn, const char *title,
                              int start, int homenr, t_commrec *cr,
                              rvec x[], matrix box)
 {
-    char          fname[STRLEN], format[STRLEN];
+    char          fname[STRLEN];
     FILE         *out;
     int           dd_ac0 = 0, dd_ac1 = 0, i, ii, resnr;
     gmx_domdec_t *dd;
@@ -243,7 +243,6 @@ static void write_constr_pdb(const char *fn, const char *title,
     {
         sprintf(fname, "%s.pdb", fn);
     }
-    sprintf(format, "%s\n", get_pdbformat());
 
     out = gmx_fio_fopen(fname, "w");
 
@@ -264,9 +263,8 @@ static void write_constr_pdb(const char *fn, const char *title,
             ii = i;
         }
         gmx_mtop_atominfo_global(mtop, ii, &anm, &resnr, &resnm);
-        fprintf(out, format, "ATOM", (ii+1)%100000,
-                anm, resnm, ' ', resnr%10000, ' ',
-                10*x[i][XX], 10*x[i][YY], 10*x[i][ZZ]);
+        gmx_fprintf_pdb_atomline(out, epdbATOM, ii+1, anm, ' ', resnm, ' ', resnr, ' ',
+                                 10*x[i][XX], 10*x[i][YY], 10*x[i][ZZ], 1.0, 0.0, "");
     }
     fprintf(out, "TER\n");
 
index 3e66c896339094c3b395ff4eb072b5f7ad0834a3..4a2646df2d11b389e57fff3dd97121fde8118271 100644 (file)
@@ -1927,7 +1927,7 @@ static void write_dd_grid_pdb(const char *fn, gmx_int64_t step,
                               gmx_domdec_t *dd, matrix box, gmx_ddbox_t *ddbox)
 {
     rvec   grid_s[2], *grid_r = NULL, cx, r;
-    char   fname[STRLEN], format[STRLEN], buf[22];
+    char   fname[STRLEN], buf[22];
     FILE  *out;
     int    a, i, d, z, y, x;
     matrix tric;
@@ -1967,7 +1967,6 @@ static void write_dd_grid_pdb(const char *fn, gmx_int64_t step,
             }
         }
         sprintf(fname, "%s_%s.pdb", fn, gmx_step_str(step, buf));
-        sprintf(format, "%s%s\n", get_pdbformat(), "%6.2f%6.2f");
         out = gmx_fio_fopen(fname, "w");
         gmx_write_pdb_box(out, dd->bScrewPBC ? epbcSCREW : epbcXYZ, box);
         a = 1;
@@ -1988,8 +1987,8 @@ static void write_dd_grid_pdb(const char *fn, gmx_int64_t step,
                         cx[YY] = grid_r[i*2+y][YY];
                         cx[ZZ] = grid_r[i*2+z][ZZ];
                         mvmul(tric, cx, r);
-                        fprintf(out, format, "ATOM", a++, "CA", "GLY", ' ', 1+i,
-                                ' ', 10*r[XX], 10*r[YY], 10*r[ZZ], 1.0, vol);
+                        gmx_fprintf_pdb_atomline(out, epdbATOM, a++, "CA", ' ', "GLY", ' ', i+1, ' ',
+                                                 10*r[XX], 10*r[YY], 10*r[ZZ], 1.0, vol, "");
                     }
                 }
             }
@@ -2016,7 +2015,7 @@ void write_dd_pdb(const char *fn, gmx_int64_t step, const char *title,
                   gmx_mtop_t *mtop, t_commrec *cr,
                   int natoms, rvec x[], matrix box)
 {
-    char          fname[STRLEN], format[STRLEN], format4[STRLEN], buf[22];
+    char          fname[STRLEN], buf[22];
     FILE         *out;
     int           i, ii, resnr, c;
     char         *atomname, *resname;
@@ -2031,9 +2030,6 @@ void write_dd_pdb(const char *fn, gmx_int64_t step, const char *title,
 
     sprintf(fname, "%s_%s_n%d.pdb", fn, gmx_step_str(step, buf), cr->sim_nodeid);
 
-    sprintf(format, "%s%s\n", get_pdbformat(), "%6.2f%6.2f");
-    sprintf(format4, "%s%s\n", get_pdbformat4(), "%6.2f%6.2f");
-
     out = gmx_fio_fopen(fname, "w");
 
     fprintf(out, "TITLE     %s\n", title);
@@ -2059,10 +2055,8 @@ void write_dd_pdb(const char *fn, gmx_int64_t step, const char *title,
         {
             b = dd->comm->zones.n + 1;
         }
-        fprintf(out, strlen(atomname) < 4 ? format : format4,
-                "ATOM", (ii+1)%100000,
-                atomname, resname, ' ', resnr%10000, ' ',
-                10*x[i][XX], 10*x[i][YY], 10*x[i][ZZ], 1.0, b);
+        gmx_fprintf_pdb_atomline(out, epdbATOM, ii+1, atomname, ' ', resname, ' ', resnr, ' ',
+                                 10*x[i][XX], 10*x[i][YY], 10*x[i][ZZ], 1.0, b, "");
     }
     fprintf(out, "TER\n");
 
index c1caca163df069ed4ab2978b657aec2552306d79..cd3b6b308407b82447daba663a558360d92c6999 100644 (file)
@@ -218,8 +218,8 @@ static real *mk_nbfp_combination_rule(const gmx_ffparams_t *idef, int comb_rule)
                 sigmaj = pow(c12j / c6j, 1.0/6.0);
                 epsi   = c6i * c6i / c12i;
                 epsj   = c6j * c6j / c12j;
-                c6     = epsi * epsj * pow(0.5*(sigmai+sigmaj), 6);
-                c12    = epsi * epsj * pow(0.5*(sigmai+sigmaj), 12);
+                c6     = sqrt(epsi * epsj) * pow(0.5*(sigmai+sigmaj), 6);
+                c12    = sqrt(epsi * epsj) * pow(0.5*(sigmai+sigmaj), 12);
             }
             C6(nbfp, atnr, i, j)   = c6*6.0;
             C12(nbfp, atnr, i, j)  = c12*12.0;
@@ -2666,6 +2666,11 @@ void init_forcerec(FILE              *fp,
     fr->nbkernel_elec_modifier    = fr->coulomb_modifier;
     fr->nbkernel_vdw_modifier     = fr->vdw_modifier;
 
+    fr->rvdw             = cutoff_inf(ir->rvdw);
+    fr->rvdw_switch      = ir->rvdw_switch;
+    fr->rcoulomb         = cutoff_inf(ir->rcoulomb);
+    fr->rcoulomb_switch  = ir->rcoulomb_switch;
+
     fr->bTwinRange = fr->rlistlong > fr->rlist;
     fr->bEwald     = (EEL_PME(fr->eeltype) || fr->eeltype == eelEWALD);
 
@@ -2684,12 +2689,18 @@ void init_forcerec(FILE              *fp,
 
         /* If the user absolutely wants different switch/shift settings for coul/vdw, it is likely
          * going to be faster to tabulate the interaction than calling the generic kernel.
+         * However, if generic kernels have been requested we keep things analytically.
          */
-        if (fr->nbkernel_elec_modifier == eintmodPOTSWITCH && fr->nbkernel_vdw_modifier == eintmodPOTSWITCH)
+        if (fr->nbkernel_elec_modifier == eintmodPOTSWITCH &&
+            fr->nbkernel_vdw_modifier == eintmodPOTSWITCH &&
+            bGenericKernelOnly == FALSE)
         {
             if ((fr->rcoulomb_switch != fr->rvdw_switch) || (fr->rcoulomb != fr->rvdw))
             {
                 fr->bcoultab = TRUE;
+                /* Once we tabulate electrostatics, we can use the switch function for LJ,
+                 * which would otherwise need two tables.
+                 */
             }
         }
         else if ((fr->nbkernel_elec_modifier == eintmodPOTSHIFT && fr->nbkernel_vdw_modifier == eintmodPOTSHIFT) ||
@@ -2697,12 +2708,21 @@ void init_forcerec(FILE              *fp,
                    fr->nbkernel_elec_modifier == eintmodEXACTCUTOFF &&
                    (fr->nbkernel_vdw_modifier == eintmodPOTSWITCH || fr->nbkernel_vdw_modifier == eintmodPOTSHIFT))))
         {
-            if (fr->rcoulomb != fr->rvdw)
+            if ((fr->rcoulomb != fr->rvdw) && (bGenericKernelOnly == FALSE))
             {
                 fr->bcoultab = TRUE;
             }
         }
 
+        if (fr->nbkernel_elec_modifier == eintmodFORCESWITCH)
+        {
+            fr->bcoultab = TRUE;
+        }
+        if (fr->nbkernel_vdw_modifier == eintmodFORCESWITCH)
+        {
+            fr->bvdwtab = TRUE;
+        }
+
         if (getenv("GMX_REQUIRE_TABLES"))
         {
             fr->bvdwtab  = TRUE;
@@ -2793,8 +2813,6 @@ void init_forcerec(FILE              *fp,
     fr->epsilon_r       = ir->epsilon_r;
     fr->epsilon_rf      = ir->epsilon_rf;
     fr->fudgeQQ         = mtop->ffparams.fudgeQQ;
-    fr->rcoulomb_switch = ir->rcoulomb_switch;
-    fr->rcoulomb        = cutoff_inf(ir->rcoulomb);
 
     /* Parameters for generalized RF */
     fr->zsquare = 0.0;
@@ -2843,8 +2861,6 @@ void init_forcerec(FILE              *fp,
     fr->egp_flags = ir->opts.egp_flags;
 
     /* Van der Waals stuff */
-    fr->rvdw        = cutoff_inf(ir->rvdw);
-    fr->rvdw_switch = ir->rvdw_switch;
     if ((fr->vdwtype != evdwCUT) && (fr->vdwtype != evdwUSER) && !fr->bBHAM)
     {
         if (fr->rvdw_switch >= fr->rvdw)
@@ -2984,6 +3000,8 @@ void init_forcerec(FILE              *fp,
         (ir->eDispCorr != edispcNO && ir_vdw_switched(ir));
 
     bMakeSeparate14Table = ((!bMakeTables || fr->eeltype != eelCUT || fr->vdwtype != evdwCUT ||
+                             fr->coulomb_modifier != eintmodNONE ||
+                             fr->vdw_modifier != eintmodNONE ||
                              fr->bBHAM || fr->bEwald) &&
                             (gmx_mtop_ftype_count(mtop, F_LJ14) > 0 ||
                              gmx_mtop_ftype_count(mtop, F_LJC14_Q) > 0 ||
@@ -3102,6 +3120,17 @@ void init_forcerec(FILE              *fp,
             }
         }
     }
+    else if ((fr->eDispCorr != edispcNO) &&
+             ((fr->vdw_modifier == eintmodPOTSWITCH) ||
+              (fr->vdw_modifier == eintmodFORCESWITCH) ||
+              (fr->vdw_modifier == eintmodPOTSHIFT)))
+    {
+        /* Tables might not be used for the potential modifier interactions per se, but
+         * we still need them to evaluate switch/shift dispersion corrections in this case.
+         */
+        make_nbf_tables(fp, oenv, fr, rtab, cr, tabfn, NULL, NULL, &fr->nblists[0]);
+    }
+
     if (bMakeSeparate14Table)
     {
         /* generate extra tables with plain Coulomb for 1-4 interactions only */
index fef3331506dd03f5b221af9e1059567b845b45c3..efaeeed142e3560c6d9bc4693b7d849697588f23 100644 (file)
@@ -129,7 +129,8 @@ static void init_nblist(FILE *log, t_nblist *nl_sr, t_nblist *nl_lr,
                         int maxsr, int maxlr,
                         int ivdw, int ivdwmod,
                         int ielec, int ielecmod,
-                        int igeometry, int type)
+                        int igeometry, int type,
+                        gmx_bool bElecAndVdwSwitchDiffers)
 {
     t_nblist *nl;
     int       homenr;
@@ -162,7 +163,7 @@ static void init_nblist(FILE *log, t_nblist *nl_sr, t_nblist *nl_lr,
         }
 
         /* This will also set the simd_padding_width field */
-        gmx_nonbonded_set_kernel_pointers( (i == 0) ? log : NULL, nl);
+        gmx_nonbonded_set_kernel_pointers( (i == 0) ? log : NULL, nl, bElecAndVdwSwitchDiffers);
 
         /* maxnri is influenced by the number of shifts (maximum is 8)
          * and the number of energy groups.
@@ -199,10 +200,11 @@ void init_neighbor_list(FILE *log, t_forcerec *fr, int homenr)
      * cache trashing.
      */
     int        maxsr, maxsr_wat, maxlr, maxlr_wat;
-    int        ielec, ielecf, ivdw, ielecmod, ielecmodf, ivdwmod, type;
+    int        ielec, ivdw, ielecmod, ivdwmod, type;
     int        solvent;
     int        igeometry_def, igeometry_w, igeometry_ww;
     int        i;
+    gmx_bool   bElecAndVdwSwitchDiffers;
     t_nblists *nbl;
 
     /* maxsr     = homenr-fr->nWatMol*3; */
@@ -229,11 +231,12 @@ void init_neighbor_list(FILE *log, t_forcerec *fr, int homenr)
     }
 
     /* Determine the values for ielec/ivdw. */
-    ielec    = fr->nbkernel_elec_interaction;
-    ivdw     = fr->nbkernel_vdw_interaction;
-    ielecmod = fr->nbkernel_elec_modifier;
-    ivdwmod  = fr->nbkernel_vdw_modifier;
-    type     = GMX_NBLIST_INTERACTION_STANDARD;
+    ielec                    = fr->nbkernel_elec_interaction;
+    ivdw                     = fr->nbkernel_vdw_interaction;
+    ielecmod                 = fr->nbkernel_elec_modifier;
+    ivdwmod                  = fr->nbkernel_vdw_modifier;
+    type                     = GMX_NBLIST_INTERACTION_STANDARD;
+    bElecAndVdwSwitchDiffers = ( (fr->rcoulomb_switch != fr->rvdw_switch) || (fr->rcoulomb != fr->rvdw));
 
     fr->ns.bCGlist = (getenv("GMX_NBLISTCG") != 0);
     if (!fr->ns.bCGlist)
@@ -269,19 +272,19 @@ void init_neighbor_list(FILE *log, t_forcerec *fr, int homenr)
             type = GMX_NBLIST_INTERACTION_ADRESS;
         }
         init_nblist(log, &nbl->nlist_sr[eNL_VDWQQ], &nbl->nlist_lr[eNL_VDWQQ],
-                    maxsr, maxlr, ivdw, ivdwmod, ielec, ielecmod, igeometry_def, type);
+                    maxsr, maxlr, ivdw, ivdwmod, ielec, ielecmod, igeometry_def, type, bElecAndVdwSwitchDiffers);
         init_nblist(log, &nbl->nlist_sr[eNL_VDW], &nbl->nlist_lr[eNL_VDW],
-                    maxsr, maxlr, ivdw, ivdwmod, GMX_NBKERNEL_ELEC_NONE, eintmodNONE, igeometry_def, type);
+                    maxsr, maxlr, ivdw, ivdwmod, GMX_NBKERNEL_ELEC_NONE, eintmodNONE, igeometry_def, type, bElecAndVdwSwitchDiffers);
         init_nblist(log, &nbl->nlist_sr[eNL_QQ], &nbl->nlist_lr[eNL_QQ],
-                    maxsr, maxlr, GMX_NBKERNEL_VDW_NONE, eintmodNONE, ielec, ielecmod, igeometry_def, type);
+                    maxsr, maxlr, GMX_NBKERNEL_VDW_NONE, eintmodNONE, ielec, ielecmod, igeometry_def, type, bElecAndVdwSwitchDiffers);
         init_nblist(log, &nbl->nlist_sr[eNL_VDWQQ_WATER], &nbl->nlist_lr[eNL_VDWQQ_WATER],
-                    maxsr_wat, maxlr_wat, ivdw, ivdwmod, ielec, ielecmod, igeometry_w, type);
+                    maxsr_wat, maxlr_wat, ivdw, ivdwmod, ielec, ielecmod, igeometry_w, type, bElecAndVdwSwitchDiffers);
         init_nblist(log, &nbl->nlist_sr[eNL_QQ_WATER], &nbl->nlist_lr[eNL_QQ_WATER],
-                    maxsr_wat, maxlr_wat, GMX_NBKERNEL_VDW_NONE, eintmodNONE, ielec, ielecmod, igeometry_w, type);
+                    maxsr_wat, maxlr_wat, GMX_NBKERNEL_VDW_NONE, eintmodNONE, ielec, ielecmod, igeometry_w, type, bElecAndVdwSwitchDiffers);
         init_nblist(log, &nbl->nlist_sr[eNL_VDWQQ_WATERWATER], &nbl->nlist_lr[eNL_VDWQQ_WATERWATER],
-                    maxsr_wat, maxlr_wat, ivdw, ivdwmod, ielec, ielecmod, igeometry_ww, type);
+                    maxsr_wat, maxlr_wat, ivdw, ivdwmod, ielec, ielecmod, igeometry_ww, type, bElecAndVdwSwitchDiffers);
         init_nblist(log, &nbl->nlist_sr[eNL_QQ_WATERWATER], &nbl->nlist_lr[eNL_QQ_WATERWATER],
-                    maxsr_wat, maxlr_wat, GMX_NBKERNEL_VDW_NONE, eintmodNONE, ielec, ielecmod, igeometry_ww, type);
+                    maxsr_wat, maxlr_wat, GMX_NBKERNEL_VDW_NONE, eintmodNONE, ielec, ielecmod, igeometry_ww, type, bElecAndVdwSwitchDiffers);
 
         /* Did we get the solvent loops so we can use optimized water kernels? */
         if (nbl->nlist_sr[eNL_VDWQQ_WATER].kernelptr_vf == NULL
@@ -301,30 +304,19 @@ void init_neighbor_list(FILE *log, t_forcerec *fr, int homenr)
 
         if (fr->efep != efepNO)
         {
-            if ((fr->bEwald) && (fr->sc_alphacoul > 0)) /* need to handle long range differently if using softcore */
-            {
-                ielecf    = GMX_NBKERNEL_ELEC_EWALD;
-                ielecmodf = eintmodNONE;
-            }
-            else
-            {
-                ielecf    = ielec;
-                ielecmodf = ielecmod;
-            }
-
             init_nblist(log, &nbl->nlist_sr[eNL_VDWQQ_FREE], &nbl->nlist_lr[eNL_VDWQQ_FREE],
-                        maxsr, maxlr, ivdw, ivdwmod, ielecf, ielecmod, GMX_NBLIST_GEOMETRY_PARTICLE_PARTICLE, GMX_NBLIST_INTERACTION_FREE_ENERGY);
+                        maxsr, maxlr, ivdw, ivdwmod, ielec, ielecmod, GMX_NBLIST_GEOMETRY_PARTICLE_PARTICLE, GMX_NBLIST_INTERACTION_FREE_ENERGY, bElecAndVdwSwitchDiffers);
             init_nblist(log, &nbl->nlist_sr[eNL_VDW_FREE], &nbl->nlist_lr[eNL_VDW_FREE],
-                        maxsr, maxlr, ivdw, ivdwmod, GMX_NBKERNEL_ELEC_NONE, eintmodNONE, GMX_NBLIST_GEOMETRY_PARTICLE_PARTICLE, GMX_NBLIST_INTERACTION_FREE_ENERGY);
+                        maxsr, maxlr, ivdw, ivdwmod, GMX_NBKERNEL_ELEC_NONE, eintmodNONE, GMX_NBLIST_GEOMETRY_PARTICLE_PARTICLE, GMX_NBLIST_INTERACTION_FREE_ENERGY, bElecAndVdwSwitchDiffers);
             init_nblist(log, &nbl->nlist_sr[eNL_QQ_FREE], &nbl->nlist_lr[eNL_QQ_FREE],
-                        maxsr, maxlr, GMX_NBKERNEL_VDW_NONE, eintmodNONE, ielecf, ielecmod, GMX_NBLIST_GEOMETRY_PARTICLE_PARTICLE, GMX_NBLIST_INTERACTION_FREE_ENERGY);
+                        maxsr, maxlr, GMX_NBKERNEL_VDW_NONE, eintmodNONE, ielec, ielecmod, GMX_NBLIST_GEOMETRY_PARTICLE_PARTICLE, GMX_NBLIST_INTERACTION_FREE_ENERGY, bElecAndVdwSwitchDiffers);
         }
     }
     /* QMMM MM list */
     if (fr->bQMMM && fr->qr->QMMMscheme != eQMMMschemeoniom)
     {
         init_nblist(log, &fr->QMMMlist, NULL,
-                    maxsr, maxlr, 0, 0, ielec, ielecmod, GMX_NBLIST_GEOMETRY_PARTICLE_PARTICLE, GMX_NBLIST_INTERACTION_STANDARD);
+                    maxsr, maxlr, 0, 0, ielec, ielecmod, GMX_NBLIST_GEOMETRY_PARTICLE_PARTICLE, GMX_NBLIST_INTERACTION_STANDARD, bElecAndVdwSwitchDiffers);
     }
 
     if (log != NULL)
index 66d40b066fc56ab88f621c5de2ecaa6a40b39e3d..8a149288c9daf15a56186a63b086fc962fc360eb 100644 (file)
@@ -1100,13 +1100,12 @@ static int copy_pmegrid_to_fftgrid(gmx_pme_t pme, real *pmegrid, real *fftgrid,
     {
 #ifdef DEBUG_PME
         FILE *fp, *fp2;
-        char  fn[STRLEN], format[STRLEN];
+        char  fn[STRLEN];
         real  val;
         sprintf(fn, "pmegrid%d.pdb", pme->nodeid);
         fp = gmx_ffopen(fn, "w");
         sprintf(fn, "pmegrid%d.txt", pme->nodeid);
         fp2 = gmx_ffopen(fn, "w");
-        sprintf(format, "%s%s\n", pdbformat, "%6.2f%6.2f");
 #endif
 
         for (ix = 0; ix < local_fft_ndata[XX]; ix++)
@@ -1122,8 +1121,8 @@ static int copy_pmegrid_to_fftgrid(gmx_pme_t pme, real *pmegrid, real *fftgrid,
                     val = 100*pmegrid[pmeidx];
                     if (pmegrid[pmeidx] != 0)
                     {
-                        fprintf(fp, format, "ATOM", pmeidx, "CA", "GLY", ' ', pmeidx, ' ',
-                                5.0*ix, 5.0*iy, 5.0*iz, 1.0, val);
+                        gmx_fprintf_pdb_atomline(fp, epdbATOM, pmeidx, "CA", ' ', "GLY", ' ', pmeidx, ' ',
+                                                 5.0*ix, 5.0*iy, 5.0*iz, 1.0, val, "");
                     }
                     if (pmegrid[pmeidx] != 0)
                     {
@@ -3889,7 +3888,7 @@ reduce_threadgrid_overlap(gmx_pme_t pme,
     /* 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
+    /* Note that fft_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--)
@@ -3905,14 +3904,8 @@ reduce_threadgrid_overlap(gmx_pme_t pme,
         }
         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);
-        }
+        /* Determine the end of our part of the source grid */
+        tx1 = min(ox + pmegrid_g->n[XX], ne[XX]);
 
         for (sy = 0; sy >= -pmegrids->nthread_comm[YY]; sy--)
         {
@@ -3927,14 +3920,8 @@ reduce_threadgrid_overlap(gmx_pme_t pme,
             }
             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);
-            }
+            /* Determine the end of our part of the source grid */
+            ty1 = min(oy + pmegrid_g->n[YY], ne[YY]);
 
             for (sz = 0; sz >= -pmegrids->nthread_comm[ZZ]; sz--)
             {
index 8ddbc94859f6c3b1150e41d49a5398d89a422c78..ffe4469567ba13ef7bc539a0567b45be8fc3e539 100644 (file)
@@ -60,6 +60,7 @@
 
 #include "gromacs/math/vec.h"
 #include "gromacs/pbcutil/mshift.h"
+#include "gromacs/pbcutil/pbc.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
@@ -233,7 +234,6 @@ static void predict_shells(FILE *fplog, rvec x[], rvec v[], real dt,
 }
 
 gmx_shellfc_t init_shell_flexcon(FILE *fplog,
-                                 gmx_bool bCutoffSchemeIsVerlet,
                                  gmx_mtop_t *mtop, int nflexcon,
                                  rvec *x)
 {
@@ -287,11 +287,6 @@ gmx_shellfc_t init_shell_flexcon(FILE *fplog,
         return NULL;
     }
 
-    if (bCutoffSchemeIsVerlet)
-    {
-        gmx_fatal(FARGS, "The shell code does not work with the Verlet cut-off scheme.\n");
-    }
-
     snew(shfc, 1);
     shfc->nflexcon = nflexcon;
 
@@ -535,6 +530,12 @@ gmx_shellfc_t init_shell_flexcon(FILE *fplog,
             {
                 fprintf(fplog, "\nNOTE: there all shells that are connected to particles outside thier own charge group, will not predict shells positions during the run\n\n");
             }
+            /* Prediction improves performance, so we should implement either:
+             * 1. communication for the atoms needed for prediction
+             * 2. prediction using the velocities of shells; currently the
+             *    shell velocities are zeroed, it's a bit tricky to keep
+             *    track of the shell displacements and thus the velocity.
+             */
             shfc->bPredict = FALSE;
         }
     }
@@ -995,26 +996,31 @@ int relax_shell_flexcon(FILE *fplog, t_commrec *cr, gmx_bool bVerbose,
         force[i] = shfc->f[i];
     }
 
-    /* When we had particle decomposition, this code only worked with
-     * PD when all particles involved with each shell were in the same
-     * charge group. Not sure if this is still relevant. */
     if (bDoNS && inputrec->ePBC != epbcNONE && !DOMAINDECOMP(cr))
     {
         /* This is the only time where the coordinates are used
          * before do_force is called, which normally puts all
          * charge groups in the box.
          */
-        cg0 = 0;
-        cg1 = top->cgs.nr;
-        put_charge_groups_in_box(fplog, cg0, cg1, fr->ePBC, state->box,
-                                 &(top->cgs), state->x, fr->cg_cm);
+        if (inputrec->cutoff_scheme == ecutsVERLET)
+        {
+            put_atoms_in_box_omp(fr->ePBC, state->box, md->homenr, state->x);
+        }
+        else
+        {
+            cg0 = 0;
+            cg1 = top->cgs.nr;
+            put_charge_groups_in_box(fplog, cg0, cg1, fr->ePBC, state->box,
+                                     &(top->cgs), state->x, fr->cg_cm);
+        }
+
         if (graph)
         {
             mk_mshift(fplog, graph, fr->ePBC, state->box, state->x);
         }
     }
 
-    /* After this all coordinate arrays will contain whole molecules */
+    /* After this all coordinate arrays will contain whole charge groups */
     if (graph)
     {
         shift_self(graph, state->box, state->x);
index 9fa881613d27c246a2a09a3a2fe9c8f74bf2d7e5..3a11733bdd88e55404f2fa13abe1b94bea550337 100644 (file)
@@ -2262,11 +2262,11 @@ integrate_table(real vdwtab[], real scale, int offstart, int rstart, int rend,
 
 void calc_enervirdiff(FILE *fplog, int eDispCorr, t_forcerec *fr)
 {
-    double eners[2], virs[2], enersum, virsum, y0, f, g, h;
-    double r0, r1, r, rc3, rc9, ea, eb, ec, pa, pb, pc, pd;
-    double invscale, invscale2, invscale3;
-    int    ri0, ri1, ri, i, offstart, offset;
-    real   scale, *vdwtab, tabfactor, tmp;
+    double   eners[2], virs[2], enersum, virsum, y0, f, g, h;
+    double   r0, r1, r, rc3, rc9, ea, eb, ec, pa, pb, pc, pd;
+    double   invscale, invscale2, invscale3;
+    int      ri0, ri1, ri, i, offstart, offset;
+    real     scale, *vdwtab, tabfactor, tmp;
 
     fr->enershiftsix    = 0;
     fr->enershifttwelve = 0;
@@ -2282,30 +2282,53 @@ void calc_enervirdiff(FILE *fplog, int eDispCorr, t_forcerec *fr)
             eners[i] = 0;
             virs[i]  = 0;
         }
-        if (fr->vdwtype == evdwSWITCH || fr->vdwtype == evdwSHIFT ||
-            fr->vdw_modifier == eintmodPOTSWITCH ||
-            fr->vdw_modifier == eintmodFORCESWITCH)
+        if ((fr->vdw_modifier == eintmodPOTSHIFT) ||
+            (fr->vdw_modifier == eintmodPOTSWITCH) ||
+            (fr->vdw_modifier == eintmodFORCESWITCH) ||
+            (fr->vdwtype == evdwSHIFT) ||
+            (fr->vdwtype == evdwSWITCH))
         {
-            if (fr->rvdw_switch == 0)
+            if (((fr->vdw_modifier == eintmodPOTSWITCH) ||
+                 (fr->vdw_modifier == eintmodFORCESWITCH) ||
+                 (fr->vdwtype == evdwSWITCH)) && fr->rvdw_switch == 0)
             {
                 gmx_fatal(FARGS,
                           "With dispersion correction rvdw-switch can not be zero "
                           "for vdw-type = %s", evdw_names[fr->vdwtype]);
             }
 
-            scale  = fr->nblists[0].table_elec_vdw.scale;
+            scale  = fr->nblists[0].table_vdw.scale;
             vdwtab = fr->nblists[0].table_vdw.data;
 
             /* Round the cut-offs to exact table values for precision */
             ri0  = floor(fr->rvdw_switch*scale);
             ri1  = ceil(fr->rvdw*scale);
+
+            /* The code below has some support for handling force-switching, i.e.
+             * when the force (instead of potential) is switched over a limited
+             * region. This leads to a constant shift in the potential inside the
+             * switching region, which we can handle by adding a constant energy
+             * term in the force-switch case just like when we do potential-shift.
+             *
+             * For now this is not enabled, but to keep the functionality in the
+             * code we check separately for switch and shift. When we do force-switch
+             * the shifting point is rvdw_switch, while it is the cutoff when we
+             * have a classical potential-shift.
+             *
+             * For a pure potential-shift the potential has a constant shift
+             * all the way out to the cutoff, and that is it. For other forms
+             * we need to calculate the constant shift up to the point where we
+             * start modifying the potential.
+             */
+            ri0  = (fr->vdw_modifier == eintmodPOTSHIFT) ? ri1 : ri0;
+
             r0   = ri0/scale;
             r1   = ri1/scale;
             rc3  = r0*r0*r0;
             rc9  = rc3*rc3*rc3;
 
-            if (fr->vdwtype == evdwSHIFT ||
-                fr->vdw_modifier == eintmodFORCESWITCH)
+            if ((fr->vdw_modifier == eintmodFORCESWITCH) ||
+                (fr->vdwtype == evdwSHIFT))
             {
                 /* Determine the constant energy shift below rvdw_switch.
                  * Table has a scale factor since we have scaled it down to compensate
@@ -2314,6 +2337,12 @@ void calc_enervirdiff(FILE *fplog, int eDispCorr, t_forcerec *fr)
                 fr->enershiftsix    = (real)(-1.0/(rc3*rc3)) - 6.0*vdwtab[8*ri0];
                 fr->enershifttwelve = (real)( 1.0/(rc9*rc3)) - 12.0*vdwtab[8*ri0 + 4];
             }
+            else if (fr->vdw_modifier == eintmodPOTSHIFT)
+            {
+                fr->enershiftsix    = (real)(-1.0/(rc3*rc3));
+                fr->enershifttwelve = (real)( 1.0/(rc9*rc3));
+            }
+
             /* Add the constant part from 0 to rvdw_switch.
              * This integration from 0 to rvdw_switch overcounts the number
              * of interactions by 1, as it also counts the self interaction.
@@ -2321,6 +2350,11 @@ void calc_enervirdiff(FILE *fplog, int eDispCorr, t_forcerec *fr)
              */
             eners[0] += 4.0*M_PI*fr->enershiftsix*rc3/3.0;
             eners[1] += 4.0*M_PI*fr->enershifttwelve*rc3/3.0;
+
+            /* Calculate the contribution in the range [r0,r1] where we
+             * modify the potential. For a pure potential-shift modifier we will
+             * have ri0==ri1, and there will not be any contribution here.
+             */
             for (i = 0; i < 2; i++)
             {
                 enersum = 0;
@@ -2330,7 +2364,14 @@ void calc_enervirdiff(FILE *fplog, int eDispCorr, t_forcerec *fr)
                 virs[i]  -= virsum;
             }
 
-            /* now add the correction for rvdw_switch to infinity */
+            /* Alright: Above we compensated by REMOVING the parts outside r0
+             * corresponding to the ideal VdW 1/r6 and /r12 potentials.
+             *
+             * Regardless of whether r0 is the point where we start switching,
+             * or the cutoff where we calculated the constant shift, we include
+             * all the parts we are missing out to infinity from r0 by
+             * calculating the analytical dispersion correction.
+             */
             eners[0] += -4.0*M_PI/(3.0*rc3);
             eners[1] +=  4.0*M_PI/(9.0*rc9);
             virs[0]  +=  8.0*M_PI/rc3;
@@ -2375,10 +2416,7 @@ void calc_enervirdiff(FILE *fplog, int eDispCorr, t_forcerec *fr)
                       evdw_names[fr->vdwtype]);
         }
 
-        /* TODO: remove this code once we have group LJ-PME kernels
-         * that calculate the exact, full LJ param C6/r^6 within the cut-off,
-         * as the current nbnxn kernels do.
-         */
+        /* When we deprecate the group kernels the code below can go too */
         if (fr->vdwtype == evdwPME && fr->cutoff_scheme == ecutsGROUP)
         {
             /* Calculate self-interaction coefficient (assuming that
index 05fddc51179680b4a4024f66c0e8cbc8fec0fe78..83b65eb693a6c734ba96b9118eed4b4c7c2e89b8 100644 (file)
@@ -165,7 +165,7 @@ void table_spline3_fill_ewald_lr(real                                 *table_f,
                                  real                                 *table_v,
                                  real                                 *table_fdv0,
                                  int                                   ntab,
-                                 real                                  dx,
+                                 double                                dx,
                                  real                                  beta,
                                  real_space_grid_contribution_computer v_lr)
 {
@@ -745,7 +745,8 @@ static void done_tabledata(t_tabledata *td)
     sfree(td->f);
 }
 
-static void fill_table(t_tabledata *td, int tp, const t_forcerec *fr)
+static void fill_table(t_tabledata *td, int tp, const t_forcerec *fr,
+                       gmx_bool b14only)
 {
     /* Fill the table according to the formulas in the manual.
      * In principle, we only need the potential and the second
@@ -763,23 +764,38 @@ static void fill_table(t_tabledata *td, int tp, const t_forcerec *fr)
     int      i;
     double   reppow, p;
     double   r1, rc, r12, r13;
-    double   r, r2, r6, rc6;
+    double   r, r2, r6, rc2, rc6, rc12;
     double   expr, Vtab, Ftab;
     /* Parameters for David's function */
     double   A = 0, B = 0, C = 0, A_3 = 0, B_4 = 0;
     /* Parameters for the switching function */
     double   ksw, swi, swi1;
     /* Temporary parameters */
-    gmx_bool bSwitch, bShift;
+    gmx_bool bPotentialSwitch, bForceSwitch, bPotentialShift;
     double   ewc   = fr->ewaldcoeff_q;
     double   ewclj = fr->ewaldcoeff_lj;
+    double   Vcut  = 0;
 
-    bSwitch = ((tp == etabLJ6Switch) || (tp == etabLJ12Switch) ||
-               (tp == etabCOULSwitch) ||
-               (tp == etabEwaldSwitch) || (tp == etabEwaldUserSwitch));
-
-    bShift  = ((tp == etabLJ6Shift) || (tp == etabLJ12Shift) ||
-               (tp == etabShift));
+    if (b14only)
+    {
+        bPotentialSwitch = FALSE;
+        bForceSwitch     = FALSE;
+        bPotentialShift  = FALSE;
+    }
+    else
+    {
+        bPotentialSwitch = ((tp == etabLJ6Switch) || (tp == etabLJ12Switch) ||
+                            (tp == etabCOULSwitch) ||
+                            (tp == etabEwaldSwitch) || (tp == etabEwaldUserSwitch) ||
+                            (tprops[tp].bCoulomb && (fr->coulomb_modifier == eintmodPOTSWITCH)) ||
+                            (!tprops[tp].bCoulomb && (fr->vdw_modifier == eintmodPOTSWITCH)));
+        bForceSwitch  = ((tp == etabLJ6Shift) || (tp == etabLJ12Shift) ||
+                         (tp == etabShift) ||
+                         (tprops[tp].bCoulomb && (fr->coulomb_modifier == eintmodFORCESWITCH)) ||
+                         (!tprops[tp].bCoulomb && (fr->vdw_modifier == eintmodFORCESWITCH)));
+        bPotentialShift = ((tprops[tp].bCoulomb && (fr->coulomb_modifier == eintmodPOTSHIFT)) ||
+                           (!tprops[tp].bCoulomb && (fr->vdw_modifier == eintmodPOTSHIFT)));
+    }
 
     reppow = fr->reppow;
 
@@ -793,7 +809,7 @@ static void fill_table(t_tabledata *td, int tp, const t_forcerec *fr)
         r1 = fr->rvdw_switch;
         rc = fr->rvdw;
     }
-    if (bSwitch)
+    if (bPotentialSwitch)
     {
         ksw  = 1.0/(pow5(rc-r1));
     }
@@ -801,7 +817,7 @@ static void fill_table(t_tabledata *td, int tp, const t_forcerec *fr)
     {
         ksw  = 0.0;
     }
-    if (bShift)
+    if (bForceSwitch)
     {
         if (tp == etabShift)
         {
@@ -837,6 +853,57 @@ static void fill_table(t_tabledata *td, int tp, const t_forcerec *fr)
     fp = xvgropen("switch.xvg", "switch", "r", "s");
 #endif
 
+    if (bPotentialShift)
+    {
+        rc2   = rc*rc;
+        rc6   = 1.0/(rc2*rc2*rc2);
+        if (gmx_within_tol(reppow, 12.0, 10*GMX_DOUBLE_EPS))
+        {
+            rc12 = rc6*rc6;
+        }
+        else
+        {
+            rc12 = pow(rc, -reppow);
+        }
+
+        switch (tp)
+        {
+            case etabLJ6:
+                /* Dispersion */
+                Vcut = -rc6;
+                break;
+            case etabLJ6Ewald:
+                Vcut  = -rc6*exp(-ewclj*ewclj*rc2)*(1 + ewclj*ewclj*rc2 + pow4(ewclj)*rc2*rc2/2);
+                break;
+            case etabLJ12:
+                /* Repulsion */
+                Vcut  = rc12;
+                break;
+            case etabCOUL:
+                Vcut  = 1.0/rc;
+                break;
+            case etabEwald:
+            case etabEwaldSwitch:
+                Vtab  = gmx_erfc(ewc*rc)/rc;
+                break;
+            case etabEwaldUser:
+                /* Only calculate minus the reciprocal space contribution */
+                Vtab  = -gmx_erf(ewc*rc)/rc;
+                break;
+            case etabRF:
+            case etabRF_ZERO:
+                /* No need for preventing the usage of modifiers with RF */
+                Vcut  = 0.0;
+                break;
+            case etabEXPMIN:
+                Vcut  = exp(-rc);
+                break;
+            default:
+                gmx_fatal(FARGS, "Cannot apply new potential-shift modifier to interaction type '%s' yet. (%s,%d)",
+                          tprops[tp].name, __FILE__, __LINE__);
+        }
+    }
+
     for (i = td->nx0; (i < td->nx); i++)
     {
         r     = td->x[i];
@@ -852,7 +919,7 @@ static void fill_table(t_tabledata *td, int tp, const t_forcerec *fr)
         }
         Vtab  = 0.0;
         Ftab  = 0.0;
-        if (bSwitch)
+        if (bPotentialSwitch)
         {
             /* swi is function, swi1 1st derivative and swi2 2nd derivative */
             /* The switch function is 1 for r<r1, 0 for r>rc, and smooth for
@@ -1003,7 +1070,7 @@ static void fill_table(t_tabledata *td, int tp, const t_forcerec *fr)
                 gmx_fatal(FARGS, "Table type %d not implemented yet. (%s,%d)",
                           tp, __FILE__, __LINE__);
         }
-        if (bShift)
+        if (bForceSwitch)
         {
             /* Normal coulomb with cut-off correction for potential */
             if (r < rc)
@@ -1018,6 +1085,25 @@ static void fill_table(t_tabledata *td, int tp, const t_forcerec *fr)
                     Ftab  +=   A*r12 + B*r13;
                 }
             }
+            else
+            {
+                /* Make sure interactions are zero outside cutoff with modifiers */
+                Vtab = 0;
+                Ftab = 0;
+            }
+        }
+        if (bPotentialShift)
+        {
+            if (r < rc)
+            {
+                Vtab -= Vcut;
+            }
+            else
+            {
+                /* Make sure interactions are zero outside cutoff with modifiers */
+                Vtab = 0;
+                Ftab = 0;
+            }
         }
 
         if (ETAB_USER(tp))
@@ -1026,12 +1112,20 @@ static void fill_table(t_tabledata *td, int tp, const t_forcerec *fr)
             Ftab += td->f[i];
         }
 
-        if ((r > r1) && bSwitch)
+        if (bPotentialSwitch)
         {
-            Ftab = Ftab*swi - Vtab*swi1;
-            Vtab = Vtab*swi;
+            if (r >= rc)
+            {
+                /* Make sure interactions are zero outside cutoff with modifiers */
+                Vtab = 0;
+                Ftab = 0;
+            }
+            else if (r > r1)
+            {
+                Ftab = Ftab*swi - Vtab*swi1;
+                Vtab = Vtab*swi;
+            }
         }
-
         /* Convert to single precision when we store to mem */
         td->v[i]  = Vtab;
         td->f[i]  = Ftab;
@@ -1190,23 +1284,29 @@ static void set_table_type(int tabsel[], const t_forcerec *fr, gmx_bool b14only)
                 gmx_incons("Potential modifiers other than potential-shift are only implemented for LJ cut-off");
             }
 
-            switch (fr->vdw_modifier)
+            /* LJ-PME and other (shift-only) modifiers are handled by applying the modifiers
+             * to the original interaction forms when we fill the table, so we only check cutoffs here.
+             */
+            if (fr->vdwtype == evdwCUT)
             {
-                case eintmodNONE:
-                case eintmodPOTSHIFT:
-                case eintmodEXACTCUTOFF:
-                    /* No modification */
-                    break;
-                case eintmodPOTSWITCH:
-                    tabsel[etiLJ6]  = etabLJ6Switch;
-                    tabsel[etiLJ12] = etabLJ12Switch;
-                    break;
-                case eintmodFORCESWITCH:
-                    tabsel[etiLJ6]  = etabLJ6Shift;
-                    tabsel[etiLJ12] = etabLJ12Shift;
-                    break;
-                default:
-                    gmx_incons("Unsupported vdw_modifier");
+                switch (fr->vdw_modifier)
+                {
+                    case eintmodNONE:
+                    case eintmodPOTSHIFT:
+                    case eintmodEXACTCUTOFF:
+                        /* No modification */
+                        break;
+                    case eintmodPOTSWITCH:
+                        tabsel[etiLJ6]  = etabLJ6Switch;
+                        tabsel[etiLJ12] = etabLJ12Switch;
+                        break;
+                    case eintmodFORCESWITCH:
+                        tabsel[etiLJ6]  = etabLJ6Shift;
+                        tabsel[etiLJ12] = etabLJ12Shift;
+                        break;
+                    default:
+                        gmx_incons("Unsupported vdw_modifier");
+                }
             }
         }
     }
@@ -1326,7 +1426,7 @@ t_forcetable make_tables(FILE *out, const output_env_t oenv,
             init_table(nx, nx0,
                        (tabsel[k] == etabEXPMIN) ? table.scale_exp : table.scale,
                        &(td[k]), !bReadTab);
-            fill_table(&(td[k]), tabsel[k], fr);
+            fill_table(&(td[k]), tabsel[k], fr, b14only);
             if (out)
             {
                 fprintf(out, "%s table with %d data points for %s%s.\n"
index 9bdde8a28cb98ef207c43318b9bd4897dadcdddc..decddec257e4d52cecd5720f3cd1ca6f31ffa8f2 100644 (file)
@@ -1062,7 +1062,12 @@ static void calc_ke_part_visc(matrix box, rvec x[], rvec v[],
         }
         if (md->nPerturbed && md->bPerturbed[n])
         {
-            dekindl += 0.5*(md->massB[n] - md->massA[n])*iprod(v_corrt, v_corrt);
+            /* The minus sign here might be confusing.
+             * The kinetic contribution from dH/dl doesn't come from
+             * d m(l)/2 v^2 / dl, but rather from d p^2/2m(l) / dl,
+             * where p are the momenta. The difference is only a minus sign.
+             */
+            dekindl -= 0.5*(md->massB[n] - md->massA[n])*iprod(v_corrt, v_corrt);
         }
     }
     ekind->dekindl = dekindl;
index a2e6667885e29dd3285bcc08d4857333c9a11120..cf881e9f2add1d15ea10e61e87b2a767d2aa771a 100644 (file)
@@ -163,7 +163,7 @@ real do_walls(t_inputrec *ir, t_forcerec *fr, matrix box, t_mdatoms *md,
             }
             else
             {
-                lamfac = 0;
+                lamfac = lambda;
                 type   = md->typeB;
             }
         }
index 77a773c9e49cb252334b95c97a98a613aa36b71f..3ee55fe3ec413151f2a261ca796738ba39bff59c 100644 (file)
@@ -628,6 +628,7 @@ static void do_constraint(t_pull *pull, t_pbc *pbc,
         for (c = 0; c < pull->ncoord; c++)
         {
             pcrd = &pull->coord[c];
+            ref  = pcrd->init + pcrd->rate*t;
 
             low_get_pull_coord_dr(pull, pcrd, pbc, t,
                                   rnew[pcrd->group[1]],
index c375c169c7b05c0a41330606aa1f63ecfb9b1296..93f1d83f13a5c12edf486ebfc8a46cb276a0f964 100644 (file)
@@ -751,10 +751,8 @@ static void cmp_inputrec(FILE *fp, t_inputrec *ir1, t_inputrec *ir2, real ftol,
     cmp_int(fp, "inputrec->cutoff_scheme", -1, ir1->cutoff_scheme, ir2->cutoff_scheme);
     cmp_int(fp, "inputrec->ns_type", -1, ir1->ns_type, ir2->ns_type);
     cmp_int(fp, "inputrec->nstlist", -1, ir1->nstlist, ir2->nstlist);
-    cmp_int(fp, "inputrec->ndelta", -1, ir1->ndelta, ir2->ndelta);
     cmp_int(fp, "inputrec->nstcomm", -1, ir1->nstcomm, ir2->nstcomm);
     cmp_int(fp, "inputrec->comm_mode", -1, ir1->comm_mode, ir2->comm_mode);
-    cmp_int(fp, "inputrec->nstcheckpoint", -1, ir1->nstcheckpoint, ir2->nstcheckpoint);
     cmp_int(fp, "inputrec->nstlog", -1, ir1->nstlog, ir2->nstlog);
     cmp_int(fp, "inputrec->nstxout", -1, ir1->nstxout, ir2->nstxout);
     cmp_int(fp, "inputrec->nstvout", -1, ir1->nstvout, ir2->nstvout);
@@ -773,7 +771,6 @@ static void cmp_inputrec(FILE *fp, t_inputrec *ir1, t_inputrec *ir2, real ftol,
     cmp_real(fp, "inputrec->ewald_rtol", -1, ir1->ewald_rtol, ir2->ewald_rtol, ftol, abstol);
     cmp_int(fp, "inputrec->ewald_geometry", -1, ir1->ewald_geometry, ir2->ewald_geometry);
     cmp_real(fp, "inputrec->epsilon_surface", -1, ir1->epsilon_surface, ir2->epsilon_surface, ftol, abstol);
-    cmp_int(fp, "inputrec->bOptFFT", -1, ir1->bOptFFT, ir2->bOptFFT);
     cmp_int(fp, "inputrec->bContinuation", -1, ir1->bContinuation, ir2->bContinuation);
     cmp_int(fp, "inputrec->bShakeSOR", -1, ir1->bShakeSOR, ir2->bShakeSOR);
     cmp_int(fp, "inputrec->etc", -1, ir1->etc, ir2->etc);
@@ -855,7 +852,6 @@ static void cmp_inputrec(FILE *fp, t_inputrec *ir1, t_inputrec *ir2, real ftol,
     cmp_real(fp, "inputrec->orires_fc", -1, ir1->orires_fc, ir2->orires_fc, ftol, abstol);
     cmp_real(fp, "inputrec->orires_tau", -1, ir1->orires_tau, ir2->orires_tau, ftol, abstol);
     cmp_int(fp, "inputrec->nstorireout", -1, ir1->nstorireout, ir2->nstorireout);
-    cmp_real(fp, "inputrec->dihre_fc", -1, ir1->dihre_fc, ir2->dihre_fc, ftol, abstol);
     cmp_real(fp, "inputrec->em_stepsize", -1, ir1->em_stepsize, ir2->em_stepsize, ftol, abstol);
     cmp_real(fp, "inputrec->em_tol", -1, ir1->em_tol, ir2->em_tol, ftol, abstol);
     cmp_int(fp, "inputrec->niter", -1, ir1->niter, ir2->niter);
@@ -1072,7 +1068,14 @@ void comp_frame(FILE *fp, t_trxframe *fr1, t_trxframe *fr2,
     }
     if (cmp_bool(fp, "bF", -1, fr1->bF, fr2->bF))
     {
-        cmp_rvecs_rmstol(fp, "f", min(fr1->natoms, fr2->natoms), fr1->f, fr2->f, ftol, abstol);
+        if (bRMSD)
+        {
+            cmp_rvecs(fp, "f", min(fr1->natoms, fr2->natoms), fr1->f, fr2->f, bRMSD, ftol, abstol);
+        }
+        else
+        {
+            cmp_rvecs_rmstol(fp, "f", min(fr1->natoms, fr2->natoms), fr1->f, fr2->f, ftol, abstol);
+        }
     }
     if (cmp_bool(fp, "bBox", -1, fr1->bBox, fr2->bBox))
     {
index c6d5223262c9688104f352126b9af71dc6e10e7b..0e930e2f22e4f902d4e14a92a199567d007dd54d 100644 (file)
@@ -147,9 +147,9 @@ ATOM      6  S2   RB A   2      20.000  20.000   0.000  1.00  0.50
 ATOM      7  CB   RA B   1      20.000  30.000   0.000  1.50  0.00            
 ATOM      8  S1   RA B   1      20.000  40.000   0.000  1.50  0.30            
 ATOM      9  S2   RA B   1      30.000  10.000   0.000  2.00  0.30            
-ATOM     13  CB   RD B   2      40.000  10.000   0.000  1.00  0.00            
-ATOM     14  S1   RD B   2      40.000  20.000   0.000  0.50  0.00            
-ATOM     15  S2   RD B   2      40.000  30.000   0.000  0.00  0.00            
+ATOM     13  CB A RD B   2      40.000  10.000   0.000  1.00  0.00            
+ATOM     14  S1 A RD B   2      40.000  20.000   0.000  0.50  0.00            
+ATOM     15  S2 A RD B   2      40.000  30.000   0.000  0.00  0.00            
 TER
 ENDMDL
 ]]></String>
index b859a5346f6b351cbfc360ea71c31ce74569384e..90921b3a97f8a817492e5d4cd2a9c1ac8337f768 100644 (file)
@@ -114,9 +114,9 @@ ATOM      9  S2   RA B   1      30.000  10.000   0.000  1.00  0.30
 ATOM     10  CB   RC B   1A     30.000  20.000   0.000  0.00  0.00            
 ATOM     11  S1   RC B   1A     30.000  30.000   0.000  0.00  0.00            
 ATOM     12  S2   RC B   1A     30.000  40.000   0.000  0.00  0.30            
-ATOM     13  CB   RD B   2      40.000  10.000   0.000  1.00  0.00            
-ATOM     14  S1   RD B   2      40.000  20.000   0.000  0.50  0.00            
-ATOM     15  S2   RD B   2      40.000  30.000   0.000  0.00  0.00            
+ATOM     13  CB A RD B   2      40.000  10.000   0.000  1.00  0.00            
+ATOM     14  S1 A RD B   2      40.000  20.000   0.000  0.50  0.00            
+ATOM     15  S2 A RD B   2      40.000  30.000   0.000  0.00  0.00            
 TER
 ENDMDL
 ]]></String>
index b92ae8e201cc65ddb8b9f18de467bd90058913e3..103ca163b31ce2db04aca283a31ebed49e3fcbf6 100644 (file)
@@ -147,8 +147,8 @@ ATOM      6  S2   RB A   2      20.000  20.000   0.000  1.00  0.50
 ATOM      7  CB   RA B   1      20.000  30.000   0.000  1.50  0.00            
 ATOM      8  S1   RA B   1      20.000  40.000   0.000  1.50  0.30            
 ATOM      9  S2   RA B   1      30.000  10.000   0.000  2.00  0.30            
-ATOM     13  CB   RD B   2      40.000  10.000   0.000  1.00  0.00            
-ATOM     14  S1   RD B   2      40.000  20.000   0.000  0.50  0.00            
+ATOM     13  CB A RD B   2      40.000  10.000   0.000  1.00  0.00            
+ATOM     14  S1 A RD B   2      40.000  20.000   0.000  0.50  0.00            
 TER
 ENDMDL
 ]]></String>
index cf5ba06456941ac1d04712bd86bfcf90cab8d844..6d907b88e92326c24d1ef236d406c42596bd36f0 100644 (file)
@@ -43,8 +43,7 @@ if(GMX_FAHCORE)
     add_library(fahcore $<TARGET_OBJECTS:mdrun_objlib>)
 elseif(GMX_BUILD_MDRUN_ONLY)
     add_executable(mdrun $<TARGET_OBJECTS:mdrun_objlib> mdrun_main.cpp)
-    target_link_libraries(mdrun
-        ${GMX_EXTRA_LIBRARIES} libgromacs ${GMX_EXE_LINKER_FLAGS})
+    target_link_libraries(mdrun libgromacs ${GMX_EXE_LINKER_FLAGS})
     set(BINARY_NAME "mdrun${GMX_BINARY_SUFFIX}")
     set_target_properties(mdrun PROPERTIES
         OUTPUT_NAME "${BINARY_NAME}"
@@ -66,8 +65,7 @@ else()
         ${GMX_MAIN_SOURCES}
         $<TARGET_OBJECTS:mdrun_objlib>
         $<TARGET_OBJECTS:view_objlib>)
-    target_link_libraries(gmx
-        ${GMX_EXTRA_LIBRARIES} libgromacs ${GMX_EXE_LINKER_FLAGS})
+    target_link_libraries(gmx libgromacs ${GMX_EXE_LINKER_FLAGS})
     if(GMX_X11)
         target_link_libraries(gmx ${X11_LIBRARIES})
     endif()
index c8b4db19d5d8f3208ff92c3acd520d3f11e4effb..3df348d86b4d13c7f90653d2d03afa8b654bf479 100644 (file)
@@ -324,12 +324,19 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
     debug_gmx();
 
     /* Check for polarizable models and flexible constraints */
-    shellfc = init_shell_flexcon(fplog, fr->cutoff_scheme == ecutsVERLET,
+    shellfc = init_shell_flexcon(fplog,
                                  top_global, n_flexible_constraints(constr),
                                  (ir->bContinuation ||
                                   (DOMAINDECOMP(cr) && !MASTER(cr))) ?
                                  NULL : state_global->x);
-
+    if (shellfc && ir->nstcalcenergy != 1)
+    {
+        gmx_fatal(FARGS, "You have nstcalcenergy set to a value (%d) that is different from 1.\nThis is not supported in combinations with shell particles.\nPlease make a new tpr file.", ir->nstcalcenergy);
+    }
+    if (shellfc && DOMAINDECOMP(cr))
+    {
+        gmx_fatal(FARGS, "Shell particles are not implemented with domain decomposition, use a single rank");
+    }
     if (shellfc && ir->eI == eiNM)
     {
         /* Currently shells don't work with Normal Modes */
index 3f22e6d1a37ad877d4962a3360de991d9651130c..d347e5c864b8a696b2dfd4d81cd80c57cdf7fca5 100644 (file)
@@ -207,13 +207,16 @@ int gmx_mdrun(int argc, char *argv[])
         "[PAR]",
         "When PME is used with domain decomposition, separate nodes can",
         "be assigned to do only the PME mesh calculation;",
-        "this is computationally more efficient starting at about 12 nodes.",
+        "this is computationally more efficient starting at about 12 nodes",
+        "or even fewer when OpenMP parallelization is used.",
         "The number of PME nodes is set with option [TT]-npme[tt],",
         "this can not be more than half of the nodes.",
         "By default [TT]mdrun[tt] makes a guess for the number of PME",
-        "nodes when the number of nodes is larger than 11 or performance wise",
-        "not compatible with the PME grid x dimension.",
-        "But the user should optimize npme. Performance statistics on this issue",
+        "nodes when the number of nodes is larger than 16. With GPUs,",
+        "PME nodes are not selected automatically, since the optimal setup",
+        "depends very much on the details of the hardware.",
+        "In all cases you might gain performance by optimizing [TT]-npme[tt].",
+        "Performance statistics on this issue",
         "are written at the end of the log file.",
         "For good load balancing at high parallelization, the PME grid x and y",
         "dimensions should be divisible by the number of PME nodes",
index 47a3d94e262f6ac0390d4af0369963edf2149672..2fa1ff6d51fb26f66350a373da916f6ec6576907 100644 (file)
@@ -281,6 +281,16 @@ gmx_repl_ex_t init_replica_exchange(FILE *fplog,
             {
                 if (re->q[re->type][re->ind[j]] < re->q[re->type][re->ind[i]])
                 {
+                    /* Unordered replicas are supposed to work, but there
+                     * is still an issues somewhere.
+                     * Note that at this point still re->ind[i]=i.
+                     */
+                    gmx_fatal(FARGS, "Replicas with indices %d < %d have %ss %g > %g, please order your replicas on increasing %s",
+                              i, j,
+                              erename[re->type],
+                              re->q[re->type][i], re->q[re->type][j],
+                              erename[re->type]);
+
                     k          = re->ind[i];
                     re->ind[i] = re->ind[j];
                     re->ind[j] = k;
@@ -873,7 +883,7 @@ static real calc_delta(FILE *fplog, gmx_bool bPrint, struct gmx_repl_ex *re, int
         dpV = (beta[ap]*re->pres[ap]-beta[bp]*re->pres[bp])*(Vol[b]-Vol[a])/PRESFAC;
         if (bPrint)
         {
-            fprintf(fplog, "  dpV = %10.3e  d = %10.3e\nb", dpV, delta + dpV);
+            fprintf(fplog, "  dpV = %10.3e  d = %10.3e\n", dpV, delta + dpV);
         }
         delta += dpV;
     }
@@ -900,7 +910,7 @@ test_for_replica_exchange(FILE                 *fplog,
     gmx_bool  bVol     = FALSE;
 
     bMultiEx = (re->nex > 1);  /* multiple exchanges at each state */
-    fprintf(fplog, "Replica exchange at step " "%" GMX_PRId64 " time %g\n", step, time);
+    fprintf(fplog, "Replica exchange at step %" GMX_PRId64 " time %.5f\n", step, time);
 
     if (re->bNPT)
     {
@@ -1241,15 +1251,11 @@ compute_exchange_order(FILE     *fplog,
 }
 
 static void
-prepare_to_do_exchange(FILE      *fplog,
-                       const int *destinations,
-                       const int  replica_id,
-                       const int  nrepl,
-                       int       *maxswap,
-                       int      **order,
-                       int      **cyclic,
-                       int       *incycle,
-                       gmx_bool  *bThisReplicaExchanged)
+prepare_to_do_exchange(FILE               *fplog,
+                       struct gmx_repl_ex *re,
+                       const int           replica_id,
+                       int                *maxswap,
+                       gmx_bool           *bThisReplicaExchanged)
 {
     int i, j;
     /* Hold the cyclic decomposition of the (multiple) replica
@@ -1257,9 +1263,9 @@ prepare_to_do_exchange(FILE      *fplog,
     gmx_bool bAnyReplicaExchanged = FALSE;
     *bThisReplicaExchanged = FALSE;
 
-    for (i = 0; i < nrepl; i++)
+    for (i = 0; i < re->nrepl; i++)
     {
-        if (destinations[i] != i)
+        if (re->destinations[i] != re->ind[i])
         {
             /* only mark as exchanged if the index has been shuffled */
             bAnyReplicaExchanged = TRUE;
@@ -1269,27 +1275,27 @@ prepare_to_do_exchange(FILE      *fplog,
     if (bAnyReplicaExchanged)
     {
         /* reinitialize the placeholder arrays */
-        for (i = 0; i < nrepl; i++)
+        for (i = 0; i < re->nrepl; i++)
         {
-            for (j = 0; j < nrepl; j++)
+            for (j = 0; j < re->nrepl; j++)
             {
-                cyclic[i][j] = -1;
-                order[i][j]  = -1;
+                re->cyclic[i][j] = -1;
+                re->order[i][j]  = -1;
             }
         }
 
         /* Identify the cyclic decomposition of the permutation (very
          * fast if neighbor replica exchange). */
-        cyclic_decomposition(destinations, cyclic, incycle, nrepl, maxswap);
+        cyclic_decomposition(re->destinations, re->cyclic, re->incycle, re->nrepl, maxswap);
 
         /* Now translate the decomposition into a replica exchange
          * order at each step. */
-        compute_exchange_order(fplog, cyclic, order, nrepl, *maxswap);
+        compute_exchange_order(fplog, re->cyclic, re->order, re->nrepl, *maxswap);
 
         /* Did this replica do any exchange at any point? */
         for (j = 0; j < *maxswap; j++)
         {
-            if (replica_id != order[replica_id][j])
+            if (replica_id != re->order[replica_id][j])
             {
                 *bThisReplicaExchanged = TRUE;
                 break;
@@ -1316,8 +1322,7 @@ gmx_bool replica_exchange(FILE *fplog, const t_commrec *cr, struct gmx_repl_ex *
     {
         replica_id  = re->repl;
         test_for_replica_exchange(fplog, cr->ms, re, enerd, det(state_local->box), step, time);
-        prepare_to_do_exchange(fplog, re->destinations, replica_id, re->nrepl, &maxswap,
-                               re->order, re->cyclic, re->incycle, &bThisReplicaExchanged);
+        prepare_to_do_exchange(fplog, re, replica_id, &maxswap, &bThisReplicaExchanged);
     }
     /* Do intra-simulation broadcast so all processors belonging to
      * each simulation know whether they need to participate in
index 3bccd5a1b6daf0179d585c6937daf48c18d69d1a..603f24470354e8ff8f1b1a10852c69c1b533185c 100644 (file)
@@ -1480,8 +1480,14 @@ int mdrunner(gmx_hw_opt_t *hw_opt,
 
     /* Initialize per-physical-node MPI process/thread ID and counters. */
     gmx_init_intranode_counters(cr);
-
 #ifdef GMX_MPI
+    if (MULTISIM(cr))
+    {
+        md_print_info(cr, fplog,
+                      "This is simulation %d out of %d running as a composite Gromacs\n"
+                      "multi-simulation job. Setup for this simulation:\n\n",
+                      cr->ms->sim, cr->ms->nsim);
+    }
     md_print_info(cr, fplog, "Using %d MPI %s\n",
                   cr->nnodes,
 #ifdef GMX_THREAD_MPI