2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2016,2017,2019,2021, 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.
37 * This file contains data types containing ioin/water position exchange
38 * data to be stored in the checkpoint file.
41 #ifndef GMX_MDLIB_SWAPHISTORY_H
42 #define GMX_MDLIB_SWAPHISTORY_H
44 #include "gromacs/mdtypes/md_enums.h"
45 #include "gromacs/utility/enumerationhelpers.h"
47 enum class Domain : int;
48 enum class ChannelHistory : int;
49 /* History of an ion type used in position swapping
51 struct swapstateIons_t
53 gmx::EnumerationArray<Compartment, int> nMolReq; // Requested # of molecules per compartment
54 gmx::EnumerationArray<Compartment, int*> nMolReq_p; // Pointer to this data (for checkpoint writing)
55 gmx::EnumerationArray<Compartment, int> inflow_net; // Flux determined from the # of swaps
56 gmx::EnumerationArray<Compartment, int*> inflow_net_p; // Pointer to this data
57 gmx::EnumerationArray<Compartment, int*> nMolPast; // Array with nAverage entries for history
58 gmx::EnumerationArray<Compartment, int*> nMolPast_p; // Pointer points to the first entry only
60 // Channel flux detection, this is counting only and has no influence on whether swaps are performed or not: */
61 gmx::EnumerationArray<Channel, int> fluxfromAtoB; // Flux determined from the split cylinders
62 gmx::EnumerationArray<Channel, int*> fluxfromAtoB_p; // Pointer to this data
63 int nMol; // Number of molecules, size of the following arrays
64 Domain* comp_from; // Ion came from which compartment?
65 ChannelHistory* channel_label; // Through which channel did this ion pass?
68 /* Position swapping state
70 * To also make multimeric channel proteins whole, we save the last whole configuration
71 * of the channels in the checkpoint file. If we have no checkpoint file, we assume
72 * that the starting configuration has the correct PBC representation after making the
73 * individual molecules whole
75 * \todo move out of this file to ObservablesHistory
78 typedef struct swaphistory_t
80 SwapType eSwapCoords; // Swapping along x, y, or z-direction?
81 int nIonTypes; // Number of ion types, this is the size of the following arrays
82 int nAverage; // Use average over this many swap attempt steps when determining the ion counts
83 int fluxleak; // Ions not going through any channel (bad!)
84 int* fluxleak_p; // Pointer to this data
85 bool bFromCpt; // Did we start from a checkpoint file?
86 gmx::EnumerationArray<Channel, int> nat; // Size of xc_old_whole, i.e. the number of atoms in each channel
87 gmx::EnumerationArray<Channel, rvec*> xc_old_whole; // Last known whole positions of the two channels (important for multimeric ch.!)
88 gmx::EnumerationArray<Channel, rvec**> xc_old_whole_p; // Pointer to these positions
89 swapstateIons_t* ionType; // History information for one ion type