2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 /*! \libinternal \file
39 * Contains datatypes and function declarations needed by AWH to
40 * have its force correlation data checkpointed.
42 * \author Viveca Lindahl
43 * \author Berk Hess <hess@kth.se>
45 * \ingroup module_mdtypes
48 #ifndef GMX_MDTYPES_AWH_CORRELATION_HISTORY_H
49 #define GMX_MDTYPES_AWH_CORRELATION_HISTORY_H
58 //! Correlation block averaging data.
59 struct CorrelationBlockDataHistory
61 double blockSumWeight; /**< Sum weights for current block. */
62 double blockSumSquareWeight; /**< Sum weights^2 for current block. */
63 double blockSumWeightX; /**< Weighted sum of x for current block. */
64 double blockSumWeightY; /**< Weighted sum of y for current block. */
65 double sumOverBlocksSquareBlockWeight; /**< Sum over all blocks in the simulation of block weight^2 over the whole simulation. */
66 double sumOverBlocksBlockSquareWeight; /**< Sum over all blocks in the simulation of weight^2 over the whole simulation. */
67 double sumOverBlocksBlockWeightBlockWeightX; /**< Sum over all blocks in the simulation of block weight times blockSumWeightX over the whole simulation. */
68 double sumOverBlocksBlockWeightBlockWeightY; /**< Sum over all blocks in the simulation of block weight times blockSumWeightY over the whole simulation. */
69 double blockLength; /**< The length of each block used for block averaging. */
70 int previousBlockIndex; /**< The last block index data was added to (needed only for block length in terms of time). */
71 double correlationIntegral; /**< The time integral of the correlation function of x and y, corr(x(0), y(t)). */
74 //! Grid of local correlation matrices.
75 struct CorrelationGridHistory
77 /* These counts here since we curently need them for initializing the correlation grid when reading a checkpoint */
78 int numCorrelationTensors =
79 0; /**< Number correlation tensors in the grid (equal to the number of points). */
80 int tensorSize = 0; /**< The number of stored correlation matrix elements. */
81 int blockDataListSize =
82 0; /**< To be able to increase the block length later on, data is saved for several block lengths for each element. */
84 /* We store all tensor sequentially in a buffer */
85 std::vector<CorrelationBlockDataHistory> blockDataBuffer; /**< Buffer that contains the correlation data. */
91 * Initialize correlation grid history, sets all sizes.
93 * \param[in,out] correlationGridHistory Correlation grid history for master rank.
94 * \param[in] numCorrelationTensors Number of correlation tensors in the grid.
95 * \param[in] tensorSize Number of correlation elements in each tensor.
96 * \param[in] blockDataListSize The number of blocks in the list of each tensor element.
98 void initCorrelationGridHistory(CorrelationGridHistory* correlationGridHistory,
99 int numCorrelationTensors,
101 int blockDataListSize);
105 #endif /* GMX_MDTYPES_AWH_CORRELATION_HISTORY_H */