alexxy/gromacs.git
7 years agoImprove option support & tests for key-value trees
Teemu Murtola [Sat, 11 Mar 2017 13:14:30 +0000 (15:14 +0200)]
Improve option support & tests for key-value trees

Add basic tests for the behavior of different option types with
key-value tree handling.  For now, the test covers only the "adjust"
function.  Make enum options serialize as strings instead of integers,
which improves behavior of gmx dump and gmx check, and can also be more
robust for backward/forward compatibility.

Improve the way the key-value tree serialization tests are done: use the
in-memory serializer to test roundtrips, instead of relying on the
reference data.  There is less code this way, and the tests behave
better in the absence of reference data.

Change-Id: I5e52265333f397bd6e058636691cbfd21092df0d

7 years agoRemove manual alignment from InMemorySerializer
Teemu Murtola [Sat, 11 Mar 2017 17:00:54 +0000 (19:00 +0200)]
Remove manual alignment from InMemorySerializer

This makes the serialized form more compact, and removes one source of
uncertainty on whether the code works in all possible scenarios.

Also, fix a case that seems to crash on Windows debug builds if a string
is serialized last, indexing the buffer beyond the end even though the
pointer is never dereferenced.

Change-Id: I95ffaefc2296dda1b4f9302003c90fac9ace2a9e

7 years agoConsistent TextWriter trailing whitespace handling
Teemu Murtola [Sat, 11 Mar 2017 08:06:11 +0000 (10:06 +0200)]
Consistent TextWriter trailing whitespace handling

Depending on how exactly the writer was called, trailing whitespace in
the input strings was either preserved or removed.  Now it behaves at
least more predictably.  Add tests.

The actual change is in the line wrapper.

Change-Id: I44d545cac53bc2c3aef363ec259ec82cbd1aec90

7 years agoAdded tests for gmx clustsize.
David van der Spoel [Tue, 7 Mar 2017 18:39:25 +0000 (19:39 +0100)]
Added tests for gmx clustsize.

Some bone headed stuff to allow development of a new
version later. Unfortunately this now touches code
outside the analysis tool due to memory leaks that have to be
fixed.

Part of #2132

Change-Id: I32558e3a7cd7448954cf093208c15ce7014942ff

7 years agoRefactor GPU selection handling
Mark Abraham [Mon, 20 Feb 2017 16:23:22 +0000 (17:23 +0100)]
Refactor GPU selection handling

Some code was largely duplicated between CUDA and OpenCL
implementations, which has been reduced by extracting the single line
of implementation-specific logic, and calling that from code that can
now live in the general hardware module.

There's also some related clean-up of allocation, logic, string
handling, and documentation.

Change-Id: I9eeade90e2fe44490e1a517e4c045e61ad4afc80

7 years agoRemove MDModules use from mdlib
Teemu Murtola [Sun, 26 Feb 2017 19:07:15 +0000 (21:07 +0200)]
Remove MDModules use from mdlib

This reduces coupling by reducing the scope where MDModules (which, in
turn, knows all modules) is known.  It also removes a cyclic
module-level dependency that was introduced earlier in the refactoring.

Change-Id: I7ae3b4ad90a2cb99d97c2ece69e9c5d34fcceb9e

7 years agoSplit md module facets to different interfaces
Teemu Murtola [Sun, 26 Feb 2017 18:45:13 +0000 (20:45 +0200)]
Split md module facets to different interfaces

Now that IInputRecExtension is no longer embedded in t_inputrec, split
the interface to more focused interfaces.  Put each interface to its own
file, and introduce IMDModule that allows getting an instance of each
interface symmetrically from a module.  This also allows modules to
return null for interfaces they do now need to implement, but that is
not supported very well yet.

Change-Id: I7641e90fea3f63d7c5f987fd7595912a1286cce9

7 years agoRemove outdated CUDA version check
Aleksei Iupinov [Tue, 28 Feb 2017 15:29:38 +0000 (16:29 +0100)]
Remove outdated CUDA version check

Change-Id: I48aae494a0385ed1f923d6956b181b6d1256e259

7 years agoRemove unnecessary include
Carsten Kutzner [Thu, 2 Mar 2017 16:15:50 +0000 (17:15 +0100)]
Remove unnecessary include

Change-Id: I08920182fc1644bfd23e594c23bca13ccaa59f38

7 years agoAdd load balance fraction to DLB print
Berk Hess [Fri, 7 Oct 2016 14:43:42 +0000 (16:43 +0200)]
Add load balance fraction to DLB print

DLB can often be based on a small fraction of the total step time,
especially with GPUs. Now this is printed to md.log and stderr.
Also restructured and clarified print_dd_load_av().

Change-Id: Ibe8040b22b5995f0017c9a13e4f707fab02112ab

7 years agoMore documentation for key-value trees
Teemu Murtola [Sat, 25 Feb 2017 19:27:42 +0000 (21:27 +0200)]
More documentation for key-value trees

Document most of the builder APIs for key-value trees, and some of the
functions in the data structures themselves.  This should cover most of
the functionality that is currently visible to IInputRecExtension modules.

Some clean-up and additional asserts for the builder API.

Change-Id: Ifa0d86bcd62661616008ec61db47ddd0ba7a6ead

7 years agoDecouple t_inputrec from MDModules
Teemu Murtola [Sun, 26 Feb 2017 13:02:43 +0000 (15:02 +0200)]
Decouple t_inputrec from MDModules

t_inputrec no longer depends on IInputRecExtension fields being
initialized, so it is not necessary to initialize it in gmx::MDModules.
Now t_inputrec can again be initialized without gmx::MDModules,
clarifying responsibilities.

For now, this again removes the need to use gmx::MDModules for just
reading t_inputrec.  These locations may need further changes as
responsibilities move around more, but in any case, t_inputrec ownership
should be better somewhere else than in MDModules.

Add constructor and destructor to t_inputrec to make it easier to manage
its instances.  Disallow copying (since that is tricky to implement
correctly), and do a manual only-what-is-required copy in PME
reinitialization, which is the only place that relied on copying

Change-Id: I52e0a17b13a0b7dad886fdf1b7d09bcbfcf961aa

7 years agoRemove module references from t_inputrec
Teemu Murtola [Sun, 26 Feb 2017 07:12:26 +0000 (09:12 +0200)]
Remove module references from t_inputrec

Do not use t_inputrec to pass around pointers to the electric field
module, reducing it back to a value-like data structure.

For now, use gmx::MDModules to do this.  This introduces an
mdlib <-> mdrunutility cyclic dependency, which is suppressed for now.
Further refactoring will again get rid of this after some futher work on
the module structure, but left it here to keep the changes smaller.

Change-Id: I05a8c8b7673e9827a1ec5ee5f48a8738026e3faf

7 years agoRemove unused function cu_synchstream_atdat()
Aleksei Iupinov [Tue, 21 Feb 2017 15:31:54 +0000 (16:31 +0100)]
Remove unused function cu_synchstream_atdat()

Change-Id: I363010ca73a9d0e3e1ebb13cf20a42fa834fb573

7 years agoAdd tests for old gmx energy functionality
Mark Abraham [Thu, 19 Jan 2017 20:58:23 +0000 (21:58 +0100)]
Add tests for old gmx energy functionality

Imported the edr and tpr files from the proposed new energyanalysis
tests so that we can observe that the old and new code are materially
the same, so we have a more stable change process for the large amount
of new code.

Extended gmx energy temporarily so that Einstein viscosity output
files are not hard coded (otherwise writing them in tests spams
output files).

Memory leak in inputrec.cpp was fixed (that only was detected
due to the dhdl test). A number of memory leaks in gmx_energy
were fixed as well.

Change-Id: I374b04bb20bb99df344b5b60a315b82c8c28828d

7 years agoUse gmx::Mutex and gmx::lock_guard to fix some issues
Mark Abraham [Tue, 14 Feb 2017 23:37:33 +0000 (00:37 +0100)]
Use gmx::Mutex and gmx::lock_guard to fix some issues

Refactored a few uses of raw thread-MPI mutexes to fix known leaks, so
valgrind and LeakSanitizer become more useful.

Discovered that the thread-MPI trylock behaviour has always been buggy
on Windows, and cannot be fixed so that the return code is consistent
across the two current implementations in the case where the calling
thread might already own the lock. Fortunately, we don't use trylocks
anywhere, and the problematic case is unlikely to occur, but the
limitation is now documented.

Added unit tests for whichever mutex implementation we are using, now
and in the future. These cover the above case.

Found bugs in _where, which presumably wasn't an issue if it only
ran when handling errors. But it runs multiple times per MD step.

Refs #2122
Refs #2123

Change-Id: If1b2f092c569f47d67ce39e6decb56f04cea314a

7 years agoReduce compilation coupling
Mark Abraham [Tue, 14 Feb 2017 16:22:31 +0000 (17:22 +0100)]
Reduce compilation coupling

Only tree reduction uses CPU-side atomic operations, so we can stop
e.g. all the Verlet-scheme kernels including details of the thread-MPI
implementation.

Change-Id: If7c6c9c1c9b17230901bece81322a0587a50d160

7 years agoRemove duplicate AVX512 gather definitions
Roland Schulz [Thu, 9 Feb 2017 01:52:08 +0000 (17:52 -0800)]
Remove duplicate AVX512 gather definitions

Better code reuse by having all gather functions call the same
function. Also more consistent optimization of align
multiplication.

Change-Id: I446bee828655be9010919456215041a35eb36efb

7 years agoCheck log output in thread affinity tests
Teemu Murtola [Fri, 3 Jun 2016 03:31:22 +0000 (06:31 +0300)]
Check log output in thread affinity tests

Use the ability to redirect the logging to actually check that the
correct warnings get produced for the tests.  For now, most expected
texts are partially duplicated in each test that produces them, but
these can be centralized if it becomes a problem.

All regular output from thread affinity setting now goes through mdlog,
except for one to stderr.

Change-Id: I603e838693b6593d116fb2597eda7f1bf97c9454

7 years agoMulti-rank thread affinity tests
Teemu Murtola [Sun, 15 May 2016 07:23:14 +0000 (10:23 +0300)]
Multi-rank thread affinity tests

Add tests for setting the thread affinity on multiple MPI ranks,
including various heterogeneous run setups where thread affinity setting
fails only on a subset of the nodes.

Allow simulating multi-node environments, including heterogeneous nodes,
with both MPI flavors.

Change-Id: I69628d8e3d8f2d87cd40f8393da4b251ce1cba94

7 years agoComplete the removal of stateful RNG
Mark Abraham [Tue, 20 Dec 2016 11:25:19 +0000 (22:25 +1100)]
Complete the removal of stateful RNG

Only checkpoint files from several version ago can contain these
fields, and reading checkpoint files written with different major
versions is already unsupported. The enumerations should not change
because the numerical values in supported files should remain the
same.

Changed the enum values and matching strings to make this
situation explicit when reading the code.

Change-Id: I93d57ee3791202c33c2312c4b5d8927b5d7ad351

7 years agoImproved state_change_natoms and used it more
Mark Abraham [Tue, 20 Dec 2016 10:26:56 +0000 (21:26 +1100)]
Improved state_change_natoms and used it more

If the t_state control flags indicate that per-atom arrays will be
used, resize them appropriately whenever this routine is called.

CG minimization and non-DD simulations take care of organizing their
own state flags and allocations, rather than relying on code located
elsewhere. Non-DD used to rely on the allocation of x made when
reading the tpr, and perhaps one for v made in set_state_entries (if
not read from the tpr), and one for f made in do_md or init_em.

Commented more widely about why allocations for force arrays are
of size natoms+1.

Change-Id: I803c2695969f78616016520cdd8e9425507ab7c1

7 years agoRemove EST_DISTR from state.h
Mark Abraham [Wed, 21 Dec 2016 00:01:16 +0000 (11:01 +1100)]
Remove EST_DISTR from state.h

This was only used in DD code, and now that there are fewer per-atom
state arrays, its definition and use led to more complicated and
slower code than needed.

Refactored so that we operate directly on the only state entries that
redistribute with DD.

Localized some iteration variables while I was there.

Change-Id: I56d4d15e1c1877908c513838c3e3825a4c8a467f

7 years agoEnhance warninp
Mark Abraham [Thu, 29 Dec 2016 13:55:18 +0000 (13:55 +0000)]
Enhance warninp

Permit the counts of warnings of different types to be reset, which
may prove useful in testing.

Provides overloads that accept messages as std::string.

Change-Id: I25d94e3169352deb941ed73d096cc75deb6b57e2

7 years agoAdd initialization to dvdlambda in bonded forces tests
Aleksei Iupinov [Thu, 9 Feb 2017 12:39:44 +0000 (13:39 +0100)]
Add initialization to dvdlambda in bonded forces tests

Should fix #2093.

Change-Id: I7c99200443bd13c26757615d3101da1c52c8859d

7 years agoDocument key-value tree transforms and improve checks
Teemu Murtola [Fri, 11 Nov 2016 19:02:19 +0000 (21:02 +0200)]
Document key-value tree transforms and improve checks

Add assertions to provide better messages in case of unintended usage,
and document the interface used to specify rules.  This should cover all
of the key-value tree code that is currently exposed for mdp input
handling through IInputRecExtension, with the exception of
KeyValueTreeObjectBuilder that is exposed if one uses toObject().

Change-Id: Ic36a2c41ba418abfa46cc9b37d6cd7eed5a896b6

7 years agoFix typo (Dihedarl -> Dihedral)
Aleksei Iupinov [Thu, 9 Feb 2017 10:46:57 +0000 (11:46 +0100)]
Fix typo (Dihedarl -> Dihedral)

Change-Id: I35a17a488bcc354c0bd4bfa9b8ee7f84e8dfb786

7 years agoOverview documentation for new mdp input scheme
Teemu Murtola [Sun, 30 Oct 2016 13:12:07 +0000 (15:12 +0200)]
Overview documentation for new mdp input scheme

Change-Id: I22368dd9cf19bf43a942dde98b6d30ff6be6d605

7 years agoExtend serialization to gmx_int64_t
Mark Abraham [Sun, 1 Jan 2017 19:12:55 +0000 (19:12 +0000)]
Extend serialization to gmx_int64_t

Change-Id: Ib48b89d3f6e75e47ab6462c4505227e3f14913a5

7 years agoGeneric KeyValueTree broadcast
Teemu Murtola [Sun, 23 Oct 2016 07:14:42 +0000 (10:14 +0300)]
Generic KeyValueTree broadcast

Broadcast the KeyValueTree as part of inputrec, instead of having
special code in each module and a method in IInputRecExtension for this
purpose.  Now the only thing the electric field code needs to do for mdp
input/inputrec is to declare the options it accepts (and how they map
from mdp options).

Change-Id: Ia40120d4dd887c533cb6fcb60535852436dbd781

7 years agoGeneric gmx check implementation with KeyValueTree
Teemu Murtola [Sun, 23 Oct 2016 04:31:43 +0000 (07:31 +0300)]
Generic gmx check implementation with KeyValueTree

Implement gmx check as a generic comparison of KeyValueTree objects,
instead of calling IInputRecExtension.  This removes all special code in
the modules needed to support gmx check.

Only bare minimum comparison functionality is implemented for now to
support the cases that are possible with the electric field module.

Change-Id: I2b9a025c61022919f1c6730b9523983416d08364

7 years agoGeneric gmx dump implementation for KeyValueTree
Teemu Murtola [Sat, 22 Oct 2016 03:45:48 +0000 (06:45 +0300)]
Generic gmx dump implementation for KeyValueTree

Instead of calling IInputRecExtension, make gmx dump directly write out
the KeyValueTree structure.  This removes the need for any special code
in the modules to support gmx dump.

This does not work with the mdp output from gmx dump, but neither did
the old code.  This should be relatively easy to put back once we have a
structured mdp format.

Change-Id: Ie1420ce6e1ae14e73da1be09ce48faf1b5ed9daf

7 years agoAVX512: Use double-sized gather for pairs of floats
Roland Schulz [Tue, 7 Feb 2017 19:14:13 +0000 (11:14 -0800)]
AVX512: Use double-sized gather for pairs of floats

Also remove unnecessary cast and multiplication

Change-Id: Idb3ccadf5b6c39e2fd0b84c223e29510df2ed543

7 years agoMerge "Merge branch release-2016"
Gerrit Code Review [Wed, 8 Feb 2017 17:09:33 +0000 (18:09 +0100)]
Merge "Merge branch release-2016"

7 years agoGeneric tpr handling for electric field
Teemu Murtola [Tue, 11 Oct 2016 19:30:47 +0000 (22:30 +0300)]
Generic tpr handling for electric field

Remove special code to store inputrec values to tpr files from
IInputRecExtension, and instead store them as a generic KeyValueTree.

Currently, there is no support for changing the storage format, other
than by adding new options. We may not need this immediately, and we
think it should not be any extra work to introduce it later (rather
than right now). With the present approach, tpr backwards
compatibility is essentially the same as mdp backwards compatibility.

There are now two paths to setting up modules for use, depending
whether the data is coming from mdp parsing in e.g. grompp or tests,
or from tpr parsing in e.g. mdrun, dump or check (but not tpbconv).

Change-Id: I0a0f552041b2a7401bc82972c9648d1f3a64af34

7 years agoCreate applied-forces module group
Mark Abraham [Mon, 30 Jan 2017 16:20:23 +0000 (17:20 +0100)]
Create applied-forces module group

Some more formal grouping should emerge later on, but for now the
responsibilities are handled close to where they should be handled.

Change-Id: Ic8de97eccb0311f94e8e1818ca9b5368a05729b4

7 years agoPME force gathering tests
Aleksei Iupinov [Thu, 29 Dec 2016 23:21:59 +0000 (00:21 +0100)]
PME force gathering tests

Unit tests for PME force gathering on CPU.
Test 2 grid sizes, PME orders from 3 to 5, normal and triclinic boxes,
configurations of 1, 2 and 13 atoms, with and without input forces reduction.
Forces gathered from the grid are tested as outputs.

Change-Id: I1b624e0019f2c8401084db5af4dab7c0efc932fb

7 years agoFix invalid triclinic box in the PME test data
Aleksei Iupinov [Wed, 25 Jan 2017 16:02:44 +0000 (17:02 +0100)]
Fix invalid triclinic box in the PME test data

An assert for unit cell correctness is added to the PME tests'
initialization routine. The input box in the spline/spread test
is corrected along with the reference outputs.

Change-Id: Ide1ead2bd7e58f18cf0527c3387f0ec80e6f2654

7 years agoGive MDModules responsibility for option handling
Mark Abraham [Mon, 30 Jan 2017 14:29:37 +0000 (15:29 +0100)]
Give MDModules responsibility for option handling

Centralized responsibility for option handling to avoid repetitious
code. This includes the (temporary) need to convert old-style mdp
options to key-value paths during the transition period, and the
ongoing need to integrate the default values declared by modules for
their options with the user's input (which will eventually be given in
key-value form).

Eliminated init_ir, after one of its responsibilities disappeared.

Noted TODOs for future changes.

Change-Id: Ifd763e050944055c1d51a416fa0f9f3a7682ec5d

7 years agoMerge branch release-2016
Mark Abraham [Tue, 7 Feb 2017 13:27:05 +0000 (14:27 +0100)]
Merge branch release-2016

Minor clashes mostly from nullptr and logger introduction in master
branch. Resolved all in favour of release-2016 logic implemented with
in master-branch functionality.

Change-Id: Ic30ce3b3aadaab6e74f6d9606ca00fb275a6ccb3

7 years agoBumped version to prepare for next patch release
Mark Abraham [Tue, 7 Feb 2017 13:22:22 +0000 (14:22 +0100)]
Bumped version to prepare for next patch release

Change-Id: I2a2ee89a0c8123ff870292b418d76afe2d542189

7 years agoIntroduced system preparation section to user guide
Mark Abraham [Fri, 20 Jan 2017 10:43:43 +0000 (11:43 +0100)]
Introduced system preparation section to user guide

This gives us somewhere we could document the use and limitations of
vdwradii.dat better.

Enchanced documentation of solvate and insert-molecules, similarly.

Refs #2094

Change-Id: I019948472dfc308c1acd74d4fce271ba4d481ead

7 years agoVersion 2016.2
Mark Abraham [Sun, 5 Feb 2017 20:11:24 +0000 (21:11 +0100)]
Version 2016.2

Bumped regressiontests hash and minor soversion as usual.

Change-Id: Ib005dda4f70e40c79d5911f53c08b1d358fe2948

7 years agoAdd mdp option check with decoupled modes
Berk Hess [Wed, 9 Nov 2016 21:25:53 +0000 (22:25 +0100)]
Add mdp option check with decoupled modes

When atoms involved in an angle with constrained bonds have very
different masses, there can be very weakly coupled dynamics modes.
Default mdp settings are often not sufficiently accurate to obtain
equipartitioning. This change adds a grompp check for this issue.

Part of #2071.

Change-Id: I64323154c38abe23b8d38d9d539d2a713a5c35e0

7 years agoMerge branch release-5-1 into release-2016
Mark Abraham [Sun, 5 Feb 2017 20:03:24 +0000 (21:03 +0100)]
Merge branch release-5-1 into release-2016

Resolved conflict in gmx_order in favour of newly
corrected code from release-5-1 branch.

Change-Id: I7ed58873c0629bd33e18dd887d63b6ee8af7e32b

7 years agoFixes SEGV in gmx order.
David van der Spoel [Wed, 1 Feb 2017 19:06:25 +0000 (20:06 +0100)]
Fixes SEGV in gmx order.

gmx order used a cumbersome floating point method to compute
an index in a histogram leading to index -1. The present code
is simpler and robust, in fact the old code was likely wrong.

Fixes #2104

Change-Id: Ic3c15917eebe6c4964cd5cb053dfa4f05781cb73

7 years agoRemove typedef struct in some mdtypes files
Mark Abraham [Thu, 26 Jan 2017 15:08:46 +0000 (16:08 +0100)]
Remove typedef struct in some mdtypes files

The idiom

typedef struct { /*...*/ } t_foo;

is a C anachronism we use in some places, that permits the use of
t_foo without struct, but inhibits the use of

struct foo;

forward declarations in all headers that include such structs,
etc.

Removed this so that in future, e.g. the interface of IForceProvider
can use these structs in name, rather than resort to hackery on void
pointers (as we do for force reduction buffers for different reasons).

Regenerated the group-scheme kernels, which all now need to refer to
struct t_forcerec because they compile as C.

Change-Id: I5eb07aa018c54cc74df6dfc918b559e84ea996a8

7 years agoClarify use of tau-p and pcoupltype
Mark Abraham [Fri, 5 Feb 2016 17:40:28 +0000 (18:40 +0100)]
Clarify use of tau-p and pcoupltype

grompp used to permit "tau-p = 5 5" which is misleading. The recent
fix for #1893 leads to the user receiving a grompp warning, so this
improves the docs to make clear that pressure coupling is not
implemented like temperature coupling (where different time constants
might be used).

Refs #1893

Change-Id: I8328b30a12689795c7af2d12dfc94db11b78a03a

7 years agoReally fix array of complex in cross_corr
Berk Hess [Thu, 2 Feb 2017 20:54:00 +0000 (21:54 +0100)]
Really fix array of complex in cross_corr

A recent fix in cross_corr did not fix  a double precision FFT call
in single precision.

Fixes #2109.

Change-Id: Iefe11508b9e8c5dd255851063ab1e7bd95abe196

7 years agoFix array of complex in cross_corr
Berk Hess [Tue, 31 Jan 2017 15:03:35 +0000 (16:03 +0100)]
Fix array of complex in cross_corr

An array of complex number was created as an array of pointers and
then passed to gmx_fft_1d. This does not work.

Fixes #2109.

Change-Id: If28cf6d3b586615ee4857a89d937f7083287d209

7 years agoOnly print all dangling atoms with grompp -v
David van der Spoel [Thu, 2 Feb 2017 07:34:55 +0000 (08:34 +0100)]
Only print all dangling atoms with grompp -v

Fixes #2108

Change-Id: I28ec7498e52fb7a3a81ffcd6764e8edd3ae1b367

7 years agoMerge branch release-5-1 into release-2016
Mark Abraham [Tue, 31 Jan 2017 14:14:36 +0000 (15:14 +0100)]
Merge branch release-5-1 into release-2016

Change-Id: I5726f23a376f1be0052afdd917537f03f703760e

7 years agoFix multi-domain reruns
Mark Abraham [Fri, 27 Jan 2017 15:58:09 +0000 (16:58 +0100)]
Fix multi-domain reruns

3da127 broke multi-domain rerun by failing to consider the
logic within rerun_parallel_comm.

Fixes #2105

Change-Id: I3b38a248a4fba5b3d46f0275add75948ef7a9c53

7 years agoDon't print invalid performance data
Mark Abraham [Fri, 20 Jan 2017 15:08:24 +0000 (16:08 +0100)]
Don't print invalid performance data

If mdrun finished before a scheduled reset of the timing information
(e.g. from mdrun -resetstep or mdrun -resethway), then misleading
timing information should not be reported.

Fixes #2041

Change-Id: I4bd4383c924a342c01e9a3f06b521da128f96a35

7 years agoPME spline computation and charge spreading tests
Aleksei Iupinov [Fri, 2 Dec 2016 13:46:49 +0000 (14:46 +0100)]
PME spline computation and charge spreading tests

Unit tests for PME spline parameter calculation and charge spreading on CPU.
Test 2 grid sizes, PME orders from 3 to 5, normal and triclinic boxes,
configurations of 1, 2 and 13 atoms.
Spline parameters, gridline indices and real-space grid are tested as outputs.

Change-Id: Ie2ece38c407ad957991f428ec2600c33bed9b78a

7 years agoRemove unused argument in GPU kernels
Szilárd Páll [Mon, 23 Jan 2017 19:22:01 +0000 (20:22 +0100)]
Remove unused argument in GPU kernels

The helper functions of potential switch non-bonded GPU kernels ended up
with leftover C6/C12 arguments which this commit removed.

Change-Id: I99b9c1cbb255bf00c5da56395bd336e7c57e64a0

7 years agoAdd const qualifier to some PME spread arguments
Aleksei Iupinov [Thu, 19 Jan 2017 13:45:57 +0000 (14:45 +0100)]
Add const qualifier to some PME spread arguments

Change-Id: I4c9f35e84a2b4a09df5b0842c4ec68dbaad35ca1

7 years agoStopped header files including state.h
Mark Abraham [Mon, 7 Nov 2016 11:49:51 +0000 (12:49 +0100)]
Stopped header files including state.h

This reduces the number of source files that depend on state.h from
about 97 to 43, thereby reducing compilation coupling.

Removed depencency of boxutilities on t_state, which didn't seem
useful or necessary.

Change-Id: I72517330909767a5a31975b6d545dc1d8fc8d8a7

7 years agoAdded reference for dihedral function in OPLS.
David van der Spoel [Sat, 21 Jan 2017 19:01:56 +0000 (20:01 +0100)]
Added reference for dihedral function in OPLS.

The OPLS four-term dihedral function was not described in the
reference listed earlier, so this was updated. Also updated
the reference to the three term dihedral to an older paper.

Change-Id: I3673572335a0fccaf6548c6adf38392af15e7964

7 years agoFixed gmx rmsf -q -oq.
Mark Abraham [Sun, 22 Jan 2017 13:56:19 +0000 (14:56 +0100)]
Fixed gmx rmsf -q -oq.

xref was used instead of pdbx in that case, which led to a PDB file
containing B-factors to have the coordinates based on those from the
-s file, rather than -q file. The tool description (and the other
logic) suggests that using -q should be the behaviour, in particular
because the contents of xref were then unused. gmx rmsf -oq was
otherwise fine.

Also fixed where xref was being abused as a temporary vector, which
asks for more such trouble, so improved that (without changing
functionality).

Noted TODO that npdbatoms might not match top.atoms.nr leading to
possible segfaults.

Change-Id: Id2c14fa5ca93c2a8de87f9bfa144a6db38fcc97f

7 years agoRemoved init_state
Mark Abraham [Mon, 7 Nov 2016 15:59:59 +0000 (16:59 +0100)]
Removed init_state

Made a simple zero-initializing constructor for t_state and the
structs of some of its members. Called them classes. Later, we might
prefer to require explicit initialization with actual values, so that
tools can detect the use of uninitialized values and find our bugs,
but for now having a constructor is a useful initial step in that
direction.

Extracted some new functions that cover some of the incidental
functionality that was also present in init_state.

Made state.lambda a std::array, thereby removing the need to consider
resizing it, and converted client code to be passed an ArrayRef rather
than hard-code the name of the specific container. This caters for
convenient future refactoring of the underlying storage, and sometimes
needing to implicitly know what the size of the container is.

Passing an ArrayRef by value is consistent with the CppCoreGuidelines,
but has potential for performance impact. Doing this means that a
caller pushes onto the stack a copy of the object (containing two
pointers), rather than previous idioms such as pointer + size, or
pointer + implicit constant size from an enum, or pointer + implicit
size in some other parameter. This could mean an extra argument is
pushed to the stack for the function call, compared with the
alternatives of pushing a pointer to data, pointer to container, or
pointer to ArrayRef. In all cases, the caller has to load the pointer
value via an offset that is known to the compiler, so that aspect is
probably irrelevant. So, we would probably prefer to avoid calling
functions that take such parameters in a tight loop, or where multiple
containers share a common size. But the uses in this patch seem to be
of sufficiently high level to be an acceptable trade of possible
performance for improved maintainability.

Change-Id: I17e7d83cfc89566f76fa9949c425b950ad6aef62

7 years agoInitialize GMX_*_LIBRARIES cmake variables earlier
Mark Abraham [Tue, 10 Jan 2017 16:07:41 +0000 (17:07 +0100)]
Initialize GMX_*_LIBRARIES cmake variables earlier

NVML linking got broken by the way the introduction of separate
variables also set them to empty initial values, but did so after
gmxManageGPU.cmake tried to set GMX_EXTRA_LIBRARIES.

Made minor improvements to the documentation

Fixes #2098
Refs #2087

Change-Id: I25116c6caa0d13bf9bb06854c8e3a1e3f7e8afb2

7 years agoDisallow overwriting of dihedral type 9
Berk Hess [Fri, 9 Dec 2016 10:19:26 +0000 (11:19 +0100)]
Disallow overwriting of dihedral type 9

It is no longer allowed to repeat blocks of parameter of multiple
lines for dihedrals of type 9. It is also no longer allowed to
override parameters or dihedrals of type 9. Both are too complex
to properly check. It is still allowed to repeat parameters blocks
consisting of a single line.
Repeating a block with the same parameters would lead to incorrect
dihedral potentials and forces.

Fixed bug in arrayref.h interfaces.

Fixes #2077.

Change-Id: I802c6714a9700744df4e6b5ea96e41aa82793388

7 years agoFix missing break in switch
Roland Schulz [Fri, 20 Jan 2017 08:00:50 +0000 (00:00 -0800)]
Fix missing break in switch

Introduced by 74474d6f

Also make compile with -Wimplicit-fallthrough which is default
with gcc 7.

Change-Id: Ib9f315d2c7d78a3db471350652e29682993398b6

7 years agoOnly predict shells with velocities
Berk Hess [Fri, 20 Jan 2017 10:27:36 +0000 (11:27 +0100)]
Only predict shells with velocities

For integrators without velocities (EM, NM, BD), shells are now only
predicted for the initial configuration, because velocities are
required for predicting shells at normal integration steps.

Change-Id: If585d2b221a87b829fafa1b9f775a8bd5bc53498

7 years agoSimplify gmx_count_gpu_dev_unique()
Aleksei Iupinov [Wed, 14 Dec 2016 17:14:13 +0000 (18:14 +0100)]
Simplify gmx_count_gpu_dev_unique()

Simplified counting of GPUs in use.
A redundant call to  gmx_gpu_sharing_supported() is also removed,
as it should only be used during the GPU assignment stage.

Change-Id: I203f5b270dc8d1bbb87cb9b847ff9a77b7e703e5

7 years agoPME B-Spline moduli computation unit test
Aleksei Iupinov [Mon, 10 Oct 2016 10:23:10 +0000 (12:23 +0200)]
PME B-Spline moduli computation unit test

Added PME B-spline moduli computation unit test for
failing gracefully (throwing gmx::InconsistentUserInput)
or reproducing results correctly. Some PME memory leaks are fixed;
unique_cptr is used during the PME initialization
to avoid leaks in the failure tests.
Added checks on pme-order and grid size in grompp.

Change-Id: I6be93f94b6b17e901667bbd3d39c967be6cbe77e

7 years agoFix PME order and grid size checks
Berk Hess [Tue, 17 Jan 2017 13:08:09 +0000 (14:08 +0100)]
Fix PME order and grid size checks

The PME grid size restrictions were not checked in grompp.
Now both grompp and mdrun check the grid size. Both checks are done
with the same minimum grid size independent of DD and OpenMP settings.
Renamed calc_grid to calcFftGrid and let it take the minimum grid size
into account.
Also corrected an assert that checked for pme_order>=4 iso 3.

Change-Id: I57b300f4a413ea2942fa671be67839be7ae16c39

7 years agoAdd AlignedArray
Roland Schulz [Tue, 13 Dec 2016 01:39:52 +0000 (17:39 -0800)]
Add AlignedArray

Add a simd aligned version of std::array to make it easy to use
for simd usage cases.

Change-Id: I0cbaa9838eed28ca9594f4e4a0a7835637ab5513

7 years agoCorrect assert on pme-order
Berk Hess [Tue, 17 Jan 2017 13:43:43 +0000 (14:43 +0100)]
Correct assert on pme-order

Change-Id: I2468a90d5aa46c84ea78d183327d7245862737c3

7 years agoMerge branch release-2016
Mark Abraham [Sat, 14 Jan 2017 20:58:57 +0000 (21:58 +0100)]
Merge branch release-2016

Retained master branch version of fixes for ICC on windows.

Preserved the fix for 2efc195a97f92 despite refactoring of init_em.

Change-Id: Iae54ac040cb2d72d38b0bf3a0a762a9384e4c02d

7 years agoEnable uncrustify for template
Roland Schulz [Fri, 13 Jan 2017 22:37:53 +0000 (14:37 -0800)]
Enable uncrustify for template

Change-Id: I24c99cab4eedf49ad028a5aced280e0766a2b9e1

7 years agoTidy: modernize-use-nullptr
Roland Schulz [Tue, 10 Jan 2017 20:01:23 +0000 (15:01 -0500)]
Tidy: modernize-use-nullptr

Result of:
run-clang-tidy.py -checks=modernize-use-nullptr -header-filter=.* -fix -j80
git checkout src/external src/gromacs/selection/scanner.cpp src/gromacs/selection/parser.cpp

Fixed in fft5d that MPI_COMM_NULL is used.

Details of check:
http://llvm.org/releases/3.9.0/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-use-nullptr.html

Change-Id: If9f5c6c553659b0ddcc44ac9399d141b21f6f22f

7 years agoFix AVX512 issues in debug mode
Roland Schulz [Fri, 11 Nov 2016 23:31:06 +0000 (15:31 -0800)]
Fix AVX512 issues in debug mode

- Usage of loadu_p(s|d) could cause memory error.
  Was fine with O3 because instruction is fused with broadcast.
- Wrong aligned stack variable. O3 uses register.

Change-Id: I4de8fad35872e83105c5f6461b9f6d4e84f8e648

7 years agoDocument ISerializer class
Mark Abraham [Tue, 20 Dec 2016 05:53:52 +0000 (16:53 +1100)]
Document ISerializer class

Change-Id: I85f84bb2538a8583781a62b8f1789701939b8c69

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 agoFix copyright year of previous commit
Roland Schulz [Thu, 5 Jan 2017 18:06:34 +0000 (10:06 -0800)]
Fix copyright year of previous commit

Change-Id: Ia75e70d23db7ad3e8b17aa167fb35ae3ffd42a91

7 years agoFix flat-bottom position restraints + DD + OpenMP
Berk Hess [Tue, 3 Jan 2017 13:32:47 +0000 (14:32 +0100)]
Fix flat-bottom position restraints + DD + OpenMP

When using flat-bottom position restraints with DD and OpenMP
a (re)allocation was missing, causing a segv.

Fixes #2095.

Change-Id: I03af546a0b8d03a3d384d86a2582a67584e72d46

7 years agoFix compilation with CMAKE_CXX_FLAGS="-Wall -Werror"
Aleksei Iupinov [Thu, 5 Jan 2017 14:32:29 +0000 (15:32 +0100)]
Fix compilation with CMAKE_CXX_FLAGS="-Wall -Werror"

Refs #2073

Change-Id: I9223b13e8abd251d56378052ace4fb4e9169a2aa

7 years agoFix unitialized memory access
Roland Schulz [Sun, 13 Nov 2016 23:42:50 +0000 (15:42 -0800)]
Fix unitialized memory access

Also properly check that valid values don't throw

Change-Id: Ice00da7225e49fc5550caeba00be9eb778c737d6

7 years agoMerge "Merge branch release-5-1 into release-2016" into release-2016
Gerrit Code Review [Thu, 5 Jan 2017 02:13:19 +0000 (03:13 +0100)]
Merge "Merge branch release-5-1 into release-2016" into release-2016

7 years agoStop trying to use objdump --reloc on Mac
Mark Abraham [Tue, 20 Dec 2016 11:57:54 +0000 (22:57 +1100)]
Stop trying to use objdump --reloc on Mac

Recent Xcode objdump does not support --reloc.

The warning that is based on the output of running objdump was only
implemented to work on Linux-like things, so should not spam the cmake
output on other platforms.

Change-Id: I8fae927e9f4d31de3510269c0d30bd1f10e825e6

7 years agoFix documentation of OptionsVisitor
Mark Abraham [Wed, 4 Jan 2017 02:05:11 +0000 (03:05 +0100)]
Fix documentation of OptionsVisitor

Change-Id: I343931b42232b124eb7105cd6f5b27350e56bd43

7 years agoMerge branch release-5-1 into release-2016
Mark Abraham [Tue, 3 Jan 2017 16:18:42 +0000 (17:18 +0100)]
Merge branch release-5-1 into release-2016

Skipped 9e6144061f4f as instructed by its commit message.

Change-Id: Ie275096b0e99723b56747f46f5ca667d9f84b5f0

7 years agoRemove unused member thread_one from the PME spline structure
Aleksei Iupinov [Thu, 22 Dec 2016 14:13:19 +0000 (15:13 +0100)]
Remove unused member thread_one from the PME spline structure

Change-Id: Ie6e684ddc8e6f392d4a0ba28d745d68f1066e7d9

7 years agoCorrected documentation about eigenvalue handling
Mark Abraham [Tue, 20 Dec 2016 05:17:34 +0000 (16:17 +1100)]
Corrected documentation about eigenvalue handling

Some file format docs were out of step with the implementation in
eigio.cpp.

The behaviour of gmx anaeig -eig -eig2 was not properly documented.

Change-Id: I55c4a0ab640f026e6e8a424203d54379e634a5b6

7 years agoMerge "Merge branch release-2016"
Gerrit Code Review [Tue, 20 Dec 2016 20:34:20 +0000 (21:34 +0100)]
Merge "Merge branch release-2016"

7 years agoImprove build system for plugin support
Mark Abraham [Thu, 24 Nov 2016 12:30:20 +0000 (13:30 +0100)]
Improve build system for plugin support

The mdrun-only and prefer-static-libs builds set the default for
BUILD_SHARED_LIBS to off, which silently disabled plugin support.

Converted GMX_LOAD_PLUGINS to tri-state ON/OFF/AUTO so that if the
preconditions for support are not met we can have suitable behaviour
in each case. We now write to the status line only when something
relevant changes, and issue a usefully descriptive fatal error only
when the user's request cannot be satisfied.

Renamed and reimplemented VMD_QUIETLY as EMIT_STATUS_MESSAGES.

Moved the reorganized code to its own source file.

Refs #2082

Change-Id: I0ad2d8423abbc8d8cb409e74325f2b00831644ea

7 years agoSanitize some include headers
Mark Abraham [Sat, 10 Dec 2016 07:32:32 +0000 (18:32 +1100)]
Sanitize some include headers

readinp.h was being used to acquire dependencies transitively, and was
being used where not required. Used some forward declarations where
suitable. Removed some C-style typedef struct to help with that.

This should help speed up compilation while doing some clean up I am
considering.

Change-Id: Iee7f0e523fdcc4c12d2a6a6e375b6739f63e65c5

7 years agoMerge branch release-2016
Mark Abraham [Tue, 20 Dec 2016 12:03:37 +0000 (23:03 +1100)]
Merge branch release-2016

No conflicts

Change-Id: I175809e0b4f6ebf7dbbe668de66c47c318954b55

7 years agoFix syntax in cmake status message
M. Eric Irrgang [Wed, 14 Dec 2016 00:21:24 +0000 (19:21 -0500)]
Fix syntax in cmake status message

Change-Id: I9ab793fe7d11e979fbc1cbd5ab3ec8ed6189dbb8

7 years agoAdd create_unique_with_deleter
Roland Schulz [Fri, 25 Nov 2016 06:04:08 +0000 (22:04 -0800)]
Add create_unique_with_deleter

A more flexible alternative to unique_cptr. Takes also
non-void deleter functions or lambdas as argument.

Change-Id: I25c1d7d9ed63556cc42230f3da578dc449116d78

7 years agoReplace scoped_cptr with unique_cptr
Roland Schulz [Thu, 24 Nov 2016 02:02:45 +0000 (18:02 -0800)]
Replace scoped_cptr with unique_cptr

scoped_cptr only exists for historic reasons

Change-Id: Ie77ce22855cbd440bc51d31cf9c1d5d5b30e10eb

7 years agoImprove include sorter error reporting
Vedran Miletić [Mon, 12 Dec 2016 18:40:57 +0000 (19:40 +0100)]
Improve include sorter error reporting

Change-Id: I5fe5d1ad6a4001cff6ae8a2b109e831c5e3eb433

7 years agoRemoved support for multiple entries in mdp files
Mark Abraham [Sat, 10 Dec 2016 03:59:27 +0000 (14:59 +1100)]
Removed support for multiple entries in mdp files

This was never used.

Refs #2074

Change-Id: If97800cc75b809080abb407ec3f9a885c8f95b5c

7 years agoHandle warninp correctly in xpm2ps and membed
Mark Abraham [Mon, 12 Dec 2016 03:28:35 +0000 (14:28 +1100)]
Handle warninp correctly in xpm2ps and membed

The code should not (over)write the output file before checking for
errors. For membed, it is useful to require the user to fix issues in
their input file before we unilaterally over-write it.

Called done_warning where it was omitted, which in the case of membed
meant that errors were not fatal when they should be.

Change-Id: I3c87f6bd99691b12d66906df3cc9980373429439

7 years agoFix misleading parallelization docs for gmx wham
Mark Abraham [Tue, 13 Dec 2016 22:11:00 +0000 (09:11 +1100)]
Fix misleading parallelization docs for gmx wham

Change-Id: I5bbadc4fc9b9af6bcd2a6ea1a848eae262e4fd8c

7 years agoAdd bonded #thread runtime check
Berk Hess [Thu, 8 Dec 2016 11:20:23 +0000 (12:20 +0100)]
Add bonded #thread runtime check

Replaced a debug assertion on the number of OpenMP threads not being
larger than GMX_OPENMP_MAX_THREADS by fatal error.
But since the listed forces reduction is actually not required with
listed forces, these are now conditional and mdrun can run with more
than GMX_OPENMP_MAX_THREADS threads.

Fixes #2085.

Change-Id: I7a6049d727924cd0b4df10a3525f9e7aec49c3dc

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