alexxy/gromacs.git
7 years agoMerge branch release-2016
Teemu Murtola [Mon, 12 Dec 2016 19:39:12 +0000 (21:39 +0200)]
Merge branch release-2016

Conflicts:
    cmake/gmxVersionInfo.cmake

Add a suppression for Intel compiler warning in generated code in
scanner.cpp.

Change-Id: I3a6310c433a50202fbc76e53570a491bd3d06544

7 years agoMinor CMake cleanup & modernization
Teemu Murtola [Sun, 20 Nov 2016 08:02:25 +0000 (10:02 +0200)]
Minor CMake cleanup & modernization

- Our minimum CMake version now supports BYPRODUCTS for
  add_custom_target(), which allows simplification of
  gmxCustomCommandUtilities.cmake.
- Specify USES_TERMINAL for targets that provide status output for nicer
  usability with Ninja.
- Rely on add_custom_command() automatically marking its outputs as
  generated.
- Update the minimum required version for building the template to match
  the main project.
- Do not unnecessarily put regressiontests MD5 to the cache.
- Fix the branch used for regression tests download for git builds.

Change-Id: Iee9a7e67d694724ad79cce9801bea670ef2f94c8

7 years agoBuild scripts for improved release workflow
Teemu Murtola [Thu, 1 Dec 2016 19:18:53 +0000 (21:18 +0200)]
Build scripts for improved release workflow

Add build scripts to support extracting version info from
gmxVersionInfo.cmake, and to update the regressiontests MD5.

Part of #2066

Change-Id: I916439c1be26823b4e366aea4e7fcded6de21659

7 years agoFix logic of TRR reading
Mark Abraham [Thu, 8 Dec 2016 16:47:09 +0000 (03:47 +1100)]
Fix logic of TRR reading

Commit f7d4d019 introduced a bug where TRR reading reaching the end of
the file was indistinguishable from a reading error or a magic-number
error. This is now fixed, restoring the end-of-file behaviour that
existed before f7d4d019, while retaining the wrong-magic-number
behaviour that it introduced.

Refs #1926

Change-Id: Ic8540846c481f022bc6ae7b774794792c8c7a523

7 years agoRemove nxframe from t_trxstatus
Mark Abraham [Fri, 9 Dec 2016 18:48:26 +0000 (05:48 +1100)]
Remove nxframe from t_trxstatus

This is unused. Probably xframe can go too, once the long-deprecated
read_firstx/read_next_x functions are removed.

Change-Id: Ibf6a4fc3c6e4d598383a1d85baf6303b2944749d

7 years agoTurn off hwloc support when static lib found
Szilárd Páll [Wed, 2 Nov 2016 23:52:32 +0000 (00:52 +0100)]
Turn off hwloc support when static lib found

Hwloc dependencies are not resolved at CMake time when static
libwloc.a is detected and in most of these cases link-time
errors will prevent building GROMACS. As it is hard for a user to know
how to solve such cryptic errors and hwloc is not a required dependency,
we turn off hwloc support when a static lib is detected. The user can
override this on the cmake command line.

Refs #1919

Change-Id: Ic3917e2e59ee4c291b78ee47150e513ae77ced85

7 years agoFix and clean up handling of some linking
Teemu Murtola [Tue, 6 Dec 2016 19:19:54 +0000 (21:19 +0200)]
Fix and clean up handling of some linking

Split GMX_EXTRA_LIBRARIES to several lists, depending on the intended
use of those libraries.  Some of these also need to be linked by code
other than libgromacs, either because they are required by the public
headers (mostly -lm), or because also code outside libgromacs directly
references those libraries (e.g., MPI).

Should fix #2087.

Change-Id: Ie0e211b8f77a932ccd63017ee0743b78361624c4

7 years agoMade mdrun -pforce terminate with non-finite forces
Berk Hess [Thu, 24 Nov 2016 07:43:17 +0000 (08:43 +0100)]
Made mdrun -pforce terminate with non-finite forces

The mdrun option -pforce would print non-finite forces, but would
not terminate the run if any were found. Now a fatal error is issued.

Change-Id: Ie126904bd45acee4e5999db77e02fbe8b6b39226

7 years agoFix possible memory error with long selections
Teemu Murtola [Sat, 3 Dec 2016 08:50:56 +0000 (10:50 +0200)]
Fix possible memory error with long selections

If a selection was more than 1000 characters long and there was a
whitespace exactly at the 1000 point, a buffer overflow could occur.
Replaced the buffer with std::string, simplifying the code
significantly.  Update the generated code to use a newer flex, which
also removes the need for some suppressions.

Should fix #2086.

Change-Id: I56513bcf5ee99f05ce144461740d0f868be10186

7 years agoConsolidate files supporting TNG file I/O
Mark Abraham [Sat, 19 Nov 2016 16:46:56 +0000 (17:46 +0100)]
Consolidate files supporting TNG file I/O

The distinction between mdrun and tools in supporting TNG file formats
isn't useful, and makes it difficult to implement a wrapper type that
will mean GROMACS code depends on tng_trajectory_t only in one
source file.

Change-Id: Iea0d337b6f11599a33c6c8ba3857a31a839f8d59

7 years agoMerge branch release-2016
Mark Abraham [Wed, 7 Dec 2016 04:16:48 +0000 (15:16 +1100)]
Merge branch release-2016

Ignored fix to zlib management for GMX_EXTERNAL_TNG=on because that
was already a feature of the refactoring of TNG management in master
branch.

Change-Id: I8bc7ce196fb0d64685c6957b5055d73ff093d864

7 years agoCouple of new quotes
David van der Spoel [Mon, 28 Nov 2016 20:12:24 +0000 (21:12 +0100)]
Couple of new quotes

Change-Id: Idf02358ec11092e9d6e3c7e58397ad57bb94f00e

7 years agoFix use of position variables with plus/merge
Teemu Murtola [Mon, 5 Dec 2016 19:26:27 +0000 (21:26 +0200)]
Fix use of position variables with plus/merge

If a selection contained a position variable (e.g., 'com of ...') that
was used more than once, and at least one of those uses was with
plus/merge, there were out-of-bounds memory writes.  This was caused by
the internal position structure not getting fully initialized.
Incomplete initialization happens in all contexts with such variables,
but only plus/merge (and possibly permute) actually use the values that
remained uninitialized, which caused them to incorrectly compute the
amount of memory required to store the result.

Fixes part of #2086.

Change-Id: I016e796db268a11d557309935c02cbd1bc79a83c

7 years agoFix memory handling in gmx dump of TNG files
Mark Abraham [Mon, 5 Dec 2016 22:54:01 +0000 (23:54 +0100)]
Fix memory handling in gmx dump of TNG files

Calling code in dump.cpp did not free the memory used in each loop
over different TNG data blocks. This is also more efficiently and
simply done with srenew, along with a final sfree.

Change-Id: I0fbfdc9acf3bc5f498ec3ec9b15da1c59bf4c271

7 years agoStop including parallel_3dfft.h in headers
Aleksei Iupinov [Mon, 5 Dec 2016 17:11:54 +0000 (18:11 +0100)]
Stop including parallel_3dfft.h in headers

Change-Id: I21565f240f892e8fa9596675795e47e1f7cd7087

7 years agoRemove undue narrowing of integer in TNG reading
Mark Abraham [Mon, 5 Dec 2016 13:25:54 +0000 (14:25 +0100)]
Remove undue narrowing of integer in TNG reading

This compromised the reading of TNG trajectories with sufficiently
large numbers of frames. Both types are 64-bit integers so we should
just do the obvious thing.

Change-Id: Id8dcaacc35231c6b4737d9924f70da3ac29e7408

7 years agoAdd INSTALL-dev to aid people doing unusual builds
Mark Abraham [Mon, 24 Oct 2016 15:45:24 +0000 (17:45 +0200)]
Add INSTALL-dev to aid people doing unusual builds

Occasionally it is useful to build GROMACS other than from an official
release tarball, e.g. when testing a new feature. The contents of this
file will help such people to find the right documentation, without
compromising clarity for normal installations from the tarball.

Change-Id: I38d957fe0d1ca2ba1e509ed30bb93a100f018306

7 years agoMove GPU assignment functions into a separate file
Aleksei Iupinov [Fri, 28 Oct 2016 11:09:51 +0000 (13:09 +0200)]
Move GPU assignment functions into a separate file

2 GPU assignment functions (gmx_select_gpu_ids() and set_gpu_ids())
are moved from detecthardware.cpp to a new file hardwareassign.cpp
to separate the GPU scheduling from GPU detection. They are also renamed
for clarity: set_gpu_ids() to assign_rank_gpu_ids(),
gmx_select_gpu_ids() to gmx_select_rank_gpu_ids().
Related deprecated function print_gpu_detection_stats() is also moved,
and changed to only print errors in case of heterogenous MPI configurations,
like it was intended to.
sprint_gpus() is refactored.

Change-Id: Ieef402954194e747e4c6dc5535e0652b5f862e28

7 years agoFix minor trjconv bug
Mark Abraham [Thu, 1 Dec 2016 00:24:48 +0000 (01:24 +0100)]
Fix minor trjconv bug

gmx trjconv -novel -f in.pdb -o out.pdb did not work as was probably
intended, because ftpin had an excessive large scope plus a default
value, and was only set by the -vel path (which fortunately is the
default).

Minimized scope of ftp while I was there.

Change-Id: I6b7dadc109834384f6cfb19f61258fa30d52ef80

7 years agoAdditional selection help
Teemu Murtola [Sat, 26 Nov 2016 05:07:00 +0000 (07:07 +0200)]
Additional selection help

- Explain resindex and resnr keywords in selection help.
- Explain how selection-enabled tools treat -s and -f input files.

Fixes #2083

Change-Id: I93e38c46a2bdb35f057688cf29fb3392712c2443

7 years agoChange spline moduli calculation to double
Berk Hess [Tue, 11 Oct 2016 12:16:22 +0000 (14:16 +0200)]
Change spline moduli calculation to double

Even though single precision seems enough, since the spline moduli
are only calculated once per grid, we should do this in double.
Also simplified the code by using the actual spline order, changing
and merged loops and removing a lot of unused variables.

Change-Id: If1bd3741a3efca14e6fefe1f80aa10cc31f84e42

7 years agoConvert energyhistory_t to use std::vector
Berk Hess [Fri, 14 Oct 2016 20:12:54 +0000 (22:12 +0200)]
Convert energyhistory_t to use std::vector

This change converts energyhistory_t and its child struct
delta_h_history_t to classes that use std::vector.  Thus the init
and done routines and energyhistory.cpp are removed.

Part of #2059.

Change-Id: Ieb1f43d18187d4f8de5a21d043bcddcf6686280d

7 years agoUse templating in checkpoint.cpp
Berk Hess [Mon, 17 Oct 2016 12:29:52 +0000 (14:29 +0200)]
Use templating in checkpoint.cpp

The low level int, real and double writing routines have been
converted to a single template function. The listing functionality
has been moved to a separate function. Added functions for processing
more std::vector types.
Also fixes a bug causing memory corruption in gmx dump -cp.

Part of #2059.

Change-Id: Ia48e57841c7a2dfaa3aefd1f43f0cdc9c0034119

7 years agoStop including tng_io_fwd.h
Mark Abraham [Thu, 17 Nov 2016 23:31:21 +0000 (00:31 +0100)]
Stop including tng_io_fwd.h

The two header files in GROMACS associated with TNG support only need
a forward declaration of the tng_trajectory type, and the typedef
tng_trajectory_t. For a build without TNG, that is all that is
required, because the pointer is never dereferenced. For a build that
uses TNG (whether bundled with GROMACS or installed on the systm), if
TNG no longer declares a type of that name, then compilation will fail
with or without this change.

Thus there is no change in quality of support of TNG from this change.
However, it does avoid a build configuration that does not use TNG
needing to be able to find one. This will be convenient for static
analysis support.

Also removed a useless include of tngio_for_tools.h.

Change-Id: I3438d3e1b0c38a62afec4ea3a7f6e977d6602d96

7 years agoMove hardcoded PME grid indexing constants into header
Aleksei Iupinov [Thu, 10 Nov 2016 12:34:46 +0000 (13:34 +0100)]
Move hardcoded PME grid indexing constants into header

Moved the table size factor of 5 to pme-grid.h as a constexpr.
Also changed the spread code that use the table to use a constexpr
for the offset, which in turn determines the table size.

Change-Id: Ief524e9510c0406f60973800f2e110c361128ef5

7 years agoAdded first tests of bonded force functions.
David van der Spoel [Thu, 18 Aug 2016 08:04:33 +0000 (10:04 +0200)]
Added first tests of bonded force functions.

Tests for bond_angle and dih_angle functions.
Some tests for bondeds, angles and dihedrals.
Part of #2034

Change-Id: I53835ff6fea98e8163505126d347150b64262770

7 years agoEnhanced ArrayRef
Mark Abraham [Mon, 7 Nov 2016 16:54:49 +0000 (17:54 +0100)]
Enhanced ArrayRef

Added a non-explicit constructor also for std::array, so we can
use ArrayRef more often as a view of memory.

Most clients need to know that the storage has a starting pointer, is
contiguous, and has a given size, but doesn't care e.g. whether it can
be resized or inserted into. The interface for such clients should
express that, so we avoid ripples all over the code base when someone
finds a reason to switch between std::vector, std::array or perhaps
something custom.

Change-Id: I98d96281ab324f2c0d3d3188810295d0027e5fe5

7 years agoCreated paddedvector.h
Mark Abraham [Mon, 7 Nov 2016 15:58:42 +0000 (16:58 +0100)]
Created paddedvector.h

This permits forcerec.h to not depend on state.h, and creates a stable
location in which to implement e.g. PaddedRVecVector. There are now
about 25 fewer source files that depend on state.h.

Change-Id: I07c443dea45b394773d60f74b036584af5920cf8

7 years agoRemove unimplemented gmx trjcat -vel
Mark Abraham [Wed, 16 Nov 2016 15:33:05 +0000 (16:33 +0100)]
Remove unimplemented gmx trjcat -vel

Change-Id: Iae2e46c43b01d46fb0c6f0734c2de309a5395564

7 years agoFixed typo in membed.cpp
Carsten Kutzner [Tue, 15 Nov 2016 14:13:41 +0000 (15:13 +0100)]
Fixed typo in membed.cpp

Fixes #2076

Change-Id: Idcebb45ee85b478d7863ac55eb5cef62a2109bb8

7 years agocmake: fix build with GMX_EXTERNAL_TNG=ON
Christoph Junghans [Thu, 3 Nov 2016 18:12:17 +0000 (12:12 -0600)]
cmake: fix build with GMX_EXTERNAL_TNG=ON

tng_set_source_properties is not defined in case of GMX_EXTERNAL_TNG=ON
due to the fact that BuildTNG.cmake never gets included. Also this
call isn't really needed tng doesn't get compile when external anyway.

Change-Id: Id3c7e0da55ce9ef8cf43d2aecaa187e965bf6ad2

7 years agoFix x86 conditional
Dan Horák [Tue, 8 Nov 2016 10:38:42 +0000 (11:38 +0100)]
Fix x86 conditional

The CpuInfoTest.SupportLevel testcase fails on s390x because wrong
condition in src/gromacs/hardware/tests/cpuinfo.cpp is used. Fixed
this by setting GMX_TARGET_X86 to 0 or 1 in all cases, both for
GROMACS CMake detection and GROMACS build.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1390149

Refs #2072

Change-Id: Id50fd65c6228a25f2bb2eca684d680a2b34d2263

7 years agoAdd selection-enabled gmx traj
Teemu Murtola [Sat, 4 Jun 2016 18:09:22 +0000 (21:09 +0300)]
Add selection-enabled gmx traj

For now, this tool only plots coordinates, velocities, and forces for
selections, so it should provide a full replacement for -ox, -ov, -of,
-com, and -mol from gmx traj.

Clean up implementation in other tools noticed while touching them.

Change-Id: Ia3b0e77353d9183ffc049d1e1fb0253e30332664

7 years agoSupress ICC 16 on Windows false postives
Roland Schulz [Fri, 21 Oct 2016 19:25:32 +0000 (12:25 -0700)]
Supress ICC 16 on Windows false postives

Change-Id: I7ef020d12a7f0dbbb9e0ddf60bdc6b8a671652b4

7 years agoRemove imatrix type and related unused/erroneous code
Aleksei Iupinov [Mon, 31 Oct 2016 16:29:41 +0000 (17:29 +0100)]
Remove imatrix type and related unused/erroneous code

Change-Id: I7fd80b7b05cbd3206668168964501856246de0b4

7 years agoMerge "Merge branch release-2016"
Szilárd Páll [Tue, 1 Nov 2016 11:28:17 +0000 (12:28 +0100)]
Merge "Merge branch release-2016"

7 years agoFix time label print in gmx vanhove
Berk Hess [Tue, 1 Nov 2016 11:05:07 +0000 (12:05 +0100)]
Fix time label print in gmx vanhove

Change-Id: Ibf668e46622c2739ae44f950d1bbfadbbb67b276

7 years agoMerge branch release-2016
Mark Abraham [Mon, 31 Oct 2016 11:39:40 +0000 (12:39 +0100)]
Merge branch release-2016

Trivial conflicts for version number and the fix for gmx
wham that was duplicated in each branch.

Change-Id: I0ba030398cc2d3679841000a40db6e8a3f7b68cb

7 years agoMerge branch release-2016
Mark Abraham [Mon, 31 Oct 2016 11:39:40 +0000 (12:39 +0100)]
Merge branch release-2016

Trivial conflicts for version number and the fix for gmx
wham duplicated in each branch.

Change-Id: I0ba030398cc2d3679841000a40db6e8a3f7b68cb

7 years agoSupport normalizing values in KeyValueTree
Teemu Murtola [Wed, 26 Oct 2016 18:44:12 +0000 (21:44 +0300)]
Support normalizing values in KeyValueTree

Make it possible to normalize values stored in a KeyValueTree to match
an Options structure.  This makes the types etc. consistent in the tree.
This is mainly useful for reducing variability in tpr files for better
forward/backward compatibility management, but can also be nice for
producing consistent mdp output files from grompp (if we want to keep
that feature).

Change-Id: Ib5ea03faaa690c84076c1ada0c0a08ddf9a1a128

7 years agoReplace qsort/bsearch with std::sort/lower_bound
Roland Schulz [Fri, 21 Oct 2016 10:17:38 +0000 (03:17 -0700)]
Replace qsort/bsearch with std::sort/lower_bound

Change-Id: Ic8dc3d86f9738751e463065a012ff1adc02bdf7c

7 years agoAdd gmx dump option for printing parameters
Berk Hess [Tue, 21 Jun 2016 10:00:24 +0000 (12:00 +0200)]
Add gmx dump option for printing parameters

For comparing topologies of the same system with different force
fields it can be very useful to print bonded parameters instead
of the parameter type index.

Change-Id: I06a3b65b695ace4de1491f2d58abb6b7e752693d

7 years agoBumped version to prepare for next patch release
Mark Abraham [Fri, 28 Oct 2016 21:18:02 +0000 (23:18 +0200)]
Bumped version to prepare for next patch release

Change-Id: I5f72d87d3b0ed4c06edade7188471ea12ed31046

7 years agoVersion 2016.1
Mark Abraham [Tue, 25 Oct 2016 09:35:54 +0000 (11:35 +0200)]
Version 2016.1

Bumped regressiontests hash and minor soversion as usual.

Change-Id: I339d70a29553be8662a2a5d3ebb1a11d8361af34

7 years agoDLB can now turn off, when slower
Berk Hess [Tue, 11 Oct 2016 20:08:02 +0000 (22:08 +0200)]
DLB can now turn off, when slower

Under certain conditions, especially with (shared) GPUs, DLB can
decrease the performance. We now measure the cycles per step before
turning on DLB. When the running average of cycles per step with DLB
gets above the average without DLB, we turn off DLB. We then measure
again without DLB. DLB can then turn on again. If we turn on DLB of
DLB multiple times in close succesion and we measure performance loss,
we keep DLB off for the remainder of the run. This procedure ensures
that the performance will never deteriorate due to DLB.
Updated and expanded the DLB section in the manual.

Change-Id: I6e0291c1a41adf6da94fae46d36e0fcb95585a02

7 years agoGPU-related additions to the install/user guide
Szilárd Páll [Tue, 25 Oct 2016 17:33:30 +0000 (19:33 +0200)]
GPU-related additions to the install/user guide

Additions:
- clarification of OpenCL compile- and run-time dependencies;
- rewrote info about OpenCL-enabled run requirements / peculiarities;
- added section on reducing overheads in GPU runs (related to both
  CUDA and OpenCL).

Change-Id: I310ab5605b46b4ed90db87d4ce022005c9b26419

7 years agoFix DLB timing with CUDA and OpenCL
Berk Hess [Tue, 4 Oct 2016 07:39:37 +0000 (09:39 +0200)]
Fix DLB timing with CUDA and OpenCL

With OpenCL the time for the local non-bonded to finish on the GPU
was ignored in the dynamic load balancing. This change lets OpenCL
take the same code path as CUDA.
Also the cycle wait limit of 50 Kcycles was far too small for both
CUDA and OpenCL. It now 2 Mcyles, based on measurements.
Note that with OpenCL we should have access to accurate host and
device timing (unlike with CUDA), but we will not use that in
a release branch.

Change-Id: I5b401fdeae7ab0b426a33baf01a3dbeb7d0d924e

7 years agoMake -cl-fast-relaxed-math default
Szilárd Páll [Tue, 25 Oct 2016 23:29:01 +0000 (01:29 +0200)]
Make -cl-fast-relaxed-math default

The change makes fastmath default and changes the previous env-var
trigger to GMX_OCL_DISABLE_FASTMATH to allow disabling it for testing.
It is known to be faster on all supported platforms (and we use it in
CUDA too) and it has been planned to be enabled for the r'16 release.

Change-Id: I8d196c9a14785ff43aae144ed95c3cb29241c83b

7 years agoAdd GMX_DISABLE_GPU_TIMING env var
Szilárd Páll [Tue, 25 Oct 2016 22:52:37 +0000 (00:52 +0200)]
Add GMX_DISABLE_GPU_TIMING env var

It disables timing for both CUDA and OpenCL so on the long run
it can replace both.

Change-Id: I3556d87c135eba2e24935e77a0d608b72219b284

7 years agoElectric field mdp parsing using options
Teemu Murtola [Fri, 30 Sep 2016 19:17:22 +0000 (22:17 +0300)]
Electric field mdp parsing using options

Make the module declare a structured set of options, as well as a
transform from a flat mdp structure to this set of options.
Use these for assigning the input values, instead of passing t_inpfile
directly.

There is one regression introduced here: values not specified in the mdp
file are no longer automatically inserted with defaults, and comments
related to the electric field input values are lost.  With just the
electric field affected, this should not be a big deal, but that can
limit adoption of this approach until we can solve it (preferably, by
changing the mdp format to something where it is easier).

Change-Id: Ic71275f3533f06ce6fee64983c7e1686b782fb9b

7 years agoSupport for default values from Options to KeyValueTree
Teemu Murtola [Fri, 21 Oct 2016 14:17:32 +0000 (17:17 +0300)]
Support for default values from Options to KeyValueTree

Make it possible to copy default values from an Options structure to a
KeyValueTreeObject for values that are not present in the original tree.
Also, sort the tree values in the order they are present in the Options
object.

Basic things work, but this will require some generalization in the
future.

Change-Id: If1dd59a11d34af19e16712de12fee705c9b814f2

7 years agoTreat CUDA files as C++ during cppcheck
Aleksei Iupinov [Mon, 24 Oct 2016 10:58:27 +0000 (12:58 +0200)]
Treat CUDA files as C++ during cppcheck

CUDA sources (*.cu) were treated as plain C for cppcheck purposes,
but should be treated as C++.
Some outdated CUDA suppressions removed.

Change-Id: I26fb768464660da1e569dda6d844a63ee2823313

7 years agoUpdate install guide
Mark Abraham [Fri, 21 Oct 2016 21:12:04 +0000 (23:12 +0200)]
Update install guide

Some recent traffic on gmx-users suggested some
improvements.

Change-Id: Iaaf116ebf582755a466048aed1cd30bc123dc817

7 years agoClean up option (default) value access
Teemu Murtola [Thu, 20 Oct 2016 16:04:15 +0000 (19:04 +0300)]
Clean up option (default) value access

Currently, the only user for valueCount() and formatValue() in
OptionInfo was actually interested in the default values, and limiting
access to the default values only makes the responsibilities clearer.
So replace both methods with a single method that returns just the
default values.  The internal implementation currently places some
limitations on when this can actually be called, but that should not be
a problem for current or future uses.

Change-Id: I3e68ce397ec3f40f62ececad4ee6b87d0ecc790e

7 years agoSuppress cppcheck warning
Roland Schulz [Fri, 21 Oct 2016 14:06:08 +0000 (07:06 -0700)]
Suppress cppcheck warning

Change-Id: I7b212df760c3dfb0020c41f9050e70d8c4be7b48

7 years agoUpdate cppcheck support to 1.76.1
Mark Abraham [Tue, 18 Oct 2016 15:32:06 +0000 (17:32 +0200)]
Update cppcheck support to 1.76.1

Suppressed some classes of warnings where cppcheck was systematically
failing (for at least some source files). Added assert statements
to cover others.

Propagated some const correctness.

Replaced some block_* macros with templated functions in a header
that we re-use in a few places.

The gmx_arpack and lapack issues were inherited from the original
FORTRAN.

The simd/support.cpp issue is a bug that is fixed in release-2016.

Removed some unnecessary stderr output.

Noted TODOs for further cleanup.

Change-Id: Ia93690e3dbd529ef27e5b7f8331d12a2f7d34766

7 years agoSerialization support for KeyValueTree
Teemu Murtola [Mon, 10 Oct 2016 15:59:13 +0000 (18:59 +0300)]
Serialization support for KeyValueTree

Implement serialization of KeyValueTree objects to xdr files for use in
storing inputrec values using this format.

There is a C++ ISerializer interface in between to support testing, but
in the future, this could possibly be replaced with more direct xdr
serialization.  However, our current gmx_system_xdr.cpp does not support
in-memory serialization, which would be a requirement for broadcasting
the data structure, so the ISerializer can provide a useful abstraction
also for this.

Change-Id: I6836d8e7f725c364336e09745052521eccf331ce

7 years agoUpgrade coverage matrix.
Mark Abraham [Sun, 16 Oct 2016 21:58:10 +0000 (23:58 +0200)]
Upgrade coverage matrix.

Add support for CUDA 8.0, and migrate responsibilities. This will have
the side effect of actually using bs_nix1204 again for testing master,
because it is the only GPU slave that currently has CUDA
8.0. bs_nix1310 still has the CUDA 6.5 job, and some non-GPU jobs.

Removed specification of cmake-3.5.2 which isn't necessary to be
sure that we check in pre-submit testing.

Change-Id: I559189e74f366fa1523fa6a8ad650471df4fcfb3

7 years agoFix SIMD suggestion for VMX
Mark Abraham [Tue, 18 Oct 2016 15:16:02 +0000 (17:16 +0200)]
Fix SIMD suggestion for VMX

Change-Id: Iebf55611512bf02d2a1a5780a1d6c05ce4b16023

7 years agoNew classes for spline interpolation tables
Erik Lindahl [Sun, 21 Feb 2016 21:31:01 +0000 (22:31 +0100)]
New classes for spline interpolation tables

Quadratic and cubic spline tables can be constructed either
from analytical functions or numerical vector input, and they
can contain an arbitrary number of functions as multi-tables.
Spacing is optimized to achieve the requested precision.
To make the class more generic it works with functions and
derivatives, and avoids worrying about swapping signs to get
forces. The interpolation functions are templated and will also
work with SIMD, without exposing any table internals.

Change-Id: If75f52b0601ad4b396d3cef74b5bbbe81ba91753

7 years agoSupport option assignment from different precision
Teemu Murtola [Wed, 12 Oct 2016 17:09:26 +0000 (20:09 +0300)]
Support option assignment from different precision

Make it possible to assign a value from float to DoubleOption and from
double to FloatOption.  This is needed to support tpr serialization for
cases where the code reading the file is different precision than what
wrote it.

Change-Id: Ib2268b343e4abbe70868d0d60b66559b8052c239

7 years agoAdd support for reading values from refdata
Teemu Murtola [Sun, 9 Oct 2016 18:33:06 +0000 (21:33 +0300)]
Add support for reading values from refdata

This is the easiest way to support tests in child changes for
serialization.  Some alternative approach may be possible in the future,
when the serialization approach matures, but I seem to recall there have
been requests for this functionality also in other contexts.  There is
some less-than-ideal behavior (in particular, a newly created test fails
if it uses this functionality, and only succeeds when you actually
create the reference data).

Also add support for a separate type of unsigned char reference values,
to support serialization tests.

Change-Id: I35ee9d43a0737a342f756cda0e7a789273ce1d9e

7 years agoImproved error handling for KeyValueTree operations
Teemu Murtola [Sun, 2 Oct 2016 18:26:16 +0000 (21:26 +0300)]
Improved error handling for KeyValueTree operations

Support an error handler for operations involving KeyValueTrees to allow
for better error messages during mdp parsing.

Change-Id: I3738b956baafe7a4ecb96ec6f9e4729541d74bf8

7 years agoMove energyhistory_t out of t_state
Berk Hess [Sat, 15 Oct 2016 08:52:06 +0000 (10:52 +0200)]
Move energyhistory_t out of t_state

We have three different types of states in mdrun:
1) the microstate of the system we are simulating
2) history information for output
3) the state of the simulation machinery in mdrun
The struct energyhistory_t clearly belongs to 2) and is therefore
moved out of t_state, which should eventually only contain 1).

TODO: Consider what to do with the other structs in t_state that
(also) store history rather than the state of the simulated system.

Note: reverts recent commit ec827264

Part of #2059.

Change-Id: Ie84a19efcd0a170c0aaafe18c06275b7fb15244a

7 years agoImproved address sanitizer support
Teemu Murtola [Tue, 12 Apr 2016 17:53:43 +0000 (20:53 +0300)]
Improved address sanitizer support

Use support in CTest 3.1+ for parsing ASAN output.  Work around various
bugs in CTest to make this actually work.  Remove an OS X workaround,
since it does not appear necessary with a recent XCode toolchain.
Use newer clang to get LeakSanitizer.

Change-Id: I37002bffd653e04b52ba340a97d2806851f692b8

7 years agoWork around memory leak in t_state
Teemu Murtola [Sat, 15 Oct 2016 03:11:17 +0000 (06:11 +0300)]
Work around memory leak in t_state

Use std::shared_ptr for t_state.enerhist, which should have the same
semantics as the earlier plain pointer, but ensure that the memory gets
eventually freed.

Change-Id: Ibe291261eb4997035a5165130ee01d309a1dc395

7 years agoFix most memory leaks recently introduced
Teemu Murtola [Fri, 14 Oct 2016 18:32:35 +0000 (21:32 +0300)]
Fix most memory leaks recently introduced

- Do not overwrite memory allocated in init_mtop() when creating
  molecules in selection tests.
- Add function to properly deallocate t_topology and gmx_mtop_t when
  gmx_mtop_t_to_t_topology(..., false) has been called.
- Free all memory in done_mtop().

These should be enough to (again) make the unit tests free of memory
leaks, except that t_state.enerhist is leaked in a few places.  That
requires more complicated handling.

Change-Id: I84b853b9cb8a11c0458ea4f29316a83a41d7ae22

7 years agoApply Berendsen P-couple at nstpcouple steps
Berk Hess [Thu, 18 Aug 2016 20:40:48 +0000 (22:40 +0200)]
Apply Berendsen P-couple at nstpcouple steps

Berendsen pressure coupling was applied at step%nstpcouple=1. Since
there is no need for this, this is changed to step%nstpcouple=0.
This also simplifies the P-coupling management.
Note that this change prevents continuation from old checkpoint files
for Berendsen P-couple runs, since the step-1 pressure is removed.

Change-Id: I5e2e6b1a1d5cb347ebdd6c1a402b41280bedff68

7 years agoFixes some memory leaks associated with testing applied forces
David van der Spoel [Fri, 14 Oct 2016 06:41:25 +0000 (08:41 +0200)]
Fixes some memory leaks associated with testing applied forces

Fixes memory leaks associated with the electric
field test. Implemented a done_commrec function.
There may be need for a done_domdec as well but
that falls outside the scope of this patch.

Change-Id: Ib86629bb7959b064b6ac3a57d4bb96e2dd3bfe94

7 years agoUse gmx_mtop_t in selections, part 3
Teemu Murtola [Thu, 29 Sep 2016 18:44:49 +0000 (21:44 +0300)]
Use gmx_mtop_t in selections, part 3

Convert remainder of the selection code to use gmx_mtop_t.

Part of #1862.

Change-Id: Icb1c4a30cc5456e64ed2d73f93ca4a7d6dbfbfbd

7 years agoUse gmx_mtop_t in selections, part 2
Teemu Murtola [Tue, 21 Jun 2016 18:42:59 +0000 (21:42 +0300)]
Use gmx_mtop_t in selections, part 2

Use gmx_mtop_t throughout low-level selection routines, i.e.,
centerofmass.cpp, poscalc.cpp, and indexutil.cpp.  Adapt test code,
which is now using gmx_mtop_t throughout as well.

In places where gmx_mtop_t is actually accessed, the changes are as
local as possible.  In most cases, some additional restructuring could
give better performance and/or much clearer code, but that is outside
the scope of this change.

Part of #1862.

Change-Id: Icc99432bddec04a325aef733df56571d709130fb

7 years agoUse gmx_mtop_t in selections, part 2
Teemu Murtola [Tue, 21 Jun 2016 18:42:59 +0000 (21:42 +0300)]
Use gmx_mtop_t in selections, part 2

Use gmx_mtop_t throughout low-level selection routines, i.e.,
centerofmass.cpp, poscalc.cpp, and indexutil.cpp.  Adapt test code,
which is now using gmx_mtop_t throughout as well.

In places where gmx_mtop_t is actually accessed, the changes are as
local as possible.  In most cases, some additional restructuring could
give better performance and/or much clearer code, but that is outside
the scope of this change.

Part of #1862.

Change-Id: Icc99432bddec04a325aef733df56571d709130fb

7 years agoExtend mtop_lookup.h
Berk Hess [Thu, 13 Oct 2016 12:28:36 +0000 (14:28 +0200)]
Extend mtop_lookup.h

Added three lookup functions that will be used in the selection code.
Harmonized the functions by making all functions that look up
a single object return a reference.
Replaced uses of mtopGetAtomParameters() that only used the mass
(which is nearly all) by mtopGetAtomMass().

Change-Id: Ibbe9729502038cd1f863433ce03a80dc544e4003

7 years agoAdd back-mapping to KeyValueTreeTransform
Teemu Murtola [Sun, 2 Oct 2016 04:58:38 +0000 (07:58 +0300)]
Add back-mapping to KeyValueTreeTransform

Add ability to map paths from the output structure of the transform back
to the original structure, which will be useful for error messages.

Change-Id: I9dded5a517fa72177219294596e5c23bec7785ce

7 years agoUpdate bundled TNG
Teemu Murtola [Thu, 15 Sep 2016 19:08:02 +0000 (22:08 +0300)]
Update bundled TNG

This commit bundles 6e41191016 from the TNG repo.

Required TNG 1.7.10 in future, which is the first version to include
support for the build system features used here.

Update the build system to use imported targets and interface properties
that TNG now provides.  Add support for building TNG that also bundles
zlib, which reduces the dependency footprint of GROMACS, which is
important for portability and ease of installation.

Refs #1908.

Change-Id: Ibc94d5a9470136331045738f105634ec95fdb455

7 years agoGetter for mapped paths from KeyValueTreeTransform
Teemu Murtola [Sun, 2 Oct 2016 05:20:12 +0000 (08:20 +0300)]
Getter for mapped paths from KeyValueTreeTransform

This allows identifying which values the transform will use.  In the
long run, this may be replaced with another mechanism (or removed
altogether), but for now, this makes it easier to do piecewise
transition from old mdp parsing to using KeyValueTree and options.

Currently, the values are returned in alphabetical order, but subsequent
work may need this in the order the rules are added.  That will be easy
to change internally to the transform.

Change-Id: I3f225ce4f693644e5ac17685f0a887eec02807a8

7 years agoSet maxwarn to INT_MAX if GMX_MAXCONSTRWARN < 0
James W. Barnett [Tue, 11 Oct 2016 13:09:55 +0000 (08:09 -0500)]
Set maxwarn to INT_MAX if GMX_MAXCONSTRWARN < 0

maxwarn is set to the value of the environmental variable
GMX_MAXCONSTRWARN, and we tell users to set that variable to -1 to have
no maximum. This condition was not being checked, so when set to -1 just
1 SETTLE warning was enough to halt the program. This commit fixes
that behavior by setting maxwarn to INT_MAX if GMX_MAXCONSTRWARN is -1
(or any other negative number).

Fixes #2058.

Change-Id: Ie6e2cb57f8402dd9a327f72f7fad36db19b8bb68

7 years agoUse gmx_mtop_t in selections, part 1
Teemu Murtola [Mon, 20 Jun 2016 17:59:30 +0000 (20:59 +0300)]
Use gmx_mtop_t in selections, part 1

Make the C++ analysis framework (and insert-molecules, which is also
using selections) use a gmx_mtop_t as the initial internal format to
load the topology, and make SelectionCollection::setTopology() use an
mtop.  Adapt tests.  One test is disabled as it is much easier to
re-enable it after the next step in the conversion process than in this
intermediate state.

Internally, the mtop structure is still converted to t_topology for use
in lower levels and in the tool code.

This change also makes it possible to convert the analysis tools and gmx
insert-molecules to use gmx_mtop_t independently from changes in the
selection code.

Part of #1862.

Change-Id: I3ce03c6524b27f0f44168890ac1a4a491da52a4c

7 years agoWrap sel. method evaluation parameters to struct
Teemu Murtola [Fri, 17 Jun 2016 05:49:40 +0000 (08:49 +0300)]
Wrap sel. method evaluation parameters to struct

This removes about 1/3 of t_topology instances in the selection code,
reducing the number of lines that need to be changed when switching to
gmx_mtop_t.

Also make most of the contents const.

Related to #1862.

Change-Id: Idcd71bc578a6daa4644f049a31f84e74717c258a

7 years agoMake regressiontests updater build work for master branch
Mark Abraham [Wed, 12 Oct 2016 12:01:18 +0000 (14:01 +0200)]
Make regressiontests updater build work for master branch

Forgot to resolve this TODO in the merge.

Change-Id: I5ec487e5335ca34509ee1c0fc5f8b841d1718d0d

7 years agoFixed exception in usused result
Berk Hess [Wed, 12 Oct 2016 14:35:21 +0000 (16:35 +0200)]
Fixed exception in usused result

Change f2854f89 introduced an code path in NPT_energy() of which
the result is, as of yet, unused. Here MassQ->Winv was uninitialized.
This could cause tests to fail with a floating point exception.

Change-Id: I7973336fb34ed50e7eb87da63af964058fd1aef0

7 years agoFixed print bug in gmx wham
Berk Hess [Mon, 10 Oct 2016 07:08:05 +0000 (09:08 +0200)]
Fixed print bug in gmx wham

Change-Id: I1957d1213498c25dff0f9257a51aa89af8cf03b8

7 years agoRefactor NPT energy calculation
Berk Hess [Mon, 15 Aug 2016 09:51:56 +0000 (11:51 +0200)]
Refactor NPT energy calculation

The NPT conserved energy quantity calculation is now managed by
a single function with separate functions for each thermo- and
barostat.

Change-Id: Id7cf431e4da78bffe33caaddb0a7c806c9c29091

7 years agoRestructure leap-frog integrators
Berk Hess [Mon, 14 Dec 2015 14:18:40 +0000 (15:18 +0100)]
Restructure leap-frog integrators

There are now 2 template function for MD leap-frog integration
instead of 4 branches in multiple functions.
In addition to invmass, mdatoms now contains invMassPerDim.
invMassPerDim is set to zero for encode frozen dimensions, so LF
update functions no longer need to check the freeze groups.
Also removed the conditionals for vsites and shells in the LF update
functions. Their velocities are now set to zero at startup.
A template function for the most common leap-frog integrator setups
allows for full SIMD acceleration, at least for AVX with gcc5.
Changed dt from double to real in the update, since we need far less
than real precision.
Changed calculation of alpha for VV to real, as it is passed as real.

Fixed multiple time stepping with Parrinello-Rahman and Nose-Hoover.

Fixes #2031.
Fixes #2032.

Change-Id: Iae5e787f1338b99c2338c9d0c1f14e90393e9252

7 years agofix typo
James W. Barnett [Tue, 11 Oct 2016 16:07:36 +0000 (11:07 -0500)]
fix typo

Change-Id: Iee8170173b5c4f02361e588260985d7ddf24f198

7 years agoUpdate for FFTW 3.3.5
Mark Abraham [Sat, 8 Oct 2016 23:35:10 +0000 (01:35 +0200)]
Update for FFTW 3.3.5

The auto-download now gets FFTW 3.3.5 and builds it properly,
including with --enable-vsx when GMX_SIMD is set to VSX, i.e. for
Power8, and --enable-avx512 when GMX_SIMD is any of the AVX flavours
(which is safe on non-512 now, works on KNL, and is presumed useful
for future AVX512 architectures).

Note that 3.3.5 does not automatically add avx and sse support if
configured with --enable-avx2, so changed the documentation
accordingly.

Change-Id: I2a48ec1cb4f812dcae18870e0afcaf1120da251b

7 years agoSupport concurrent t_topology and gmx_mtop_t use
Teemu Murtola [Mon, 20 Jun 2016 17:55:59 +0000 (20:55 +0300)]
Support concurrent t_topology and gmx_mtop_t use

Make gmx_mtop_t_to_t_topology() take a boolean flag that specifies
whether to free memory from mtop or not.  This makes it possible to
convert an mtop to a t_topology and then use both in subsequent code.
This in turn makes a piecewise conversion from t_topology to gmx_mtop_t
possible.

Using these two concurrently currently always leads to memory leaks, but
these should mostly be temporary during the conversion, and can be
sorted out separately if necessary.

Part of #1862.

Change-Id: Iccd6039c2226d1dc617963878e5640bb53f09ad6

7 years agoCheck atom mass availability in selections
Teemu Murtola [Wed, 15 Jun 2016 17:26:14 +0000 (20:26 +0300)]
Check atom mass availability in selections

Check for the availability of atom masses before using them in
selections, and give fatal errors early instead of asserts when
accessing the masses.  Try to load the masses on demand if not
available.

Change-Id: If288d2b3920b92c6994aee8b7ff96c85ce3f6cb8

7 years agoSpeed up mtop_util atom lookup
Berk Hess [Tue, 27 Sep 2016 12:50:05 +0000 (14:50 +0200)]
Speed up mtop_util atom lookup

The lookup of atom indices and properties on global atom index have
been sped up by moving functions to a new header file mtop_lookup.h
and by storing start and end global atom indices in gmx_mtop_t.
Another performance improvement is that the previous molblock index is
used as starting value for the next search.
The atom+residue lookup function now also returns the reside index.
This change also simplifies the code, since we no longer need a lookup
data structure.
A large number of files are touched because the t_atom return pointer
is changed to const also in the atomloop functions.

Change-Id: I185b8c2e614604e9561190dd5e447077d88933ca

7 years agoMerge "Merge branch release-2016"
Mark Abraham [Mon, 10 Oct 2016 22:49:37 +0000 (00:49 +0200)]
Merge "Merge branch release-2016"

7 years agoFix trivial PME memory leaks
Aleksei Iupinov [Mon, 10 Oct 2016 10:28:54 +0000 (12:28 +0200)]
Fix trivial PME memory leaks

This fixes still not all, but most of the memory leaks.

Change-Id: Iccd4ec5432df845665fedad411ac8fc83898c767

7 years agoMerge branch release-2016
Mark Abraham [Sun, 9 Oct 2016 21:46:47 +0000 (23:46 +0200)]
Merge branch release-2016

Resolutions straightforward apart from the question about the
correctness of the gmx_wham fix in release-2016 branch.

Change-Id: I908a9a6d8f5767da49c3f00495beeec2a4f95ca7

7 years agoCorrect kernel launch bounds for CUDA sm_60
Szilárd Páll [Mon, 26 Sep 2016 22:10:48 +0000 (00:10 +0200)]
Correct kernel launch bounds for CUDA sm_60

The GP100 architecture has half the SM size (64 ALUs) compared to 5.x
hence 64 threads/block already achieves maximum occupancy and the
incorrectly tweaked launch configuration is not optimal. This change
reverts the incorrectly increased block size in cc4214a.

Change-Id: I9be10acfb3650c778401d04dfcd52aa200f78ff4

7 years agoAdd readConfAndTopology
Berk Hess [Tue, 7 Jun 2016 14:03:47 +0000 (16:03 +0200)]
Add readConfAndTopology

readConfAndTopology will replace read_tps_conf, reading to gmx_mtop_t
instead of to the deprecated t_topology struct.
With requireMasses=TRUE, read_tps_conf will generate a fatal error when
an atom is not found in the mass database, as it was originally
intended, since we don't want to calculate with incorrect masses.
The availability of masses is signaled by the haveMass bool in t_atoms.
The trajectory analysis framework now works with optional masses.
This is done by not requiring masses and attempting to look up masses
from the database when they were not present in the structure file.

Refs #1862.

Change-Id: I045649fa458a08415fd319c568d15ad514a30a9f

7 years agoAdd script for Jenkins regressiontest update job
Mark Abraham [Thu, 15 Sep 2016 15:29:27 +0000 (16:29 +0100)]
Add script for Jenkins regressiontest update job

This job can generate regressiontests reference data. Intended to be
triggered on regressiontests change that lacks some reference data,
either because it's a new test case, or the old data was deleted in
that patch. Jenkins will build the code, run the test harness to
generate new reference data and attempt to add it to the git index.
If files were added, then update the commit and push it back to
gerrit.

The actual implementation is in the releng repository.

When merging to master branch, update the gcc version to 4.8.

Change-Id: I70542022af00773f58646c617fbf818cdf8f577e

7 years agoModularize electric field handling
David van der Spoel [Mon, 23 Nov 2015 22:32:48 +0000 (23:32 +0100)]
Modularize electric field handling

Move external electric field code to a C++ class where only a single
place in the code is responsible for initializing it, and everything
else operates only on relatively general interaces.  Details of the
electric field stuff is encapsulated within the class.

Moved the files into new directory applied-forces.

Added manual section for electric fields.

The interfaces may need more generalization to support more complicated
modules like the pull code, but that is better done when actually moving
those parts to this approach.  Various considerations are documented in
mdmodules.h and inputrect.h.

Part of #1972.

Change-Id: I513632c74a8fae28b5f1087a3b5781791a2627bd

7 years agoChanged fr->f_novirsum to PaddedRVecVector
Berk Hess [Wed, 5 Oct 2016 19:47:43 +0000 (21:47 +0200)]
Changed fr->f_novirsum to PaddedRVecVector

Commit 74474d6f forgot to also change f_novirsum in t_forcerec
to PaddedRvecVector.

Change-Id: Ib8880d904dbad4049e6e2cee08fa74e2a17911a2

7 years agoSupport different key matching in KeyValueTreeTransform
Teemu Murtola [Sat, 1 Oct 2016 04:53:34 +0000 (07:53 +0300)]
Support different key matching in KeyValueTreeTransform

Support case-insensitive and mdp-style dash-insensitive string
matching in KeyValueTreeTransform.  Required to use this for mdp
transformations.

Change-Id: I20661f721880e26844f0c38a7582c26f376e6a62

7 years agoMerge "Merge branch release-5-1 into release-2016" into release-2016
Teemu Murtola [Wed, 5 Oct 2016 18:24:16 +0000 (20:24 +0200)]
Merge "Merge branch release-5-1 into release-2016" into release-2016

7 years agoMerge branch release-5-1 into release-2016
Mark Abraham [Mon, 3 Oct 2016 15:09:57 +0000 (17:09 +0200)]
Merge branch release-5-1 into release-2016

Change-Id: I38cba3159387519af07195a5995b0986dac5a2d6