cmake: Improve some error messages

Lessons learned from the Q-bio summer school

Change-Id: I521a08ba3a83566582137740a0d097c0637d7d3e
Properly finalize MPI on mdrun -version. Fixes #1313

Change-Id: I1ae5f342da96980df322770d134555e2dc9fe712
Refactored preparation of buffer for NBNxN table loads

The outer and inner kernels try to be hardware-agnostic, but some
architectures need a thread-local buffer for transferring computed
table indices to integer registers via memory. It is better to set up
this buffer using a helper function that is implemented in
hardware-specific files, because the compiler can help prevent some
bugs. In particular, you can no longer forget to make a function
definition on non-SSE2. This eliminates one of the special-case kernel

Change-Id: I1ebdd15afaf03ff4559365867970b88e9ce0ed5e
Fixing problem caused by overflow in expanded ensemble.

Basic problem: logic was failing for single precision because of round off errors.
Solution: convert some of the intermediate arrays into double.

Fixes redmine #1314

Change-Id: Id7e3771d257bbeebeed2f340593b817015a0cd4c
Fixed reference SIMD code to work with MSVC

Also noted minor issue with rounding to even. Using rint would be
preferable, but that's even harder to work around on MSVC.

Change-Id: I495cf2d43cf0b33cc0896958f15703ba8632c7e4
Reordered FFTW fatal error; avoids using unset variables

Now variables that are set in FFTW detection are only used when the
variable that reports FFTW has been found is set (i.e. there has not
been a fatal error). Not sure why we haven't seen problems with this
so far, but we do see them on Power7 with cmake 2.8.8 when FFTWF is
not available.

Change-Id: I1a3e84002dda7f29f90eb532ab14ce51dfca6e5c
fixed parallel normal modes with PME

When doing a normal mode calculation with PME and (thread-)MPI,
the PME forces were incorrect. Also fixed some EM/NM output layout.
Fixes #1308

Change-Id: Ia7862fa62e235336c546824afdcbe28f37b145c5
Fixed GMX_DD_DUMP_GRID

The pdb format string no longer matched the parameters it was given

Change-Id: I682154a0986fdbd73ae414264982a68fed164c87
Fix minor wallcycle output issues

Document 19-character wcn name restriction better.

Enforce 19-character wcn name restriction better. The new behaviour
correctly truncates a wcn[] that is too long for the 19-printing
character field width of the wallcycle table.

Compress two names into one field for GMX_CYCLE_ALL correctly. The
previous version was buggy because the first call to snprintf()
resulted in 0 == buf[8], which suppressed output of the second name
completely. The previous version's second call to snprintf() was
probably wrong similarly.

Change-Id: I430ca6eb2bccfe3775e58bae4b6fc3326bcde706
Consolidated NBNxN SIMD kernel utility routines

Hardware-, precision-, and j-width-specific routines used only by the
NBNxN kernels are now all defined in
nbnxn_kernel_simd_utils*.h. Hardware-specific details are contained in
files specific to that hardware.

A major feature contained in this patch is a refactored treatment of
NBNxN particle-particle exclusions. This hides the
x86-implementation-specific details of using integer- or real-valued
SIMD registers and operations. Both inner and outer NBNXN loops are
now more independent of hardware.

* Moved SIMD types, constants and functions for exclusions to the
  NBNxN kernel module, because that is the only place where they are
  used.
* Introduced gmx_exclfilter type to hide the implementation detail of
  whether the masking is handled in integer- or real-valued SIMD
  registers
* Consolidated gmx_checkbitmask* likewise, and renamed to reflect that
  it returns a gmx_mm_pb
* Eliminated the need for gmx_castsi_pr, gmx_set1_epi32, gmx_load_si
  by recasting the code as the composite operation of
  gmx_load1?_exclfilter
* Through the above, eliminated the need for CHECKBITMASK preprocessor
  defines and checks
* Converted code macros to static inline functions
* Converted FILTER_STRIDE and NBFP_STRIDE to a static const instead of
  macro, since neither are ever used as an array dimension in C. This
  works towards using the compiler where possible and the preprocessor
  only where necessary.
* Introduced functions for exclusion mask loading so that there will
  be a link seam for testing with in master branch

TODO: Respond to two questions addressed to Berk embedded in new
comments.

Change-Id: I2a74638b982bdbf5a88442b93736df0a2f0c14b0
Fixes for Bluegene/Q

* Moved suffixing code to after where gmxManageBlueGene sets
  GMX_MPI. Since nothing depends on the suffixing until the calls to
  add_subdirectory(), this is safe. There is a complication from the
  way that GMX_MPI means "real MPI" for most of CMake and "real or
  thread MPI" in the source code; that is managed by GMX_THREAD_MPI=ON
  causing GMX_MPI=ON at a certain point. To cope with this, we add the
  "_mpi" suffix in response to GMX_LIB_MPI=on, which is how things
  should have been done back when GMX_MPI was co-opted, except that
  the suffixing was probably being done too early... Altogether, this
  change means that real-MPI binaries are always built with the _mpi
  suffix, like users have come to expect.
* Added compiler suppression for a useless information message that
  is otherwise issued for almost every source file
* Made the C and CXX platform files identical; I'd originally
  thought they could be combined on the command line, but
  that is not true

Change-Id: I26cb782a1b47cf48f47b80ec8c8d0a53db338872
introduced nbnxn data structure for bounding boxes

The nbnxn search code now uses a well organized bounding box data
structure instead of a complicated indexed plain float array
for the cluster bounding boxes.

Change-Id: Ia5adf2d33d495cff3178ca950e8c16aefcfef1fb
Fix detection and suggestion in gmx_cpuid for IBM QPX

Also made some variable names more descriptive.

Change-Id: I0eaac7ff6ce5cb0da82d9c54d10c555850a3dad1
Split up Verlet SIMD kernels for faster compilation

Each kernel is now defined in a seperate compilation unit, and the
files for the kernel functions, the kernel dispatcher function, and
their definitions are all generated by Python script. See its comments
for details. The generation is done by developers and the results
stored in the repo, to avoid CMake-time dependencies. The source for
the file generation is separated from the results of the generation.

On a 48-core AMD machine using GCC 4.7 for an SSE2 build (i.e. 4xN
Verlet kernels), the time for "make mdrun -j" went from 73 s to 34 s.

On a more recent 8-core Intel machine using GCC 4.6.4 for AVX_256
build (both 2xNN and 4xN), the time for "make mdrun -j" went from
81 s to 63 s.

On 16 cores of a POWER7 BlueGene/Q front-end node, time to compile
release-4-6 stays about the same (around 160s).

Also unwound some include file dependencies and removed repeated
definitions of some supporting structures and functions.

Change-Id: I0da1faf351defbe68d5ca43febcabddd93e21f0d
Set upper case of FFTW variable at the right place.

Fixes #1327

Change-Id: Ie9ef1fffceefef7d46f1e7a5a8ca3ceb22a81854
AbstractAnalysisData module handling into a separate class.

Move all logic related to maintaining the list of attached modules,
checking their compatibility with the data, and notifying them from
AbstractAnalysisData into a separate AnalysisDataModuleManager class.
AbstractAnalysisData now contains an instance of this class, and
provires a moduleManager() protected method for derived classes to
access it.

Module notification methods are no longer responsible of keeping the
frame count.  Instead, made the frameCount() method pure virtual and
added a method in AnalysisDataStorage to conveniently implement this
method.

Moved the responsibility of calling all data notification methods into
AnalysisDataStorage (including notifyDataStart() and
notifyDataFinish()). This allows modules that use AnalysisDataStorage to
not even know of the implementation details of the module manager.

Improved the semantics of setColumnCount() etc. such that they now
immediately check the compatibility of data modules and throw if there
is a problem.

Rationale:
 - Remove implementation details from the installed abstractdata.h
   header: AbstractAnalysisData is one of the main public interfaces in
   the module, and it exposed unnecessary complexity in the header. Now
   only the subclasses that actually need it see these details.
   In particular with #869, the module notification interface is only
   going to get more complex.
 - Reduce the responsibilities of AbstractAnalysisData: now it only
   keeps track of the dimensionality of the data (and notifies the
   module manager of relevant changes). Now it is closer to a pure
   interface, which is possibly should be.
 - Makes it possible to remove friendship between AbstractAnalysisData
   and AnalysisDataStorage. This allows further simplification in
   datastorage.cpp.

Related to #869.

Change-Id: Ic42d4b27bb6d1e445e3f74aa06ae52b354bf4403
Support for parallel data modules.

Main changes:
 - Add parallelDataStarted() to AnalysisDataModuleInterface to
   initialize modules for parallel processing of data.  If this method
   is called, and the module returns true, then the module accepts that
   frame notification methods can be called in relaxed order: the frames
   can be started in any order, and multiple frames may be active
   simultaneously.
 - Implement this method in the existing modules, either explicitly or
   by using convenience base classes.
 - Add notification methods to AnalysisDataModuleManager to notify
   parallel frames.  These methods are called as soon as the data is
   available to notify those modules that accept parallel data.
   Existing methods were changed to only notify the serial modules.
 - Make AnalysisDataStorage call the new notification methods
   appropriately.  In most cases, this absorbs the complexity that these
   new methods bring.
 - Update (part of) the unit tests to make it possible to test this
   relaxed frame ordering.

Part of #869.

Change-Id: I3cccf78a09221b8181c3d8b217a793c996d0c522
Move gmx_ana_pos_t::g into gmx_ana_indexmap_t.

Instead of storing a gmx_ana_index_t structure by reference in the
positions, embed this information in the index mapping structure, as
that is really what it is required for.  This localizes the
responsibility of maintaining that state better, and allows removing
code that was there just to provide such an artificial group structure.
The logic still remains mostly the same: the array of atoms is still
stored by reference instead of copying where possible.

This also makes it simpler to handle cases where the output atoms from
the mapping would actually not equal the input group (e.g., that they
would need to be in a different order).

Prerequisite for #1221.

Change-Id: I9e3e0455d1129fd6c3dd8056b2f088114764f331
Remove gmx_ana_indexmap_t::bMapStatic.

This state can be deduced from other variables in the structure,
removing duplicate state and simplifying the code.

Change-Id: Ia0d90ca544184e2af15a321c447f688d864b1d8d
Remove duplicate .nr members from selection structs.

gmx_ana_indexmap_t::nr and gmx_ana_pos_t::nr were leftovers from C times
when these structures were directly exposed to user tools, and the
number of positions was provided as convenience in these members.
Both duplicated the value of (m.)mapb.nr.

Change-Id: If5211d7b513eb3ebcd87d4293d19c19c78952564