Fix FMA4 compile for GCC and MSVC

GCC requires -mfma4 and MSVC requires intrin.h

Fixes #1023

Change-Id: I770a9d7fc5d9b0736042ea01ed0ed0d77aac95c6
Fixes #1020 options in g_enemat

Disentangled the options for selecting energy terms.

Change-Id: I8b2979a32e75a9e6a0eb641c0965089db5318f69
nbnxn CPU force buffer reduction now uses SIMD

The reduction of the non-bonded OpenMP force buffers on the CPU used
a pattern with a high cache-miss rate. This has been improved and
an x86 SIMD reduction function has been added. The old reduction code
has not been removed (yet), as it could be faster in some cases.

Change-Id: Icc5065b976321d34055f9b44caedf3008fe3ec58
Backport ThreadMPI.cmake version from master

Allows to compile small part of ThreadMPI (e.g. for set_affinity)

Change-Id: I4b483a06fccf801399544c753487402ca5eec3a0
Merge "nbnxn CPU force buffer reduction now uses SIMD" into release-4-6
Merge "Backport ThreadMPI.cmake version from master" into release-4-6
Allow to disable usage of rdtscp

The usage of rdtscp couldn't be overwritten by the user, which
which is a problem if the build host supports it but the execution
host doesn't. Adding flag GMX_DISTRIBUTABLE_BUILD which disables
rdtscp and can in the future be used for any other features
which are non-critical and makes binary non-distributable.

Change-Id: I14ee6874334287537dd265bc4217e07ee3c8818d
Test that compiling and linking of AVX works

Older assemblers don't have support for AVX

Related to #1021

Change-Id: If8da47f9458c592d5408c7322280ffacce81145d
Removed some unnecessary instructions, and fixed a bug in GB kernel

The force-only kernels do not have to load all parts of the table,
which saves a few instructions. This patch also fixes a small error in the
chain-rule force introduced in the new generalized-born kernels. There
will soon be automatic tests for the GB kernels, but not today...

Change-Id: Ib9f8b2294ba98bdcbc040f6563a2889c3a9f47a0
fixed nbnxn x86 SIMD non-bonded performance regression

Commit f40969c2 broke the LJ combination detection,
which effectively made all runs use the full combination rule
matrix for x86 SIMD kernels. This is now corrected.

Change-Id: I1073801546fde23e6a53199120246697a7c61b5f
FindFFTW: Keep checking pkg_config until fftw is found

Prior pkg_config didn't work when PKG_CONFIG_PATH was changed
after initial cmake run.

Change-Id: I7c067bdb634577c7847421f187b4893aa52ff511
fixed incorrect 1-4 energies with OpenMP + energy groups

The OpenMP bonded thread data structure allocated too few energy group
elements with more than 1 energy group. This would lead to incorrect
1-4 interaction energies when atoms beyond the first energy group
were involved in 1-4 interactions (but sampling itself was correct).
Potentially this could also lead to memory corruption.
All this could only happen with more than 1 OpenMP thread.

Change-Id: Ib6b91862eaaddaafc0c609961219e01c7be0f9eb
Verify that FFTW can be used with shared libraries

Fixes #740

Change-Id: If55f9bde72b1b2ce783c2a86a9bf0170a159c266
Merge "Test that compiling and linking of AVX works" into release-4-6
reduced the cost of the nbnxn OpenMP nb-force reduction

The cost of the nbnxn non-bonded force reduction, used with OpenMP
on the CPU, increased linearly with the number of OpenMP threads.
Now blocks of this array are only reduced when a thread writes
forces to it.

Change-Id: I06acf772b7951ad3166d22be2e5876e3e5084bc0