1 /* 2 * This file is part of the GROMACS molecular simulation package. 3 * 4 * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team. 5 * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by 6 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl, 7 * and including many others, as listed in the AUTHORS file in the 8 * top-level source directory and at http://www.gromacs.org. 9 * 10 * GROMACS is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU Lesser General Public License 12 * as published by the Free Software Foundation; either version 2.1 13 * of the License, or (at your option) any later version. 14 * 15 * GROMACS is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * Lesser General Public License for more details. 19 * 20 * You should have received a copy of the GNU Lesser General Public 21 * License along with GROMACS; if not, see 22 * http://www.gnu.org/licenses, or write to the Free Software Foundation, 23 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 24 * 25 * If you want to redistribute modifications to GROMACS, please 26 * consider that scientific software is very special. Version 27 * control is crucial - bugs must be traceable. We will be happy to 28 * consider code for inclusion in the official distribution, but 29 * derived work must not be called official GROMACS. Details are found 30 * in the README & COPYING files - if they are missing, get the 31 * official version at http://www.gromacs.org. 32 * 33 * To help us fund GROMACS development, we humbly ask that you cite 34 * the research papers on the package. Check out http://www.gromacs.org. 35 */ 36 37 /*! \libinternal \file 38 * 39 * \brief 40 * Declares AWH parameter data types. 41 * 42 * Besides internal use by the AWH module, the AWH parameters are needed 43 * for reading the user input (mdp) file and for reading and writing the 44 * parameters to the mdrun input (tpr) file. 45 * 46 * \author Viveca Lindahl 47 * \inlibraryapi 48 * \ingroup module_mdtypes 49 */ 50 51 #ifndef GMX_MDTYPES_AWH_PARAMS_H 52 #define GMX_MDTYPES_AWH_PARAMS_H 53 54 #include "gromacs/mdtypes/md_enums.h" 55 #include "gromacs/utility/basedefinitions.h" 56 57 namespace gmx 58 { 59 60 //! Target distribution enum. 61 enum 62 { 63 eawhtargetCONSTANT, 64 eawhtargetCUTOFF, 65 eawhtargetBOLTZMANN, 66 eawhtargetLOCALBOLTZMANN, 67 eawhtargetNR 68 }; 69 //! String for target distribution. 70 extern const char* eawhtarget_names[eawhtargetNR + 1]; 71 //! Macro for target distribution string. 72 #define EAWHTARGET(e) enum_name(e, gmx::eawhtargetNR, gmx::eawhtarget_names) 73 74 //! Weight histogram growth enum. 75 enum 76 { 77 eawhgrowthEXP_LINEAR, 78 eawhgrowthLINEAR, 79 eawhgrowthNR 80 }; 81 //! String for weight histogram growth 82 extern const char* eawhgrowth_names[eawhgrowthNR + 1]; 83 //! Macro for weight histogram growth string. 84 #define EAWHGROWTH(e) enum_name(e, gmx::eawhgrowthNR, gmx::eawhgrowth_names) 85 86 //! AWH potential type enum. 87 enum 88 { 89 eawhpotentialCONVOLVED, 90 eawhpotentialUMBRELLA, 91 eawhpotentialNR 92 }; 93 //! String for AWH potential type 94 extern const char* eawhpotential_names[eawhpotentialNR + 1]; 95 //! Macro for AWH potential type string. 96 #define EAWHPOTENTIAL(e) enum_name(e, gmx::eawhpotentialNR, gmx::eawhpotential_names) 97 98 //! AWH bias reaction coordinate provider 99 enum 100 { 101 eawhcoordproviderPULL, 102 eawhcoordproviderFREE_ENERGY_LAMBDA, 103 eawhcoordproviderNR 104 }; 105 //! String for AWH bias reaction coordinate provider. 106 extern const char* eawhcoordprovider_names[eawhcoordproviderNR + 1]; 107 //! Macro for AWH bias reaction coordinate provider. 108 #define EAWHCOORDPROVIDER(e) enum_name(e, gmx::eawhcoordproviderNR, gmx::eawhcoordprovider_names) 109 110 /*! \cond INTERNAL */ 111 112 //! Parameters for an AWH coordinate dimension. 113 struct AwhDimParams 114 { 115 int eCoordProvider; /**< The module providing the reaction coordinate. */ 116 int coordIndex; /**< Index of reaction coordinate in the provider. */ 117 double origin; /**< Start value of the interval. */ 118 double end; /**< End value of the interval. */ 119 double period; /**< The period of this dimension (= 0 if not periodic). */ 120 double forceConstant; /**< The force constant in kJ/mol/nm^2, kJ/mol/rad^2 */ 121 double diffusion; /**< Estimated diffusion constant in units of nm^2/ps, rad^2/ps or ps^-1. */ 122 double coordValueInit; /**< The initial coordinate value. */ 123 double coverDiameter; /**< The diameter that needs to be sampled around a point before it is considered covered. */ 124 }; 125 126 //! Parameters for an AWH bias. 127 struct AwhBiasParams 128 { 129 // TODO: Turn dimParams into a std::vector when moved into AWH module 130 int ndim; /**< Dimension of the coordinate space. */ 131 AwhDimParams* dimParams; /**< AWH parameters per dimension. */ 132 int eTarget; /**< Type of target distribution. */ 133 double targetBetaScaling; /**< Beta scaling value for Boltzmann type target distributions. */ 134 double targetCutoff; /**< Free energy cutoff value for cutoff type target distribution in kJ/mol.*/ 135 int eGrowth; /**< How the biasing histogram grows. */ 136 int bUserData; /**< Is there a user-defined initial PMF estimate and target estimate? */ 137 double errorInitial; /**< Estimated initial free energy error in kJ/mol. */ 138 int shareGroup; /**< When >0, the bias is shared with biases of the same group and across multiple simulations when shareBiasMultisim=true */ 139 gmx_bool equilibrateHistogram; /**< True if the simulation starts out by equilibrating the histogram. */ 140 }; 141 142 //! Parameters for AWH. 143 struct AwhParams 144 { 145 // TODO: Turn awhBiasParams into a std::vector when moved into AWH module 146 int numBias; /**< The number of AWH biases.*/ 147 AwhBiasParams* awhBiasParams; /**< AWH bias parameters.*/ 148 int64_t seed; /**< Random seed.*/ 149 int nstOut; /**< Output step interval.*/ 150 int nstSampleCoord; /**< Number of samples per coordinate sample (also used for PMF) */ 151 int numSamplesUpdateFreeEnergy; /**< Number of samples per free energy update. */ 152 int ePotential; /**< Type of potential. */ 153 gmx_bool shareBiasMultisim; /**< When true, share biases with shareGroup>0 between multi-simulations */ 154 }; 155 156 /*! \endcond */ 157 158 } // namespace gmx 159 160 #endif /* GMX_MDTYPES_AWH_PARAMS_H */ 161