alexxy/gromacs.git
9 years agoImprove analysis nbsearch grid mapping
Teemu Murtola [Sat, 23 Aug 2014 03:27:24 +0000 (06:27 +0300)]
Improve analysis nbsearch grid mapping

Now the analysis neighborhood search implements its own version of
put_atoms_in_triclinic_unitcell().  While computing the index of the
correct grid cell, it is relatively easy to produce also the coordinates
that lay within that cell instead of using a separate call.  This
provides two benefits:
 - It avoids rare rounding problems if put_atoms_in_triclinic_unitcell()
   would put the atom right at the edge of the box, but the mapping code
   would consider it outside the box, causing out-of-range grid cell
   index to be generated.
 - It allows to customize the grid mapping more freely (e.g., to create
   grids that are not periodic).

Change-Id: Ib7602fa49a1b8f7882a63843322786b3e51e8e32

9 years agoMove -nice handling to CommandLineModuleManager
Teemu Murtola [Fri, 22 Aug 2014 04:02:55 +0000 (07:02 +0300)]
Move -nice handling to CommandLineModuleManager

Now also the tools written using the C++ framework support the -nice
command-line option.  The system also behaves more consistently, as now
all programs except mdrun and gmx-view default to -nice 19.  Previously,
there was no really consistent logic for where PCA_BE_NICE was set and
where not.

Remove PCA_BE_NICE as it is no longer used.  parse_common_args() no
longer has any options that it unconditionally adds, which completes one
step in full migration to the wrapper binary.

Change-Id: I35a464d3263bc20e98ad1d381e93fdc2749931a2

9 years agoFix mis-use of fabs in LAPACK
Mark Abraham [Wed, 20 Aug 2014 08:20:21 +0000 (10:20 +0200)]
Fix mis-use of fabs in LAPACK

clang-3.5 warns that fabs is not the right approach.

Change-Id: Ib7125fcad2f4fda99abf7b67f296f24d84cb34be

9 years agoMisc. gmxpre.h-related changes
Teemu Murtola [Wed, 20 Aug 2014 19:13:17 +0000 (22:13 +0300)]
Misc. gmxpre.h-related changes

Related to selection parser generated files:
- Add gmxpre.h to the generated selection parser files. parser.cpp and
  parser.h are now generated with a newer bison version, since that is
  what I happened to have available.
- Minor improvements to the regeneration script.

Related to the doc-check target:
- Make the doc-check target happy again by removing a check that is not
  valid in the current state.  Minor clean-up in the script.
- Add a checker for the presence of gmxpre.h in all files where it is
  expected to appear.
- Move one suppression from config.h to gmxpre.h, since that is where
  the code now is.
- Use consistent #include "config.h" in vec.h and remove blanket
  suppression for that issue in doc-check.

Change-Id: I1e803ef000c5b2c685532c9e47df534ef5b263bc

9 years agoMerge release-5-0 into master
Teemu Murtola [Wed, 20 Aug 2014 18:03:25 +0000 (21:03 +0300)]
Merge release-5-0 into master

Conflicts:
  src/gromacs/legacyheaders/types/simple.h
    - applied gmx_unused change to basedefinitions.h
  src/gromacs/mdlib/sim_util.c
    - took adjacent changes from both branches

Change-Id: I42071be546015ede33b03a34ef0d95a5d5a3b09e

9 years agoAdd _GNU_SOURCE=1 to find clone() with PGI
Erik Lindahl [Fri, 8 Aug 2014 20:36:48 +0000 (22:36 +0200)]
Add _GNU_SOURCE=1 to find clone() with PGI

The PGI C++ compiler would not find clone()
in sched.h unless _GNU_SOURCE is set, and
it shouldn't hurt any other platforms if
we add it by default for gmock.

Change-Id: Id9446622bb49e17efd80ea1508e0ee40b48acdbe

9 years agoChange error to warning for missing OMP_NUM_THREADS
Roland Schulz [Wed, 16 Jul 2014 01:45:49 +0000 (21:45 -0400)]
Change error to warning for missing OMP_NUM_THREADS

Setting the default number of OpenMP threads using -ntomp works too. Using ntomp
allows to use the regressiontests. A proper fix should be done in master because
it requires larger code changes.

Change-Id: Ic47cebc9da6cf1b0624a1383d7ce23f93bd26dbe

9 years agoFix matrix pointer dereference bug in update.c
Erik Lindahl [Tue, 12 Aug 2014 18:11:40 +0000 (20:11 +0200)]
Fix matrix pointer dereference bug in update.c

The PGI compiler found a bug where an if-statement
checked against a dereferenced pointer rather than
the pointer itself being non-NULL.

Change-Id: If08977b818f28e1c78c35222d0f4efe6ae6aad65

9 years agoEnable SIMD register calling convention with gmx_simdcall
Erik Lindahl [Mon, 28 Jul 2014 18:33:42 +0000 (20:33 +0200)]
Enable SIMD register calling convention with gmx_simdcall

Cmake now checks if the compiler supports __vectorcall or
__regcall calling convention modifiers, and sets gmx_simdcall
to one of these if supported, otherwise a blank string.
This should enable 32-bit MSVC to accept our SIMD routines
(starting from MSVC 2013), and with ICC it can at least in
theory improve performance slightly by using more registers
for argument passing in 64-bit mode too. Presently this is
only useful on x86, but the infrastructure will work if we
find similar calling conventions on other architectures.

Fixes #1541.

Change-Id: I7026fb4e1fb6b88c8aa18b060a631cbb80231cd4

9 years agoAdd cycle counters for 64-bit ARM
Erik Lindahl [Tue, 19 Aug 2014 12:29:57 +0000 (14:29 +0200)]
Add cycle counters for 64-bit ARM

The gcc code has been tested on actual ARM64
hardware, but the MSVC one is only implemented
from the MSVC manual.

Change-Id: I13aac4d65345c684b6ddc5812ca9c3fcbe27b81a

9 years agoShorten plugin configuration message
Erik Lindahl [Tue, 12 Aug 2014 13:04:59 +0000 (15:04 +0200)]
Shorten plugin configuration message

This is just a minor note, so make sure it fits in a
single line rather than drawing attention to itself.

Change-Id: I086f3a90fdcdb92aa5920c27cc9176bae8c9bce4

9 years agoRemove unused config.h defines
Teemu Murtola [Tue, 19 Aug 2014 03:05:01 +0000 (06:05 +0300)]
Remove unused config.h defines

These were orphaned in pre-4.6 times, with an argument that an
architecture may appear where these may be necessary.  Since that has
not happened in two years, and the whole group kernels are scheduled for
removal, it is unlikely they ever get used again, either.

Change-Id: Ie8e9c12110a889d9b1ed80125feb1ab7de4483cc

9 years agoIntroduce gmxpre.h for truly global definitions
Teemu Murtola [Mon, 18 Aug 2014 18:50:38 +0000 (21:50 +0300)]
Introduce gmxpre.h for truly global definitions

Bulk of the changes is done by applying an awk script using
  admin/reformat_all.sh --filter=copyright \
      --pattern=src/\*.{cpp,cu,c} list-files | xargs add_gmxpre.h
where add_gmxpre.h contains
  #!/bin/bash
  for f in "$@" ; do
    awk 'BEGIN {add=1}
         /gmxpre\.h/ {add=0}
         /#include/ {if (add) print "#include \"gmxpre.h\"\n"; add=0}
         {print}' $f >$f.tmp
    mv $f.tmp $f
  done
In other words, by adding a gmxpre.h include before the first #include
statement.

Manual changes on top of that:
 - Adapt reformat_all.sh to support the --pattern option used above.
 - Manually edit the files directly under src/ to move some necessary
   defines from config.h to gmxpre.h, and to adapt the build system to
   generate the latter.
 - Move the inserted include outside the HAVE_CONFIG_H #ifdef in
   gmx_cpuid.c.
 - Adapt nbnxn kernel generator files to insert the #include at the
   proper place and regenerate the kernels.
 - Adapt group kernel generators to insert the #include at the proper
   place, and remove unnecessary include guards from generated _source_
   files.

Adaptation for scanner.l and parser.y in the selection code will come
later, together with a checker that checks that gmxpre.h is actually
included everywhere.

Motivation for the change is documented in the file comment for
gmxpre.h.  This file could potentially be used also for precompiled
headers to speed up the build, but that would require a lot more effort
than this...

Change-Id: I02f08c6765dd7179ce9db135b2d502172700f180

9 years agoFix nbnxn templates
Roland Schulz [Mon, 18 Aug 2014 06:47:09 +0000 (02:47 -0400)]
Fix nbnxn templates

Change 6400ed5de8 changed the generated files without changing
the template.

Change-Id: If42909a59d25a4e866de6af8874157b23c781128

9 years agoAdd Intel command line warning
Roland Schulz [Mon, 18 Aug 2014 00:36:05 +0000 (20:36 -0400)]
Add Intel command line warning

Fixes that build was printing a warning for scanner.cpp.

Related to #1483

Change-Id: I8a30fce82ab7ef0bfe735630b1ce4d9bb636b36d

9 years agoRemove check that auto-generated files exist
Roland Schulz [Sat, 16 Aug 2014 21:21:21 +0000 (17:21 -0400)]
Remove check that auto-generated files exist

The check is redundant because we check in cpack that all files
are available.

Change-Id: I8ccd37ac1b4b4225b389711c7fb7f2bb0e473f78

9 years agoFix Portland compiler warnings
Erik Lindahl [Mon, 11 Aug 2014 13:27:53 +0000 (15:27 +0200)]
Fix Portland compiler warnings

The PGI compiler finds several unreachable code
parts, mainly due to multiple return statements
being used. For most places this is just a
cosmetic fix to get rid of warnings, but functions
that are performance-sensitive should only have
a single return statement since the return
instruction causes a pipeline stall on many
architectures. This patch also fixes a warning
about an unused variable.

Change-Id: Ibf1c9e9dd1cdf29fc59c84afa4348e02bed270e6

9 years agoHalved the cost of the pull communication
Berk Hess [Mon, 11 Aug 2014 16:11:17 +0000 (18:11 +0200)]
Halved the cost of the pull communication

With DD the PBC reference coordinates are now only communicated
after DD repartitioning. This reduces the number of MPI_alltoall
calls from 2 to 1 per step, which can significantly improve
performance at high parallelization.

Added a cycle counter for pull potential.

Added checks for zero pull vectors to avoid div by 0.

Change-Id: Ib89ba9e14eaa887f59a5087135580bc29a20d7d0

9 years agoDon't build tests until they are run
Roland Schulz [Thu, 7 Aug 2014 23:04:12 +0000 (19:04 -0400)]
Don't build tests until they are run

There is no advantage to normal users, to build the tests until the
user decides to run them. Also avoids that the user thinks that
Gromacs doesn't compile on his platform if there is only a problem
with the testing framework.

Added a GMX_DEVELOPER_BUILD option which restores the old behavior.

Change-Id: Ifda2184eb45bf58b8798f21a29aea19bef57c690

9 years agoUse full path for legacyheaders
Roland Schulz [Fri, 25 Jul 2014 05:08:01 +0000 (01:08 -0400)]
Use full path for legacyheaders

Advantages:
simpler to setup tooling / IDE (just one path)
show immediately all usage of legacyheaders
No risk of accidentally working includes (together with using relative paths)

Used:
find src/gromacs/ src/programs/ src/testutils/ -name '*.c' -o -name '*.cpp' \
   -o -name '*.h' -o -name '*.cu' -o -name '*.cuh' -o -name '*.pre'|
   xargs -n1 python makeabspath.py

Manual changes to cmake and doxygen files to remove legacyheader include path.

makeabspath.py:
https://gist.github.com/rolandschulz/ee636f517d75e48bc68c

Related to #1557.

Change-Id: I6c1b51a573acfe7b0123485405f2494e97715f53

9 years agoRemove mdrun -seppot
Mark Abraham [Sat, 31 May 2014 17:43:09 +0000 (19:43 +0200)]
Remove mdrun -seppot

This output of rank-local energies is not needed for any routine use,
and isn't much use in mdrun -debug either. Removing it simplifies a
few code paths, including removing some dependencies on writing sane
things to the log file. Eliminated some now-unused parameters.

Refs #1292

Change-Id: I7628b78862144ae2478b6f42a6818915e3a22fe3

9 years agoFix gmx tune_pme with LJ-PME
Mark Abraham [Tue, 8 Jul 2014 20:39:52 +0000 (22:39 +0200)]
Fix gmx tune_pme with LJ-PME

Extend the range of vdwtype for which tune_pme will scale rvdw. This
makes tune_pme worth using with LJ-PME.

Change-Id: Iec702ae984cd062d47970380c0ca41f82e4c31d2

9 years agoFix wallcycle counting with md-vv, sd and sd2
Mark Abraham [Wed, 9 Jul 2014 20:36:31 +0000 (22:36 +0200)]
Fix wallcycle counting with md-vv, sd and sd2

Previously the coordinate update for the first half of velocity Verlet
and (where applicable) the second half of the SD integrators was left
out of the walltime accounting, and showed up in the "Rest"
section. With this fix, the number of "update" steps reported depends
on exactly which flavour of which integrator is in use, because
there's also some number of calls to do constraining and/or energy
communication. Those numbers vary with either the flavour of
integrator, or the number of iterations MTTK actually needs.

Change-Id: Ib294455b7277caf89018c413d6c1c0ebf93c6ddb

9 years agoDisable analysisdata generic tests if not compilable
Teemu Murtola [Fri, 8 Aug 2014 04:07:19 +0000 (07:07 +0300)]
Disable analysisdata generic tests if not compilable

If Google Test claims that typed tests are not supported, exclude the
analysisdata generic tests that use this functionality from compilation
(since they wouldn't compile).  Instead, add a dummy test that at least
shows a developer who runs the unit test executable directly that
something is missing (the ctest run still passes without any messages).

Change-Id: Iba9bcc4b993e5213fe48e24d52b09474e5801fa8

9 years agoMerge release-5-0 into master
Roland Schulz [Sat, 16 Aug 2014 04:30:10 +0000 (00:30 -0400)]
Merge release-5-0 into master

Conflicts (trivial):
src/gromacs/commandline/pargs.cpp
src/gromacs/gmxlib/gmx_thread_affinity.c
src/gromacs/options/filenameoption.cpp

Manual changes required for ConstArrayRef:
       src/gromacs/commandline/pargs.cpp
       src/gromacs/options/filenameoption.cpp
       src/gromacs/selection/selection.cpp
       src/gromacs/selection/tests/nbsearch.cpp
Manual moved REGRESSIONTEST_MD5SUM from
       CMakeLists.txt to cmake/gmxVersionInfo.cmake

Change-Id: I1a2038f72c1e1cfed830de5c540ab278dbb39cfe

9 years agoCorrected SIMD math overflow documentation
Berk Hess [Mon, 11 Aug 2014 12:26:22 +0000 (14:26 +0200)]
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

9 years agoFix CMake package config after recent version changes
Teemu Murtola [Thu, 14 Aug 2014 03:05:55 +0000 (06:05 +0300)]
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

9 years agoUse native CMake mechanism for find_package(GROMACS)
Teemu Murtola [Sun, 6 Jul 2014 03:51:04 +0000 (06:51 +0300)]
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

9 years agoReorganize CMake version information management
Teemu Murtola [Mon, 28 Jul 2014 04:08:19 +0000 (07:08 +0300)]
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

9 years agoMove some verlet headers to mdlib
Roland Schulz [Tue, 20 May 2014 04:56:53 +0000 (00:56 -0400)]
Move some verlet headers to mdlib

This change does removes all dependencies on those (explicit) types
from files outside of mdlib (the only one were in programs/mdrun).

Change-Id: Ia2b90303249e3e7454ac869afb5cbe0cf290a400

9 years agoAdd depressing quote
Mark Abraham [Wed, 6 Aug 2014 18:57:09 +0000 (20:57 +0200)]
Add depressing quote

Change-Id: I5a66e0f90119544b4b876c273b4a678404bd4dbe

9 years agoMake internal BLAS/LAPACK messages less noisy
Erik Lindahl [Sun, 10 Aug 2014 23:24:26 +0000 (01:24 +0200)]
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

9 years agoImprove Gromacs portability
Erik Lindahl [Wed, 30 Jul 2014 12:34:32 +0000 (14:34 +0200)]
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

9 years agoReplace __LP64__ with check for pointer size
Erik Lindahl [Fri, 8 Aug 2014 21:37:49 +0000 (23:37 +0200)]
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

9 years agoAdded checks for TPI + Verlet scheme
Berk Hess [Wed, 30 Jul 2014 12:59:17 +0000 (14:59 +0200)]
Added checks for TPI + Verlet scheme

Change-Id: I040f4cc9dbb8ff25ed97d18cca0b4a2c1e7014b0

9 years agoCheck MD5sum for regressiontest
Roland Schulz [Tue, 5 Aug 2014 02:05:04 +0000 (22:05 -0400)]
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

9 years agoImprove initAfterFirstFrame() usability
Teemu Murtola [Sun, 10 Aug 2014 04:24:06 +0000 (07:24 +0300)]
Improve initAfterFirstFrame() usability

The initAnalysis() function was changed a long time ago to take the
analysis settings as a parameter, to make it easy to use those values in
initialization without storing them in local variables.
Do the same for initAfterFirstFrame(), now that there is a tool in
pipeline (gmx rdf) that would actually use this function and sees the
same issue there.

Change-Id: Ib10abb3790ac5472070edc76155cfa50cce96541

9 years agoMake vec.h const-correct with both C and C++
Teemu Murtola [Sun, 10 Aug 2014 04:17:20 +0000 (07:17 +0300)]
Make vec.h const-correct with both C and C++

C and C++ have different semantics for const if a function parameter has
multiple indirections (e.g., a double pointer or a 2D array).  If such a
parameter is not modified by the function, it is tricky to write
const-correct code using such functions:
 - If the parameter is declared const, then C will give a warning if a
   non-const value is passed.
 - If the parameter is not declared const, then C++ will give an error
   if a const value is passed.
Added a macro that allows using a single declaration in vec.h for
functions that take matrix values as input parameters, and still making
it possible to pass both non-const and const values to such parameters
in both C and C++.

Change-Id: Ifca3ff6842489c3a1040a8261ba429d96409fc21

9 years agoBasic exclusion support for analysis nbsearch
Teemu Murtola [Sat, 9 Aug 2014 04:21:44 +0000 (07:21 +0300)]
Basic exclusion support for analysis nbsearch

Add support for setting exclusions for AnalysisNeighborhood-based
searches.  Required for some functionality in gmx rdf, and the interface
is focused on satisfying that need.  Efficiency could potentially be
improved, as well as sanity checks on the input.  Now that the basic
machinery is there, it can be extended and the implementation improved
without hopefully affecting calling code significantly.

Change-Id: Ia667ee61ed1bb3d1171c22d7752f22517b3ccda8

9 years agoMerge release-4-6 into release-5-0
Roland Schulz [Sun, 10 Aug 2014 01:59:35 +0000 (21:59 -0400)]
Merge release-4-6 into release-5-0

Conflicts:
CMakeLists.txt (version bump ignored)

Change-Id: I4ba0209b5f69b6470470530662a0b27390a02771

9 years agoAdd Selection::hasOnlyAtoms()
Teemu Murtola [Sat, 9 Aug 2014 04:19:56 +0000 (07:19 +0300)]
Add Selection::hasOnlyAtoms()

Add a convenience function for checking whether a selection consists of
atom positions only.  This will be useful for analysis tools that may
only support atom positions with some combination of options, leads
to clearer code than checking type() == INDEX_ATOM, and exposes less
internal implementation details.

Change-Id: Iaa2d0bfa2f567c060f6b006d423c2910ffd46a69

9 years agoFix portability issue with ArrayRef initializer overloading
Erik Lindahl [Wed, 30 Jul 2014 12:46:57 +0000 (14:46 +0200)]
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

9 years agoChanged names of test files to avoid Fujitsu compiler bug
Erik Lindahl [Tue, 5 Aug 2014 10:15:39 +0000 (12:15 +0200)]
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

9 years agoBasic support for 2D neighborhood search for analysis
Teemu Murtola [Sun, 3 Aug 2014 04:27:36 +0000 (07:27 +0300)]
Basic support for 2D neighborhood search for analysis

Add support for doing a neighborhood search based on distances in the
X-Y plane into the analysis neighborhood search routines.  The basic
logic is lifted from 'gmx rdf -xy' and made a bit more general.

Currently, only basic searching is implemented, but grid-based should
not be too difficult either.  Later implementation of a grid-based
search should be transparent to callers.

Change-Id: I635d7f7a5eb0136d7a3a4c968ddaa34b03ae3bc7

9 years agoFix hang with LJ-PME and empty domains
Berk Hess [Mon, 4 Aug 2014 12:18:36 +0000 (14:18 +0200)]
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

9 years agoWorkaround for ICC 14
Roland Schulz [Tue, 29 Jul 2014 23:37:19 +0000 (19:37 -0400)]
Workaround for ICC 14

Problem was only present with BUILD_SHARED_LIBS=no

Change-Id: Ieb4377d819aa5eff3d139cdbe55775989118a738

9 years agoVerify MD5 sum for FFTW download
Teemu Murtola [Sun, 3 Aug 2014 14:32:31 +0000 (17:32 +0300)]
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

9 years agoCheck frame atom count before evaluating selections
Teemu Murtola [Sun, 3 Aug 2014 04:16:54 +0000 (07:16 +0300)]
Check frame atom count before evaluating selections

Several tools work even if passed a trajectory that only contains a
subset of the atoms specified in the topology.  The selections work as
well, provided that the selections don't need to access other atoms.
It may be a bit unclear what the selections need for evaluation, though.
Now the selections report an error if the trajectory does not contain
the necessary atoms; previously, it would most likely just crash.
I'm not 100% sure that the check catches all possible cases, but at
least for the majority of the cases it will provide significantly better
feedback.

Currently, it is only possible to pass the first N atoms, as supporting
anything else would require significant changes elsewhere as well, but
the check itself would be straightforward to adapt if the implementation
gets otherwise done (just replace the std::max operations with unions).

Change-Id: I5d9bf68567ba8634bb81b82a6833c0d398a40bdb

9 years agoFixed PME bug with high OpenMP thread count
Berk Hess [Sat, 2 Aug 2014 08:53:31 +0000 (10:53 +0200)]
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

9 years agoAdded tests for denormal and underflow for simd exp()
Erik Lindahl [Thu, 31 Jul 2014 14:32:30 +0000 (16:32 +0200)]
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

9 years agoMerge "Merge release-5-0 into master"
Teemu Murtola [Thu, 31 Jul 2014 17:57:12 +0000 (19:57 +0200)]
Merge "Merge release-5-0 into master"

9 years agoReplace most strdup with gmx_strdup
Roland Schulz [Mon, 7 Jul 2014 21:44:28 +0000 (17:44 -0400)]
Replace most strdup with gmx_strdup

gmx_strdup existed but code was using a mixture of it and strdup.
Advantages of using gmx_strudup everywhere:
- consistency
- error handling for out of memory
- strdup might not be available (e.g. Cygwin)

Left strdup in testutils which had already error handling. And fatalerror.cpp
which cannot use gmx_strdup because it could lead to an infinite loop.

If all strdup are removed gnu++0x in gmxTestCXX11.cmake is not required
anymore.

Change-Id: I6ed3e17e34b833b01222d4b45c680db7aadada34

9 years agoMerge release-5-0 into master
Roland Schulz [Thu, 31 Jul 2014 16:23:51 +0000 (12:23 -0400)]
Merge release-5-0 into master

Change-Id: Ifc6c3180fe5803bc9a23a0be84be7c93ecb7f472

9 years agoAvoid division by 0 in nbnxn_search
Berk Hess [Thu, 31 Jul 2014 11:08:34 +0000 (13:08 +0200)]
Avoid division by 0 in nbnxn_search

Note that this issue did not affect any results.

Change-Id: I3c454783484c416b50808b9512e14072cb749784

9 years agoConverted md_support.c to C++
Mark Abraham [Thu, 24 Jul 2014 14:34:04 +0000 (16:34 +0200)]
Converted md_support.c to C++

Removed some unused variables. Converted min to std::min.
Added some static_cast<int> to keep gcc-4.1 happy.

Change-Id: I45823c40a0058a74469d8da1f95a0c65fe6c602c

9 years agoFix overflow in LJ-PME nbnxn kernels
Christian Wennberg [Mon, 28 Jul 2014 16:06:36 +0000 (18:06 +0200)]
Fix overflow in LJ-PME nbnxn kernels

The SIMD exp function in the LJ-PME nbnxn kernels could overflow
for pair distances far beyond the cut-off. Added a mask to avoid this.

Fixes #1552

Change-Id: Id87710f3815b341f53a69df0a2990d0bb4edfa74

9 years agoMerge "Merge release-5-0 into master"
Roland Schulz [Mon, 28 Jul 2014 19:05:08 +0000 (21:05 +0200)]
Merge "Merge release-5-0 into master"

9 years agoMerge release-5-0 into master
Roland Schulz [Mon, 28 Jul 2014 17:32:04 +0000 (13:32 -0400)]
Merge release-5-0 into master

Conflicts:
    src/testutils/refdata.h (trivial)

Manual changes:
    src/external/Random123-1.08/include/Random123/features/compilerfeatures.h
        replaced simple.h with basedefintions.h

Change-Id: I96fbc370b1c6bec101d877b2e3bda1adec56fcb6

9 years agoFix build of binary package
Roland Schulz [Fri, 25 Jul 2014 22:36:17 +0000 (18:36 -0400)]
Fix build of binary package

Commit a00437 accidentally changed that the source-package error is also
printed for binary packages. Because it defined
CPACK_SOURCE_PACKAGE_FILE_NAME which we used to detect source-package.
This now uses CPACK_INSTALL_CMAKE_PROJECTS which is hopefully future-proof.
It also adds a proper warning for binary packages.

Change-Id: I842655755bed1c448f30db435a85ad1ca5844a60

9 years agoAdd unit test for random/Threefry
Roland Schulz [Tue, 1 Jul 2014 08:54:42 +0000 (04:54 -0400)]
Add unit test for random/Threefry

Change-Id: I5f9d60c594c0d7a6925b829658119d2fdea5d113

9 years agoRemove Random123/features
Roland Schulz [Tue, 1 Jul 2014 10:35:53 +0000 (06:35 -0400)]
Remove Random123/features

Remove all auto-detection and replace with hard-coded
values and gmx_inline.

The purpose is that it now should compile on any hardware /
compiler. Correctness is guaranteed (as is custom in all
of Gromacs) by unit tests (separate commit).

Change-Id: I7e75ff38f7288e87817d42582ae844c1d38ef369

9 years agoRemove individual cuda libraries
Roland Schulz [Mon, 7 Jul 2014 01:14:45 +0000 (21:14 -0400)]
Remove individual cuda libraries

Instead use CUDA_ADD_LIBRARY to build libgromacs. It builds all
non CUDA files using the standard build rules. Thus this should not
have any effect on non CUDA files. All CUDA files were compiled
with the same nvcc OPTIONS, and thus nothing should have changed
for them either.

This also removes the requirement for gmxManageNvccConfig to set
fPIC manually because now CUDA_ADD_LIBRARY knows when the library
is shared.

Change-Id: I23fe6b7a9766a39c525cdc1abfa3922ec24058d9

9 years agoRemove memtest
Roland Schulz [Wed, 9 Jul 2014 00:38:19 +0000 (20:38 -0400)]
Remove memtest

Native GPU acceleration isn't using it and OpenMM has been removed.

Change-Id: I9c657d37654b3a822ff980b5e28e5158fd52884b

9 years agoFix selection of xtc groups not starting at index 0
Erik Lindahl [Sun, 27 Jul 2014 08:54:33 +0000 (10:54 +0200)]
Fix selection of xtc groups not starting at index 0

The code to select atoms to write to the xtc file
only looped over the number of atoms selected for
output rather than all atoms. This meant that xtc
group selections that were not located at the start
of the atom indices would not be written correctly.

Fixes #1561.

Change-Id: I48886a75c682e38122dadcb2f752507b14b308fe

9 years agoWorkaround for ICC 14 bug
Roland Schulz [Sun, 13 Jul 2014 00:34:41 +0000 (20:34 -0400)]
Workaround for ICC 14 bug

ICC name-mangling is incorrect for static variable in static
member in anonymous namespace.

Fixes #1558

Change-Id: Ie861224bcc61df2f26025d1dd106bcab827308bb

9 years agoFix Cygwin+Shared-Libs+FFTW
Roland Schulz [Thu, 10 Jul 2014 01:11:50 +0000 (21:11 -0400)]
Fix Cygwin+Shared-Libs+FFTW

Cygwin doesn't have or require fPIC

Change-Id: If1af6f070e2cd0457f429a155e92014af51c0c33

9 years agoDo not actually install uniqueptr.h
Teemu Murtola [Thu, 24 Jul 2014 03:29:49 +0000 (06:29 +0300)]
Do not actually install uniqueptr.h

Due to some rebasing error or something, 22d74432 unintentionally undid
the change in 1078df1d.

Change-Id: Icabe61112b98229bc4e5e13462892b9f5a584d8b

9 years agoAdd support for int64 in refdata
Roland Schulz [Tue, 1 Jul 2014 08:53:53 +0000 (04:53 -0400)]
Add support for int64 in refdata

Change-Id: Ia5fedbe7593d9630a095eaf1cb6d69f0c1223ee0

9 years agoFix GMX_BUILD_OWN_FFTW for Cygwin
Roland Schulz [Tue, 22 Jul 2014 03:35:00 +0000 (23:35 -0400)]
Fix GMX_BUILD_OWN_FFTW for Cygwin

CMAKE_BINARY_PREFIX doesn't exist and thus the previous version added just
an extra slash which doesn't work under Cygwin.

Change-Id: I285f93020d0818515fff3f2cfbf41662f03190d0

9 years agoFix GMX_NONBONDED_NUM_THREADS!=GMX_PAIRSEARCH_NUM_THREADS
Roland Schulz [Wed, 16 Jul 2014 00:13:01 +0000 (20:13 -0400)]
Fix GMX_NONBONDED_NUM_THREADS!=GMX_PAIRSEARCH_NUM_THREADS

Change-Id: I7d5416fa299e244244d7bf48e785090da2e0b6d0

9 years agoQuiet gcc-4.8 warnings about unused results
Mark Abraham [Sun, 6 Jul 2014 16:52:23 +0000 (18:52 +0200)]
Quiet gcc-4.8 warnings about unused results

The warning -Wunused-result is on by default, so we'd like to deal
with those before adding routine testing to Jenkins with gcc-4.8.

Change-Id: I905d43e7fa50229b38d2d3d9e642372790f73899

9 years agoFix HTML help and man pages for commands with dashes
Teemu Murtola [Thu, 10 Jul 2014 03:39:59 +0000 (06:39 +0300)]
Fix HTML help and man pages for commands with dashes

Replace one case of "gmx-something" to "gmx something" conversion with
explicit construction of the latter from its component parts.
The other instance does not (easily) have the component parts available,
so only the first dash is removed when converting between
"gmx-something" and "gmx something". Add an assert for the condition
that this requires to remain functional.

Change-Id: I5bfbd1acae440af93b3b7b50a25d8782a7e60c8a

9 years agoAvoid clang/32 optimization affecting IEEE endian detection
Erik Lindahl [Sat, 12 Jul 2014 08:10:36 +0000 (10:10 +0200)]
Avoid clang/32 optimization affecting IEEE endian detection

This turns the detection code into a c++ file, moves the
structure to a global one and adds volatile specifiers.
This should hopefully prevent any standard-adhering
compiler from touching the data.

Change-Id: I6f4b86ddf6b0567655466e0877bb1ba39a45ce4e

9 years agoMake gmx_node_num/rank safer
Teemu Murtola [Wed, 9 Jul 2014 19:43:09 +0000 (22:43 +0300)]
Make gmx_node_num/rank safer

With real MPI, MPI_Init() is called as the first thing, but with
thread-MPI, MPI is "initialized" only much later, when the actual
threads are started.  But code between these two points may expect to be
able to check whether the current rank is the master and/or whether
there are other ranks, and try to use these functions for that.

Previously, for thread-MPI builds, they accessed invalid memory and
returned essentially random values if called between these two init
points.  Now they behave as if the single thread that is executing at
that time is the single master rank.

Also document the behavior in more detail.

Change-Id: Ia3bef9c5899c528e315fe1310bde970dfec68769

9 years agoMake AVX2 check more robust
Erik Lindahl [Fri, 11 Jul 2014 08:16:27 +0000 (10:16 +0200)]
Make AVX2 check more robust

Apparently the GNU assembler version 2.20 supported some
parts of AVX2 (in particular the FMA floating-point ops),
which caused our cmake test to pass. This patch changes
it to test the integer addition instead, which isn't
supported in as-2.20 in my tests.

Change-Id: I79e516639fc78d1590d306f486eb027962388543

9 years agoFix HTML links that contain file extensions
Teemu Murtola [Thu, 10 Jul 2014 10:57:32 +0000 (13:57 +0300)]
Fix HTML links that contain file extensions

- Consider '-' and '_' as part of a word when replacing links, so that
  convert-tpr and make_ndx are considered single words, and the
  extensions there are not converted into links.
- Do links.dat replacement before program links, so that the URL in the
  above program name links is not processed.

Change-Id: I0ce204d3adedc56e57c1e1cd150a63d21c442eab

9 years agoBump SOVERSION
Teemu Murtola [Thu, 10 Jul 2014 13:41:15 +0000 (16:41 +0300)]
Bump SOVERSION

There for sure have already been binary-incompatible changes in master
compared to 5.0, and there will be more.

Change-Id: I8522e8b140920e4c3123cb94ad62e760e3869043

9 years agoFix xml2 link check rerun
Roland Schulz [Thu, 10 Jul 2014 01:36:31 +0000 (21:36 -0400)]
Fix xml2 link check rerun

gmx_check_if_changed logic had a typo and thus check wasn't rerun
if LIBXML2_INCLUDE_DIR or LIBXML2_LIBRARIES changed.

Change-Id: I838f32fd6e9b62480acc4eafc4bf3d657477d09d

9 years agoName the tarball how we like it
Mark Abraham [Sat, 5 Jul 2014 22:25:11 +0000 (00:25 +0200)]
Name the tarball how we like it

This names the tarball and the top-level directory how
GROMACS usually does it. Previously, I'd been renaming
stuff manually.

Change-Id: I485c4a4c711064a3a0ca2343ec696375cbc3de96

9 years agoQuieten repeated cmake runs
Mark Abraham [Thu, 3 Jul 2014 14:30:04 +0000 (16:30 +0200)]
Quieten repeated cmake runs

We should not hassle the user about optional libraries that were not
found the first time. If the user wants to detect ones found in a
different place, then they can unset the relevant cache variables to
re-trigger detection and/or related output.

Change-Id: I266268dccc46da5b098d3d5640798cbee7ee6fd0

9 years agoAdd comments for code with race condition
Roland Schulz [Wed, 14 May 2014 22:28:00 +0000 (18:28 -0400)]
Add comments for code with race condition

Change-Id: I89faa979ad605c463097e842e1112b2a24adee09

9 years agoClean up gmx_header_config
Teemu Murtola [Wed, 9 Jul 2014 05:09:26 +0000 (08:09 +0300)]
Clean up gmx_header_config

- Remove some probably unnecessary uses for GMX_CYGWIN.
- Move GMX_CYGWIN to config.h as it is not used in installed headers
  (maybe it would be better to get rid of even the remaining uses in
  favor of some other mechanism).
- Remove gmx_header_config_gen.h and all complexity that supports it as
  there is nothing generated there any longer.
- GMX_NATIVE_WINDOWS could possibly be moved somewhere else, but
  currently it is only used in two headers, so possibly even better
  would be to just get rid of those two.

Closes #1454

Change-Id: Id27370a007eda30b7c803a3c14aa687d43555db8

9 years agoMerge release-5-0 into master
Teemu Murtola [Wed, 9 Jul 2014 05:02:21 +0000 (08:02 +0300)]
Merge release-5-0 into master

Conflicts:
cmake/gmxCFlags.cmake (adjacent changes)

Change-Id: I45088d7b5256613971b9926fc5fa50511a2ed743

9 years agoFix Cygwin build
Roland Schulz [Sun, 6 Jul 2014 04:40:14 +0000 (00:40 -0400)]
Fix Cygwin build

Doesn't work with AVX but I suspect this to be Cygwin's/GCC's fault.

GCC Bug 61730

Change-Id: I171e8414a8d65800804226034604a9973770bfdd

9 years agoRemove all unnecessary HAVE_CONFIG_H
Roland Schulz [Thu, 3 Jul 2014 02:43:32 +0000 (22:43 -0400)]
Remove all unnecessary HAVE_CONFIG_H

There is no reason to check for HAVE_CONFIG_H other than
in public headers. Left it in the one public header which used
it (gromacs/math/vec.h). Also didn't change thread_mpi.

Change-Id: I15237d3d2dc35a4087a04fc2fbde4a3cb05d2e59

9 years agoImprove module dependency graph layout
Teemu Murtola [Sat, 17 May 2014 05:06:08 +0000 (08:06 +0300)]
Improve module dependency graph layout

The suppressions for the cycle checker are now also used to mark those
suppressed dependencies invalid in the dependency graph, and ignore them
in the layout.  If all the cycles are suppressed in this way, the
dependency graph passed to dot is a DAG, which is what dot is designed
to lay out.  So the result is much better (and resembles the
dependencies more clearly, in particular if some thought is put into
which edge from a cycle is suppressed).

Change-Id: Ie4de368197939ec4613d599f51b940afc95dcd2d

9 years agoModule dependency cycle checker for 'doc-check'
Teemu Murtola [Sun, 20 Apr 2014 12:48:46 +0000 (15:48 +0300)]
Module dependency cycle checker for 'doc-check'

The doc-check script now also checks for cyclic dependencies between
subdirectories within libgromacs.  Currently, this reports 247 cycles,
out of which 210 contain a legacyheaders->swap edge.  Update the
documentation for the checker.

Add a separate suppression mechanism for cycles.  With some changes in
the way the cycles are reported, the existing suppression mechanism
could also have been used.  However, this separate mechanism allows the
same information used for layout of the dependency graph, such that the
ignored edges causing cycles are also ignored in the dependency ordering
of the modules.

Change-Id: I7b9ed3cd0d5ed05dee8902f96b2407a113f4b200

9 years agoMake IEEE754 check more robust
Erik Lindahl [Mon, 7 Jul 2014 11:43:58 +0000 (13:43 +0200)]
Make IEEE754 check more robust

This change should prevent compilers from
optimizing away the structure used for checking
strings in the binary by also using it to produce
a return values. There are now also clearer
warnings, and if IEEE754 cannot be detected we
fall by to using the OS versions of erf/erfc()
in double precision. Fixes compiles on Power7.

Change-Id: I8ed834d5b87baf33e03725d2ab93a60a76c34a12

9 years agoRemove PCA_QUIET
Teemu Murtola [Wed, 14 May 2014 18:37:35 +0000 (21:37 +0300)]
Remove PCA_QUIET

Instead of exposing this to all callers of parse_common_args(), make the
command-line runner only execute the module on the master node in the
case help is being printed.  It should be quite rare that anyone runs -h
with multiple nodes (which is the only case this nowadays affected), so
this doesn't need an extra flag that callers need to be aware of.

Change-Id: I0a0b76d358bd7db283e5244c49acbd4a40d7af6f

9 years agoAdditional index group checks for selections
Teemu Murtola [Fri, 27 Jun 2014 11:20:39 +0000 (14:20 +0300)]
Additional index group checks for selections

Now index groups provided to selections are checked more thoroughly, and
an error is given if a group references an atom index outside the
topology (or the maximum atom number in the absence of a topology).
Negative atom indices also trigger the same error.

Previously, such index groups were silently accepted (except for a
warning during reading for negative indices), and the out-of-range atoms
dropped from the selections.

Change-Id: Id7a024ed316920d9594454ae36f7b9bdd9a429fc

9 years agoClean up program name handling in oenv
Teemu Murtola [Sun, 22 Jun 2014 11:18:13 +0000 (14:18 +0300)]
Clean up program name handling in oenv

- Remove unused functions to access the program name and command line
  from oenv.
- Replace these with direct access to a ProgramContextInterface, and use
  that instead of the global program context instance in places where
  output_env_t is easily accessible.
- Replace some calls to ShortProgram() with an equivalent call in oenv
  for places where oenv is readily accessible.

Change-Id: I2e8bc8701b8217f51ed9936338e1e9c3c21bd8ba

9 years agoImprove FileNameOption error handling
Teemu Murtola [Sun, 11 May 2014 18:28:45 +0000 (21:28 +0300)]
Improve FileNameOption error handling

- Make FileNameOption check the presence of an input file for required
  input options, and give an informative error message if that is not
  the case.  This hopefully reduces confusion about the
  "File I/O error: topol.tpr" messages that are reported.
- Make FileNameOption check if the file name provided by the user for an
  input file exists, and if it does, only check that it is valid for
  fn2ftp() instead of overriding the user.  If the file name is not
  valid for the option, an informative error is given.
- Add a special mechanism for -multi and -multidir to avoid the check
  above, as well as all other file name completion (that was done
  earlier, but didn't really work as expected).  The same mechanism
  could also replace PCA_NOT_READ_NODE, if someone wants to make that
  work again.
- Move all logic that changes user input to something else or checks
  file system contents to FileNameOptionManager to make that more easily
  customizable.  FileNameOption without a manager now only checks that
  the file name has a recognized and valid type for the option.
- Expose the necessary functionality through FileNameOptionInfo to do
  the above.
- Split tests according to the above division of responsibilities, and
  add tests for most of the error paths.

There is very little code that remains the same in this change, so the
rewrite and move are combined.

The first bullet causes some changes in behavior if programs have
declared file name options with ffREAD, but don't actually use the input
always, but those are easy to fix when found.  This required changing
one existing test for pargs.cpp.

Change-Id: Iea2c60e5de35160cf1faf599afde99b9858e98c7

9 years agoMove GMX_CXX11 to config.h
Teemu Murtola [Mon, 7 Jul 2014 15:28:22 +0000 (18:28 +0300)]
Move GMX_CXX11 to config.h

Now that uniqueptr.h is not used by any installed header, do not install
it.  Move GMX_CXX11 that was used only by this file to config.h now that
config.h can be freely included in that file.

Part of #1454

Change-Id: Ie4c2f23057962f2dc1f96c309c10d5ce0c2c2a74

9 years agoRemove gmx_unique_ptr from options public headers
Teemu Murtola [Mon, 7 Jul 2014 04:59:38 +0000 (07:59 +0300)]
Remove gmx_unique_ptr from options public headers

There was a single factory function in the generic option interface that
created objects and passed ownership to the caller.  The implementation
for this method always follows the same pattern, and there only a single
caller, so it is easy to make it exception-safe while returning a plain
pointer.  As a side effect, it removes some boilerplate code from all
the implementations for this method.

There are more complicated alternatives that avoid the plain pointer,
based on creating a helper class that can only be forward declared in
the installed headers, but I don't think those are worth the extra code.

This removes the last use of gmx_unique_ptr in an installed header.

Part of #1454

Change-Id: I948973d32042d388341265d5db6efbbcf0f7db8f

9 years agoMake selections ignore \r in input
Teemu Murtola [Sun, 6 Jul 2014 04:04:57 +0000 (07:04 +0300)]
Make selections ignore \r in input

Now the selection engine treats \r (as well as various other space
characters) the same as a space.  Added a unit test for this.
There is an extra trailing space in some cases that may be more common
with \r\n than otherwise, but that is a separate, mostly cosmetic
issue.

Fixes #1555

Change-Id: I78dfe8e477133b98a98fecf1fad243262f9b30c8

9 years agoRemove selection help from SelectionCollection
Teemu Murtola [Mon, 7 Jul 2014 04:41:26 +0000 (07:41 +0300)]
Remove selection help from SelectionCollection

Instead, make the only caller outside the selection module to use
selhelp.h directly.  This is not significantly messier, and allows
removing one use of gmx_unique_ptr from an installed header.

To actually remove that instance, do not install helptopicinterface.h.
This has the added benefit that now the whole onlinehelp module is free
from public headers, making the interface cleaner.  Adjust doxygen
documentation accordingly.

Part of #1454

Change-Id: Ifb557da86fb0d422650029812d30cc6766730fb9

9 years agoChange some gmx_unique_ptr to shared_ptr in public headers
Teemu Murtola [Sun, 6 Jul 2014 19:46:13 +0000 (22:46 +0300)]
Change some gmx_unique_ptr to shared_ptr in public headers

Change "trivial" occurrences of gmx_unique_ptr to boost::shared_ptr in
cases where there is a simple factory or a sink function where the
ownership of the object passes in or out from the library.

The main advantages:
 - Removes GMX_CXX11 dependencies from installed headers.
 - Improves memory management, where the memory is deallocated in the
   same library/executable that allocated it (through the shared_ptr
   deleter that gets created during construction).
The only disadvantage is that this blurs the ownership of the objects
slightly.

There are only two other instances of gmx_unique_ptr left in installed
headers, and those should be relatively easy to remove as well with a
bit of refactoring.

Related to #1454.

Change-Id: I1f694b30e4f8129f5d010115c0968a444e927ca0

9 years agoRemove bOK from MD loop
Mark Abraham [Sun, 6 Jul 2014 11:15:00 +0000 (13:15 +0200)]
Remove bOK from MD loop

Berk hacked this off in 2002 and it hasn't been used since.

Change-Id: Ife0e0c7d2ceff922561cbf9f61db45061dda0f77

9 years agoMove -debug to cmdlinemodulemanager.cpp
Teemu Murtola [Sat, 21 Jun 2014 04:48:31 +0000 (07:48 +0300)]
Move -debug to cmdlinemodulemanager.cpp

Now the option can be used uniformly even for tools that do not call
parse_common_args().  The description is still mdrun-specific, though.
While at it, made it work without an explicit debug level: if only
-debug is provided without any value, the debug level defaults to 1.
Also made -hidden work for 'gmx -h', as there now is a hidden option
there.

Renamed some associated functions to start with a gmx_ prefix, and
reorder things in fatalerror.* so that debugging code is in a single
block, and functions are in the same order in both files.

Removed unused debug_level from oenv.  This probably needs a better
mechanism to control what is written to the debugging output.

Change-Id: I1526916356b545c56d9f601f121e6c4e581639eb

9 years agoMake doc-check pass again without warnings
Teemu Murtola [Tue, 8 Jul 2014 03:53:47 +0000 (06:53 +0300)]
Make doc-check pass again without warnings

The include path needs to be updated here as well for tng_io.

Change-Id: I747a00a607fa6df6638dddc24f009565ab923c50