Version bump after 4.6.6 release

Change-Id: Ifac0db3a07caba28c123d233b54356a1db0d79ba
Added tests for denormal and underflow for simd exp()

The SIMD math functions are not expected to handle
the denormal range correctly, but it should at least
be clamped to zero rather than producing garbage
values. No changes required to the math function,
so it appears to pass these tests as-is.

Change-Id: I841c2948c81f6b62f42e60ff30ffd5e4f77926fa
Fixed PME bug with high OpenMP thread count

PME energies and forces could be incorrect with combined MPI+OpenMP
parallelization. This would, only, happen when
pmegrids->nthread_comm[YY] >= 2, which can only occur with high OpenMP
thread count with multiple large prime factors.
It's unlikely that this issue affected production runs.

Fixes #1572.

Change-Id: I03b38c279c8f8ab2e111dad0976edad88b3ea93b
Verify MD5 sum for FFTW download

Since ExternalProject provides confusing error messages with MD5
checking enabled, add a custom download step that works as expected.
When passed a local file as the URL, ExternalProject does the MD5
verification just fine, so the code now downloads the tarball in a
custom step and then passes that local file to ExternalProject.

This allows removing the lengthy security warning that appeared there if
one was just following the quick-and-dirty installation instructions,
and likely only confused novice users.  While this change may not
improve overall security significantly, it hopefully allows everyone to
agree to remove that warning and thus improve the end-user experience.

Change-Id: I9ac5a30ae5858b7a6557ccb2d981cc909457d020
Workaround for ICC 14

Problem was only present with BUILD_SHARED_LIBS=no

Change-Id: Ieb4377d819aa5eff3d139cdbe55775989118a738
Fix hang with LJ-PME and empty domains

With LJ-PME and DD domains with 0 atoms and LJ-PME mdrun could hang.
Fixes #1571.

Change-Id: Ie205954c4f5e1a52df846a69972f735867eea15d
Changed names of test files to avoid Fujitsu compiler bug

The Fujitsu compilers use an older version of the Clang
parser where certain static class initializers (e.g. strings)
are put in a static initializer function stub named after
the file and class. When the first such class has identical
names in two different files where the last part of the
name is identical, this will result in clashing symbols
at link time. Working around this would require an extra
(unused) class definition in each file that would pollute the
code, so for now we merely rename the files where it occurs
and hope that the compilers will be fixed (a bug report has
been submitted).

Change-Id: If552a06950facb0cdbb6e34e0b324aafa6083ae8
Fix portability issue with ArrayRef initializer overloading

Some compilers (in particular the Fujitsu compilers that are
derived from an earlier version of Clang) will not allow
overloading functions where one version uses a pointer to a
type, and the other a vector iterator to the same type - likely
because they have implemented iterators with pointers.
Regardless of what the C++ standard says, we need this working
on K computer, so this patch replaces the overloaded
initializers with non-member functions that create an ArrayRef
or ConstArrayRef either from pointers, an array,
or iterators.

Change-Id: I4c4e327c869920cc08e3f955e88cb3a5b28c7e87
Merge release-4-6 into release-5-0

Conflicts:
	CMakeLists.txt (version bump ignored)

Change-Id: I4ba0209b5f69b6470470530662a0b27390a02771
Check MD5sum for regressiontest

Because we decided it is important for FFTW we should do it for
the tests too. Is only done for non -dev versions.

Change-Id: Id7d1ee027bd302ad7cb10f46d93b0f435872c67e
Added checks for TPI + Verlet scheme

Change-Id: I040f4cc9dbb8ff25ed97d18cca0b4a2c1e7014b0
Replace __LP64__ with check for pointer size

The __LP64__ define is not set e.g. on PGI compilers,
so instead we use a portable way of checking for
pointer size based on defines from stdint.h.

Change-Id: Ib2dd6e45c2b168add07f5478d59aec487a91ab9e
Improve Gromacs portability

This patch addresses a few general portability issues
that we have experienced at least on Fujitsu compilers
(K computer) and (partly) for Pathscale x86 compilers.
- I have added a generic compiler definition fallback
  for boost, so it will work on unidentified compilers.
- There is now  a define for gmock-1.7.0 to handle
  the case where wcscasecmp() is not available. We use
  this by default since it is not important for us.
- If we do not find atomics for sparc64 we now warn and
  fall back on mutexes rather than the compile dying.
- The compiler flag checks have been updated from
  cmake-3.0, and more warning checks added.
- Since some non-GCC compilers set _GNUC_ for
  compatibilty, we do not assume all such compilers
  support tr1, but use the internal tr1/tuple definition
  in Gmock by default.
- Before using the sched.h affinity functions, we now
  check that all the functions we need are supported,
  rather than just one of them.

Change-Id: I31b7f0f46a9d03a627c73a0789b4a9b24fa860ee
Make internal BLAS/LAPACK messages less noisy

BLAS and LAPACK are close to insignificant to Gromacs, so
avoid multi-line noisy warnings about "fallback" solutions;
those will just worry users and make them spend time investigating
under what conditions it might play a role, when we really don't
care much for BLAS/LAPACK performance. Message has been
changed to short inconspicuous status lines when we are using
built-in versions.

Change-Id: I9f1b0c769907521d5cb6325c8d67cd61ca8a803a
Avoid stack overflow on Windows with CMake > 2.8.10.2

CMake used to add "/STACK:10000000" to the default linker flags. That
was removed in version 2.8.11-rc1. The default value used by MSVC is
apparently too small because mdrun crashes with a stack overflow when
built on Windows with MSVC or ICC and CMake newer than 2.8.10.2.

The issue is already fixed in GROMACS 5.0 and master by I1e9858ae3. This
is a backport for release-4-6 of that commit.

Change-Id: Ib9238e513da8e86049d9e56c82262055d3c8b349
Reorganize CMake version information management

Main benefits:
 - Less clutter in the beginning of the main CMakeLists.txt.
 - CPack and regression test version numbers no longer need to be
   updated separately.
 - Easier to reuse the individual GMX_VERSION_* variables instead of
   trying to parse PROJECT_VERSION.
 - -dev suffix in the version string is now automatically managed, with
   no need to patch the source code before packaging a source
   distribution.
 - All stuff related to git version info generation is now in one place,
   and easy to reuse if one wants to add new files that would like to
   embed the full version string.  At least the new documentation build
   targets could probably use this.
 - Additional targets of such type do not cause the git commands to
   generate the info run more than once per build (at least in most
   cases).
 - Remove some unused functionality and unnecessary checking from
   gmxGenerateVersionInfo.cmake to streamline it.  All the checks are
   already done at a higher level.

Some cleanup on the way:
 - Remove enable_language(C/CXX), as CMake by default enables C and C++.
 - Clean up some indentation in affected parts.
 - Rename variables to have consistent names throughout.
   PROJECT_VERSION is now called GMX_VERSION_STRING, as the old name was
   probably there mainly because autoconf named a similar variable in
   config.h that way.
 - Remove CUSTOM_VERSION_STRING, as it does not have a well-defined use.
   If someone can come up with a use case, we can reintroduce a more
   targeted mechanism for such customization.

Change-Id: I23ec2dc6a3ec7b33ba18272e766057f67ffb4bd4
Use native CMake mechanism for find_package(GROMACS)

Instead of various detection stuff that only worked well in the presence
of pkg-config, use native CMake mechanisms: package configuration files
and automatic export of library import definitions.  Include
directories and preprocessor macros influencing the installed headers
are still propagated separately.  The new mechanism also works for
arbitrary suffixes, and is relocatable (as long as external libraries
that GROMACS links against are not moved).  A simple FindGROMACS.cmake
is still there to hide some of the complexity to support multiple
suffixes, but it is not strictly necessary if the using code wants to do
those slightly more complex find_package() invocations directly.

Generalize the machinery that populated libgromacs.pc to use it also for
this purpose.

TODO for later (requires changes that are better done outside this
patch):
 - Improve the versioning logic

The machinery and its current limitations are documented in the Doxygen
page on using GROMACS as a library.  Some of these could possibly be
improved with additional effort, but the current approach is hopefully a
reasonable compromise between usability, robustness, and complexity.

Closes #1430, #1554

Change-Id: I49c50375a5abebfe8614704c175e6ed22c9daa56
Fix CMake package config after recent version changes

Combined merge of I49c5037 and I23ec2dc broke the build without any
conflicts, since usage for a variable that was renamed in the first was
added in the second.

The version management logic in the package config still needs some
extra thought, but that's better done separately to get the build fixed.

Change-Id: I93db8c0c5b515bc73f8e4e10eae86d9fd049975d
Corrected SIMD math overflow documentation

Added more details to the SIMD pmecorr and exp documentation.
Corrected the source of the PME-LJ kernel overflow.

Change-Id: If3f5a27a3bb49ebb67fc24d43ed849e75175cf3c
Fixed output of eigenvalues in g_covar. Fixes #1575

Commit 972032bfb8cd38 introduced a bug that would lead to eigenvalues
only written to .xvg file if "-last" is explicitly stated on the
command line. Otherwise no eigenvalues would appear in the .xvg file.
The eigenvalues are written in a loop from '0' to 'end', but since
'end' is initialized with '-1', the loop would never be executed.
This patch moves the code that computes 'end' one block upwards
before the output to file.

Change-Id: I738c9dd77ff9e6e2daae89b6d2063755dfba88af